MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / handleAttributes

Function handleAttributes

markdown/inlinepatterns.py:104–108  ·  view source on GitHub ↗

Set values of an element based on attribute definitions ({@id=123}).

(text, parent)

Source from the content-addressed store, hash-verified

102ATTR_RE = re.compile("\{@([^\}]*)=([^\}]*)}") # {@id=123}
103
104def handleAttributes(text, parent):
105 """Set values of an element based on attribute definitions ({@id=123})."""
106 def attributeCallback(match):
107 parent.set(match.group(1), match.group(2).replace('\n', ' '))
108 return ATTR_RE.sub(attributeCallback, text)
109
110
111"""

Callers 1

handleMatchMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected