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

Method handleMatch

markdown/inlinepatterns.py:488–500  ·  view source on GitHub ↗

Return [`Element`][xml.etree.ElementTree.Element] in following format: ` group(2) group(3) ` where `group(3)` is optional.

(self, m: re.Match[str], data: str)

Source from the content-addressed store, hash-verified

486
487 """
488 def handleMatch(self, m: re.Match[str], data: str) -> tuple[etree.Element, int, int]: # pragma: no cover
489 """
490 Return [`Element`][xml.etree.ElementTree.Element] in following format:
491 `<tag1><tag2>group(2)</tag2>group(3)</tag2>` where `group(3)` is optional.
492
493 """
494 tag1, tag2 = self.tag.split(",")
495 el1 = etree.Element(tag1)
496 el2 = etree.SubElement(el1, tag2)
497 el2.text = m.group(2)
498 if len(m.groups()) == 3:
499 el2.tail = m.group(3)
500 return el1, m.start(0), m.end(0)
501
502
503class HtmlInlineProcessor(InlineProcessor):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected