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

Class FootnoteTreeprocessor

markdown/extensions/footnotes.py:436–456  ·  view source on GitHub ↗

Build and append footnote div to end of document.

Source from the content-addressed store, hash-verified

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

Callers 1

extendMarkdownMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected