diff --git a/markdown/extensions/footnotes.py b/markdown/extensions/footnotes.py index b52815f3c..635a2aec4 100644 --- a/markdown/extensions/footnotes.py +++ b/markdown/extensions/footnotes.py @@ -19,13 +19,10 @@ from ..preprocessors import Preprocessor from ..inlinepatterns import Pattern from ..treeprocessors import Treeprocessor -from ..postprocessors import Postprocessor from ..util import etree, text_type from ..odict import OrderedDict import re -FN_BACKLINK_TEXT = "zz1337820767766393qq" -NBSP_PLACEHOLDER = "qq3936677670287331zz" DEF_RE = re.compile(r'[ ]{0,3}\[\^([^\]]*)\]:\s*(.*)') TABBED_RE = re.compile(r'((\t)|( ))(.*)') @@ -76,10 +73,6 @@ def extendMarkdown(self, md, md_globals): md.treeprocessors.add( "footnote", FootnoteTreeprocessor(self), "_begin" ) - # Insert a postprocessor after amp_substitute oricessor - md.postprocessors.add( - "footnote", FootnotePostprocessor(self), ">amp_substitute" - ) def reset(self): """ Clear footnotes on reset, and prepare for distinct document. """ @@ -153,12 +146,12 @@ def makeFootnotesDiv(self, root): "Jump back to footnote %d in the text" % (self.footnotes.index(id)+1) ) - backlink.text = FN_BACKLINK_TEXT + backlink.text = self.getConfig("BACKLINK_TEXT") if li.getchildren(): node = li[-1] if node.tag == "p": - node.text = node.text + NBSP_PLACEHOLDER + node.text = node.text + " " node.append(backlink) else: p = etree.SubElement(li, "p") @@ -304,18 +297,6 @@ def run(self, root): root.append(footnotesDiv) -class FootnotePostprocessor(Postprocessor): - """ Replace placeholders with html entities. """ - def __init__(self, footnotes): - self.footnotes = footnotes - - def run(self, text): - text = text.replace( - FN_BACKLINK_TEXT, self.footnotes.getConfig("BACKLINK_TEXT") - ) - return text.replace(NBSP_PLACEHOLDER, " ") - - def makeExtension(*args, **kwargs): """ Return an instance of the FootnoteExtension """ return FootnoteExtension(*args, **kwargs)