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

Method __init__

markdown/inlinepatterns.py:576–593  ·  view source on GitHub ↗

Initialize.

(self, token: str, tags: str, smart: bool, double: bool)

Source from the content-addressed store, hash-verified

574 """Delimiter."""
575
576 def __init__(self, token: str, tags: str, smart: bool, double: bool):
577 """Initialize."""
578
579 # An unclosed delimiter.
580 #
581 # 0. Start position of the (remaining) run in the text.
582 # 1. End position of the (remaining) run in the text.
583 # 2. Whether the run is ambiguous (could be a start or an end).
584 # 3. Original length of the run.
585 # 4. Current length of the run.
586 self.stack: deque[tuple[int, int, bool, int, int]] = deque()
587 temp = tags.split(',')
588 self.tag_count = len(temp)
589 self.tags: tuple[str, str] = (temp[0], temp[1]) if self.tag_count == 2 else (temp[0], temp[0])
590 self.double = len(temp) != 2 and double
591 self.single = len(temp) != 2 and not double
592 self.smart = smart
593 self._build_patterns(token)
594
595 def _build_patterns(self, token: str) -> str:
596 """Build regular expression patterns."""

Callers

nothing calls this directly

Calls 1

_build_patternsMethod · 0.95

Tested by

no test coverage detected