Find and set values of attributes ({@key=value}).
(self, doc: etree.Element)
| 44 | |
| 45 | class 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. """ |
nothing calls this directly
no test coverage detected