Method
add_anchor
(self, c: etree.Element, elem_id: str)
Source from the content-addressed store, hash-verified
| 304 | elem.tag = 'h%d' % level |
| 305 | |
| 306 | def add_anchor(self, c: etree.Element, elem_id: str) -> None: |
| 307 | anchor = etree.Element("a") |
| 308 | anchor.text = c.text |
| 309 | anchor.attrib["href"] = "#" + elem_id |
| 310 | anchor.attrib["class"] = self.anchorlink_class |
| 311 | c.text = "" |
| 312 | for elem in c: |
| 313 | anchor.append(elem) |
| 314 | while len(c): |
| 315 | c.remove(c[0]) |
| 316 | c.append(anchor) |
| 317 | |
| 318 | def add_permalink(self, c: etree.Element, elem_id: str) -> None: |
| 319 | permalink = etree.Element("a") |
Tested by
no test coverage detected