aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2008-11-20 20:19:28 -0500
committerWaylan Limberg <waylan@gmail.com>2008-11-20 20:19:28 -0500
commitd624305f46a334c941344e466460eef551da0f16 (patch)
tree830421bee8a97ced4749fb148cfc13e28385dbef
parent0199640b5f96ca664579892c131097bee418bfa2 (diff)
downloadmarkdown-d624305f46a334c941344e466460eef551da0f16.tar.gz
markdown-d624305f46a334c941344e466460eef551da0f16.tar.bz2
markdown-d624305f46a334c941344e466460eef551da0f16.zip
Updated toc extension for new refactor.
-rw-r--r--markdown/extensions/toc.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/markdown/extensions/toc.py b/markdown/extensions/toc.py
index cc8c93b..60fe430 100644
--- a/markdown/extensions/toc.py
+++ b/markdown/extensions/toc.py
@@ -12,14 +12,14 @@ import markdown
from markdown import etree
import re
-class TocTreeprocessor (markdown.Treeprocessor):
+class TocTreeprocessor(markdown.treeprocessors.Treeprocessor):
# Iterator wrapper to get parent and child all at once
def iterparent(self, root):
for parent in root.getiterator():
for child in parent:
yield parent, child
- def run(self, doc) :
+ def run(self, doc):
div = etree.Element("div")
div.attrib["class"] = "toc"
last_li = None
@@ -102,7 +102,7 @@ class TocTreeprocessor (markdown.Treeprocessor):
list_stack[-1].append(last_li)
-class TocExtension (markdown.Extension):
+class TocExtension(markdown.Extension):
def __init__(self, configs):
self.config = { "marker" : ["[TOC]",
"Text to find and replace with Table of Contents -"
@@ -128,10 +128,10 @@ class TocExtension (markdown.Extension):
value = unicode(re.sub('[^\w\s-]', '', value).strip().lower())
return re.sub('[-\s]+','-',value)
- def extendMarkdown(self, md, md_globals) :
+ def extendMarkdown(self, md, md_globals):
tocext = TocTreeprocessor(md)
tocext.config = self.config
md.treeprocessors.add("toc", tocext, "_begin")
-def makeExtension(configs={}) :
+def makeExtension(configs={}):
return TocExtension(configs=configs)