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

Method handleMatch

markdown/inlinepatterns.py:507–519  ·  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

505
506 """
507 def handleMatch(self, m: re.Match[str], data: str) -> tuple[etree.Element, int, int]: # pragma: no cover
508 """
509 Return [`Element`][xml.etree.ElementTree.Element] in following format:
510 `<tag1><tag2>group(2)</tag2>group(3)</tag2>` where `group(3)` is optional.
511
512 """
513 tag1, tag2 = self.tag.split(",")
514 el1 = etree.Element(tag1)
515 el2 = etree.SubElement(el1, tag2)
516 el2.text = m.group(2)
517 if len(m.groups()) == 3:
518 el2.tail = m.group(3)
519 return el1, m.start(0), m.end(0)
520
521
522class HtmlInlineProcessor(InlineProcessor):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected