MCPcopy Create free account
hub / github.com/Python-Markdown/markdown / __init__

Method __init__

markdown/blockprocessors.py:345–354  ·  view source on GitHub ↗
(self, parser: BlockParser)

Source from the content-addressed store, hash-verified

343 """
344
345 def __init__(self, parser: BlockParser):
346 super().__init__(parser)
347 # Detect an item (`1. item`). `group(1)` contains contents of item.
348 self.RE = re.compile(r'^[ ]{0,%d}\d+\.[ ]+(.*)' % (self.tab_length - 1))
349 # Detect items on secondary lines. they can be of either list type.
350 self.CHILD_RE = re.compile(r'^[ ]{0,%d}((\d+\.)|[*+-])[ ]+(.*)' %
351 (self.tab_length - 1))
352 # Detect indented (nested) items of either type
353 self.INDENT_RE = re.compile(r'^[ ]{%d,%d}((\d+\.)|[*+-])[ ]+.*' %
354 (self.tab_length, self.tab_length * 2 - 1))
355
356 def test(self, parent: etree.Element, block: str) -> bool:
357 return bool(self.RE.match(block))

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected