MCPcopy Create free account
hub / github.com/Python-Markdown/markdown / FootnoteTreeprocessor

Class FootnoteTreeprocessor

markdown/extensions/footnotes.py:429–449  ·  view source on GitHub ↗

Build and append footnote div to end of document.

Source from the content-addressed store, hash-verified

427
428
429class FootnoteTreeprocessor(Treeprocessor):
430 """ Build and append footnote div to end of document. """
431
432 def __init__(self, footnotes: FootnoteExtension):
433 self.footnotes = footnotes
434
435 def run(self, root: etree.Element) -> None:
436 footnotesDiv = self.footnotes.makeFootnotesDiv(root)
437 if footnotesDiv is not None:
438 result = self.footnotes.findFootnotesPlaceholder(root)
439 if result:
440 child, parent, isText = result
441 ind = list(parent).index(child)
442 if isText:
443 parent.remove(child)
444 parent.insert(ind, footnotesDiv)
445 else:
446 parent.insert(ind + 1, footnotesDiv)
447 child.tail = None
448 else:
449 root.append(footnotesDiv)
450
451
452class FootnoteReorderingProcessor(Treeprocessor):

Callers 1

extendMarkdownMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected