Set attributes and return text without definitions.
(self, el: etree.Element, txt: str)
| 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. """ |
| 59 | def attributeCallback(match: re.Match[str]): |
| 60 | el.set(match.group(1), match.group(2).replace('\n', ' ')) |
| 61 | return ATTR_RE.sub(attributeCallback, txt) |
| 62 | |
| 63 | |
| 64 | class LegacyAttrExtension(Extension): |