Insert each marker as a separate text token, and add it to delimiter list
(state: StateInline, silent: bool)
| 6 | |
| 7 | |
| 8 | def tokenize(state: StateInline, silent: bool) -> bool: |
| 9 | """Insert each marker as a separate text token, and add it to delimiter list""" |
| 10 | start = state.pos |
| 11 | marker = state.src[start] |
| 12 | |
| 13 | if silent: |
| 14 | return False |
| 15 | |
| 16 | if marker not in ("_", "*"): |
| 17 | return False |
| 18 | |
| 19 | scanned = state.scanDelims(state.pos, marker == "*") |
| 20 | |
| 21 | for _ in range(scanned.length): |
| 22 | token = state.push("text", "", 0) |
| 23 | token.content = marker |
| 24 | state.delimiters.append( |
| 25 | Delimiter( |
| 26 | marker=ord(marker), |
| 27 | length=scanned.length, |
| 28 | token=len(state.tokens) - 1, |
| 29 | end=-1, |
| 30 | open=scanned.can_open, |
| 31 | close=scanned.can_close, |
| 32 | ) |
| 33 | ) |
| 34 | |
| 35 | state.pos += scanned.length |
| 36 | |
| 37 | return True |
| 38 | |
| 39 | |
| 40 | def _postProcess(state: StateInline, delimiters: list[Delimiter]) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…