- Complete rewrite with beautiful Rich TUI interface - Interactive and CLI modes for flexibility - Robust error handling with clear, helpful messages - Gap filling with linear interpolation support - Coordinate system transforms (pixels/normalized) - Auto-generated output filenames from input - Configurable resolution and Nuke versions - Batch processing support via CLI - Comprehensive documentation in Scripts/README_CONVERTER.md - Updated main README.md with Scripts section
45 lines
1.0 KiB
Python
45 lines
1.0 KiB
Python
"""
|
|
Parse link label
|
|
|
|
this function assumes that first character ("[") already matches
|
|
returns the end of the label
|
|
|
|
"""
|
|
|
|
from markdown_it.rules_inline import StateInline
|
|
|
|
|
|
def parseLinkLabel(state: StateInline, start: int, disableNested: bool = False) -> int:
|
|
labelEnd = -1
|
|
oldPos = state.pos
|
|
found = False
|
|
|
|
state.pos = start + 1
|
|
level = 1
|
|
|
|
while state.pos < state.posMax:
|
|
marker = state.src[state.pos]
|
|
if marker == "]":
|
|
level -= 1
|
|
if level == 0:
|
|
found = True
|
|
break
|
|
|
|
prevPos = state.pos
|
|
state.md.inline.skipToken(state)
|
|
if marker == "[":
|
|
if prevPos == state.pos - 1:
|
|
# increase level if we find text `[`,
|
|
# which is not a part of any token
|
|
level += 1
|
|
elif disableNested:
|
|
state.pos = oldPos
|
|
return -1
|
|
if found:
|
|
labelEnd = state.pos
|
|
|
|
# restore old state
|
|
state.pos = oldPos
|
|
|
|
return labelEnd
|