diff options
author | Waylan Limberg <waylan@gmail.com> | 2008-10-19 22:30:03 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2008-10-19 22:30:03 -0400 |
commit | 15224bd352bc6c06ae05ffd78d5ecee9ea07f6ef (patch) | |
tree | fb762121f0529a15fe09dc831f3dc75d269b30d4 /markdown_extensions | |
parent | c6e6f944773ee7ee2926b43dda4cdabd6f9a5058 (diff) | |
download | markdown-15224bd352bc6c06ae05ffd78d5ecee9ea07f6ef.tar.gz markdown-15224bd352bc6c06ae05ffd78d5ecee9ea07f6ef.tar.bz2 markdown-15224bd352bc6c06ae05ffd78d5ecee9ea07f6ef.zip |
Changed Postprocessors to Treeprocessors and TextPostProcessors to Postprocessors. These names more acturately depict what things do. Also updated the extensions and docs to match.
Diffstat (limited to 'markdown_extensions')
-rw-r--r-- | markdown_extensions/codehilite.py | 6 | ||||
-rw-r--r-- | markdown_extensions/footnotes.py | 10 | ||||
-rw-r--r-- | markdown_extensions/rss.py | 10 | ||||
-rw-r--r-- | markdown_extensions/tables.py | 4 | ||||
-rw-r--r-- | markdown_extensions/toc.py | 6 |
5 files changed, 18 insertions, 18 deletions
diff --git a/markdown_extensions/codehilite.py b/markdown_extensions/codehilite.py index 9371e79..bc75da2 100644 --- a/markdown_extensions/codehilite.py +++ b/markdown_extensions/codehilite.py @@ -175,7 +175,7 @@ class CodeHilite: # ------------------ The Markdown Extension ------------------------------- -class HilitePostprocessor(markdown.Postprocessor): +class HiliteTreeprocessor(markdown.Treeprocessor): """ Hilight source code in code blocks. """ def run(self, root): @@ -214,9 +214,9 @@ class CodeHiliteExtension(markdown.Extension): def extendMarkdown(self, md, md_globals): """ Add HilitePostprocessor to Markdown instance. """ - hiliter = HilitePostprocessor(md) + hiliter = HiliteTreeprocessor(md) hiliter.config = self.config - md.postprocessors.add("hilite", hiliter, "_begin") + md.treeprocessors.add("hilite", hiliter, "_begin") def makeExtension(configs={}): diff --git a/markdown_extensions/footnotes.py b/markdown_extensions/footnotes.py index 39379f3..2b5795d 100644 --- a/markdown_extensions/footnotes.py +++ b/markdown_extensions/footnotes.py @@ -60,11 +60,11 @@ class FootnoteExtension (markdown.Extension): md.inlinePatterns.add("footnote", FootnotePattern(FOOTNOTE_RE, self), "<reference") - # Insert a post-processor that would actually add the footnote div - md.postprocessors.add("footnote", FootnotePostprocessor(self), + # Insert a tree-processor that would actually add the footnote div + md.treeprocessors.add("footnote", FootnoteTreeprocessor(self), "_end") - md.textPostprocessors.add("footnote", FootnoteTextPostprocessor(self), + md.postprocessors.add("footnote", FootnotePostprocessor(self), ">amp_substitute") def reset(self) : @@ -216,7 +216,7 @@ class FootnotePattern (markdown.Pattern) : a.text = str(num) return sup -class FootnotePostprocessor (markdown.Postprocessor): +class FootnoteTreeprocessor (markdown.Treeprocessor): def __init__ (self, footnotes) : self.footnotes = footnotes @@ -239,7 +239,7 @@ class FootnotePostprocessor (markdown.Postprocessor): else : root.append(footnotesDiv) -class FootnoteTextPostprocessor (markdown.Postprocessor): +class FootnotePostprocessor (markdown.Postprocessor): def run(self, text) : return text.replace(FN_BACKLINK_TEXT, "↩") diff --git a/markdown_extensions/rss.py b/markdown_extensions/rss.py index b88b9b5..fa05fef 100644 --- a/markdown_extensions/rss.py +++ b/markdown_extensions/rss.py @@ -51,14 +51,14 @@ class RssExtension (markdown.Extension): md.xml_mode = True - # Insert a post-processor that would actually add the title tag - postprocessor = RssPostProcessor(self) - postprocessor.ext = self - md.postprocessors.append(postprocessor) + # Insert a tree-processor that would actually add the title tag + treeprocessor = RssTreeProcessor(self) + treeprocessor.ext = self + md.treeprocessors.append(treeprocessor) md.stripTopLevelTags = 0 md.docType = '<?xml version="1.0" encoding="utf-8"?>\n' -class RssPostProcessor (markdown.Postprocessor): +class RssTreeProcessor (markdown.Treeprocessor): def __init__(self, md): diff --git a/markdown_extensions/tables.py b/markdown_extensions/tables.py index c485f55..5339ae1 100644 --- a/markdown_extensions/tables.py +++ b/markdown_extensions/tables.py @@ -38,7 +38,7 @@ class TablePattern(markdown.Pattern) : return tr -class TablePostprocessor: +class TableTreeprocessor(markdown.Treeprocessor): def _findElement(self, element, name): result = [] @@ -62,7 +62,7 @@ class TablePostprocessor: class TableExtension(markdown.Extension): def extendMarkdown(self, md, md_globals): md.inlinePatterns.add('table', TablePattern(md), "<backtick") - md.postprocessors['table'] = TablePostprocessor() + md.treeprocessors['table'] = TableTreeprocessor() def makeExtension(configs): diff --git a/markdown_extensions/toc.py b/markdown_extensions/toc.py index ccc927c..00cf537 100644 --- a/markdown_extensions/toc.py +++ b/markdown_extensions/toc.py @@ -12,7 +12,7 @@ import markdown from markdown import etree import re -class TocPostprocessor (markdown.Postprocessor): +class TocTreeprocessor (markdown.Treeprocessor): # Iterator wrapper to get parent and child all at once def iterparent(self, root): for parent in root.getiterator(): @@ -119,9 +119,9 @@ class TocExtension (markdown.Extension): return re.sub('[-\s]+','-',value) def extendMarkdown(self, md, md_globals) : - tocext = TocPostprocessor(md) + tocext = TocTreeprocessor(md) tocext.config = self.config - md.postprocessors.add("toc", tocext, "_begin") + md.treeprocessors.add("toc", tocext, "_begin") def makeExtension(configs={}) : return TocExtension(configs=configs) |