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

Method handleMatch

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

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected