(
self, src: str, md: MarkdownIt, env: EnvType, tokens: list[Token]
)
| 13 | |
| 14 | class StateBlock(StateBase): |
| 15 | def __init__( |
| 16 | self, src: str, md: MarkdownIt, env: EnvType, tokens: list[Token] |
| 17 | ) -> None: |
| 18 | self.src = src |
| 19 | |
| 20 | # link to parser instance |
| 21 | self.md = md |
| 22 | |
| 23 | self.env = env |
| 24 | |
| 25 | # |
| 26 | # Internal state variables |
| 27 | # |
| 28 | |
| 29 | self.tokens = tokens |
| 30 | |
| 31 | self.bMarks: list[int] = [] # line begin offsets for fast jumps |
| 32 | self.eMarks: list[int] = [] # line end offsets for fast jumps |
| 33 | # offsets of the first non-space characters (tabs not expanded) |
| 34 | self.tShift: list[int] = [] |
| 35 | self.sCount: list[int] = [] # indents for each line (tabs expanded) |
| 36 | |
| 37 | # An amount of virtual spaces (tabs expanded) between beginning |
| 38 | # of each line (bMarks) and real beginning of that line. |
| 39 | # |
| 40 | # It exists only as a hack because blockquotes override bMarks |
| 41 | # losing information in the process. |
| 42 | # |
| 43 | # It's used only when expanding tabs, you can think about it as |
| 44 | # an initial tab length, e.g. bsCount=21 applied to string `\t123` |
| 45 | # means first tab should be expanded to 4-21%4 === 3 spaces. |
| 46 | # |
| 47 | self.bsCount: list[int] = [] |
| 48 | |
| 49 | # block parser variables |
| 50 | self.blkIndent = 0 # required block content indent (for example, if we are |
| 51 | # inside a list, it would be positioned after list marker) |
| 52 | self.line = 0 # line index in src |
| 53 | self.lineMax = 0 # lines count |
| 54 | self.tight = False # loose/tight mode for lists |
| 55 | self.ddIndent = -1 # indent of the current dd block (-1 if there isn't any) |
| 56 | self.listIndent = -1 # indent of the current list block (-1 if there isn't any) |
| 57 | |
| 58 | # can be 'blockquote', 'list', 'root', 'paragraph' or 'reference' |
| 59 | # used in lists to determine if they interrupt a paragraph |
| 60 | self.parentType = "root" |
| 61 | |
| 62 | self.level = 0 |
| 63 | |
| 64 | # renderer |
| 65 | self.result = "" |
| 66 | |
| 67 | # Create caches |
| 68 | # Generate markers. |
| 69 | indent_found = False |
| 70 | |
| 71 | start = pos = indent = offset = 0 |
| 72 | length = len(self.src) |
nothing calls this directly
no test coverage detected