Build the ancestor list.
(self, parent: etree.Element | None, parents: list[str])
| 331 | placeholder, match.groups()[-1]), True, 0 |
| 332 | |
| 333 | def __build_ancestors(self, parent: etree.Element | None, parents: list[str]) -> None: |
| 334 | """Build the ancestor list.""" |
| 335 | ancestors = [] |
| 336 | while parent is not None: |
| 337 | if parent is not None: |
| 338 | ancestors.append(parent.tag.lower()) |
| 339 | parent = self.parent_map.get(parent) |
| 340 | ancestors.reverse() |
| 341 | parents.extend(ancestors) |
| 342 | |
| 343 | def run(self, tree: etree.Element, ancestors: list[str] | None = None) -> etree.Element: |
| 344 | """Apply inline patterns to a parsed Markdown tree. |