(state: StateBlock, startLine: int, endLine: int, silent: bool)
| 10 | |
| 11 | |
| 12 | def blockquote(state: StateBlock, startLine: int, endLine: int, silent: bool) -> bool: |
| 13 | LOGGER.debug( |
| 14 | "entering blockquote: %s, %s, %s, %s", state, startLine, endLine, silent |
| 15 | ) |
| 16 | |
| 17 | oldLineMax = state.lineMax |
| 18 | pos = state.bMarks[startLine] + state.tShift[startLine] |
| 19 | max = state.eMarks[startLine] |
| 20 | |
| 21 | if state.is_code_block(startLine): |
| 22 | return False |
| 23 | |
| 24 | # check the block quote marker |
| 25 | try: |
| 26 | if state.src[pos] != ">": |
| 27 | return False |
| 28 | except IndexError: |
| 29 | return False |
| 30 | pos += 1 |
| 31 | |
| 32 | # we know that it's going to be a valid blockquote, |
| 33 | # so no point trying to find the end of it in silent mode |
| 34 | if silent: |
| 35 | return True |
| 36 | |
| 37 | # set offset past spaces and ">" |
| 38 | initial = offset = state.sCount[startLine] + 1 |
| 39 | |
| 40 | try: |
| 41 | second_char: str | None = state.src[pos] |
| 42 | except IndexError: |
| 43 | second_char = None |
| 44 | |
| 45 | # skip one optional space after '>' |
| 46 | if second_char == " ": |
| 47 | # ' > test ' |
| 48 | # ^ -- position start of line here: |
| 49 | pos += 1 |
| 50 | initial += 1 |
| 51 | offset += 1 |
| 52 | adjustTab = False |
| 53 | spaceAfterMarker = True |
| 54 | elif second_char == "\t": |
| 55 | spaceAfterMarker = True |
| 56 | |
| 57 | if (state.bsCount[startLine] + offset) % 4 == 3: |
| 58 | # ' >\t test ' |
| 59 | # ^ -- position start of line here (tab has width==1) |
| 60 | pos += 1 |
| 61 | initial += 1 |
| 62 | offset += 1 |
| 63 | adjustTab = False |
| 64 | else: |
| 65 | # ' >\t test ' |
| 66 | # ^ -- position start of line here + shift bsCount slightly |
| 67 | # to make extra space appear |
| 68 | adjustTab = True |
| 69 |
nothing calls this directly
no test coverage detected
searching dependent graphs…