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

Method run

markdown/extensions/legacy_attrs.py:46–55  ·  view source on GitHub ↗

Find and set values of attributes ({@key=value}).

(self, doc: etree.Element)

Source from the content-addressed store, hash-verified

44
45class LegacyAttrs(Treeprocessor):
46 def run(self, doc: etree.Element) -> None:
47 """Find and set values of attributes ({@key=value}). """
48 for el in doc.iter():
49 alt = el.get('alt', None)
50 if alt is not None:
51 el.set('alt', self.handleAttributes(el, alt))
52 if el.text and isString(el.text):
53 el.text = self.handleAttributes(el, el.text)
54 if el.tail and isString(el.tail):
55 el.tail = self.handleAttributes(el, el.tail)
56
57 def handleAttributes(self, el: etree.Element, txt: str) -> str:
58 """ Set attributes and return text without definitions. """

Callers

nothing calls this directly

Calls 3

handleAttributesMethod · 0.95
isStringFunction · 0.90
setMethod · 0.80

Tested by

no test coverage detected