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

Method handleMatch

markdown/inlinepatterns.py:467–479  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

465
466 """
467 def handleMatch(self, m: re.Match[str]) -> etree.Element:
468 """
469 Return [`Element`][xml.etree.ElementTree.Element] in following format:
470 `<tag1><tag2>group(3)</tag2>group(4)</tag2>` where `group(4)` is optional.
471
472 """
473 tag1, tag2 = self.tag.split(",")
474 el1 = etree.Element(tag1)
475 el2 = etree.SubElement(el1, tag2)
476 el2.text = m.group(3)
477 if len(m.groups()) == 5:
478 el2.tail = m.group(4)
479 return el1
480
481
482class DoubleTagInlineProcessor(SimpleTagInlineProcessor):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected