(
state: StateBlock, startLine: int, endLine: int, silent: bool
)
| 43 | closing_matcher = lambda opening_len, closing_len: closing_len >= opening_len # noqa: E731 |
| 44 | |
| 45 | def _fence_rule( |
| 46 | state: StateBlock, startLine: int, endLine: int, silent: bool |
| 47 | ) -> bool: |
| 48 | LOGGER.debug( |
| 49 | "entering fence: %s, %s, %s, %s", state, startLine, endLine, silent |
| 50 | ) |
| 51 | |
| 52 | haveEndMarker = False |
| 53 | pos = state.bMarks[startLine] + state.tShift[startLine] |
| 54 | maximum = state.eMarks[startLine] |
| 55 | |
| 56 | if state.is_code_block(startLine): |
| 57 | return False |
| 58 | |
| 59 | if pos + min_markers > maximum: |
| 60 | return False |
| 61 | |
| 62 | marker = state.src[pos] |
| 63 | |
| 64 | if marker not in markers: |
| 65 | return False |
| 66 | |
| 67 | # scan marker length |
| 68 | mem = pos |
| 69 | pos = state.skipCharsStr(pos, marker) |
| 70 | |
| 71 | length = pos - mem |
| 72 | |
| 73 | if length < min_markers: |
| 74 | return False |
| 75 | |
| 76 | markup = state.src[mem:pos] |
| 77 | params = state.src[pos:maximum] |
| 78 | |
| 79 | if marker in disallow_marker_in_info and marker in params: |
| 80 | return False |
| 81 | |
| 82 | # Since start is found, we can report success here in validation mode |
| 83 | if silent: |
| 84 | return True |
| 85 | |
| 86 | # search end of block |
| 87 | nextLine = startLine |
| 88 | |
| 89 | while True: |
| 90 | nextLine += 1 |
| 91 | if nextLine >= endLine: |
| 92 | # unclosed block should be autoclosed by end of document. |
| 93 | # also block seems to be autoclosed by end of parent |
| 94 | break |
| 95 | |
| 96 | pos = mem = state.bMarks[nextLine] + state.tShift[nextLine] |
| 97 | maximum = state.eMarks[nextLine] |
| 98 | |
| 99 | if pos < maximum and state.sCount[nextLine] < state.blkIndent: |
| 100 | # non-empty line with negative indent should stop the list: |
| 101 | # - ``` |
| 102 | # test |
nothing calls this directly
no test coverage detected
searching dependent graphs…