Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/markdown_it/rules_block/code.py: 95%
22 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:07 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:07 +0000
1"""Code block (4 spaces padded)."""
2import logging
4from .state_block import StateBlock
6LOGGER = logging.getLogger(__name__)
9def code(state: StateBlock, startLine: int, endLine: int, silent: bool = False):
10 LOGGER.debug("entering code: %s, %s, %s, %s", state, startLine, endLine, silent)
12 if state.sCount[startLine] - state.blkIndent < 4:
13 return False
15 last = nextLine = startLine + 1
17 while nextLine < endLine:
18 if state.isEmpty(nextLine):
19 nextLine += 1
20 continue
22 if state.sCount[nextLine] - state.blkIndent >= 4:
23 nextLine += 1
24 last = nextLine
25 continue
27 break
29 state.line = last
31 token = state.push("code_block", "code", 0)
32 token.content = state.getLines(startLine, last, 4 + state.blkIndent, False) + "\n"
33 token.map = [startLine, state.line]
35 return True