Set values of an element based on attribute definitions ({@id=123}).
(text, parent)
| 102 | ATTR_RE = re.compile("\{@([^\}]*)=([^\}]*)}") # {@id=123} |
| 103 | |
| 104 | def 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 | """ |