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

Class FootnoteTreeprocessor

markdown/extensions/footnotes.py:419–439  ·  view source on GitHub ↗

Build and append footnote div to end of document.

Source from the content-addressed store, hash-verified

417
418
419class FootnoteTreeprocessor(Treeprocessor):
420 """ Build and append footnote div to end of document. """
421
422 def __init__(self, footnotes: FootnoteExtension):
423 self.footnotes = footnotes
424
425 def run(self, root: etree.Element) -> None:
426 footnotesDiv = self.footnotes.makeFootnotesDiv(root)
427 if footnotesDiv is not None:
428 result = self.footnotes.findFootnotesPlaceholder(root)
429 if result:
430 child, parent, isText = result
431 ind = list(parent).index(child)
432 if isText:
433 parent.remove(child)
434 parent.insert(ind, footnotesDiv)
435 else:
436 parent.insert(ind + 1, footnotesDiv)
437 child.tail = None
438 else:
439 root.append(footnotesDiv)
440
441
442class FootnoteReorderingProcessor(Treeprocessor):

Callers 1

extendMarkdownMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected