Method
add_anchor
(self, c: etree.Element, elem_id: str)
Source from the content-addressed store, hash-verified
| 326 | elem.tag = 'h%d' % level |
| 327 | |
| 328 | def add_anchor(self, c: etree.Element, elem_id: str) -> None: |
| 329 | anchor = etree.Element("a") |
| 330 | anchor.text = c.text |
| 331 | anchor.attrib["href"] = "#" + elem_id |
| 332 | anchor.attrib["class"] = self.anchorlink_class |
| 333 | c.text = "" |
| 334 | for elem in c: |
| 335 | anchor.append(elem) |
| 336 | while len(c): |
| 337 | c.remove(c[0]) |
| 338 | c.append(anchor) |
| 339 | |
| 340 | def add_permalink(self, c: etree.Element, elem_id: str) -> None: |
| 341 | permalink = etree.Element("a") |
Tested by
no test coverage detected