aboutsummaryrefslogtreecommitdiffstats
path: root/markdown_extensions/headerid.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2008-09-04 09:08:44 -0400
committerWaylan Limberg <waylan@gmail.com>2008-09-04 09:08:44 -0400
commit16ef63ce054d02b9fc57daafabe787dbc472e5c2 (patch)
treec79e283f9514d3ef3c9d6638dca98dab2fed731e /markdown_extensions/headerid.py
parent7b59075ffc1a6ae1c77e2b53e3b7c34ea9d3a41e (diff)
downloadmarkdown-16ef63ce054d02b9fc57daafabe787dbc472e5c2.tar.gz
markdown-16ef63ce054d02b9fc57daafabe787dbc472e5c2.tar.bz2
markdown-16ef63ce054d02b9fc57daafabe787dbc472e5c2.zip
[Headerid] Removed some legecay code from headerid extension and fixed doctests.
Diffstat (limited to 'markdown_extensions/headerid.py')
-rw-r--r--markdown_extensions/headerid.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/markdown_extensions/headerid.py b/markdown_extensions/headerid.py
index 2360071..73bcb1b 100644
--- a/markdown_extensions/headerid.py
+++ b/markdown_extensions/headerid.py
@@ -22,7 +22,7 @@ All header IDs are unique:
... #Third Header {#header}'''
>>> md = markdown.markdown(text, ['headerid'])
>>> md
- u'<h1 id="header">Header</h1>\\n\\n<h1 id="header_1">Another Header</h1>\\n\\n<h1 id="header_2">Third Header</h1>'
+ u'<h1 id="header">Header</h1>\\n<h1 id="header_1">Another Header</h1>\\n<h1 id="header_2">Third Header</h1>'
To fit within a html template's hierarchy, set the header base level:
@@ -31,7 +31,7 @@ To fit within a html template's hierarchy, set the header base level:
... ## Next Level'''
>>> md = markdown.markdown(text, ['headerid(level=3)'])
>>> md
- u'<h3 id="some_header">Some Header</h3>\\n\\n<h4 id="next_level">Next Level</h4>'
+ u'<h3 id="some_header">Some Header</h3>\\n<h4 id="next_level">Next Level</h4>'
Turn off auto generated IDs:
@@ -40,7 +40,7 @@ Turn off auto generated IDs:
... # Header with ID # { #foo }'''
>>> md = markdown.markdown(text, ['headerid(forceid=False)'])
>>> md
- u'<h1>Some Header</h1>\\n\\n<h1 id="foo">Header with ID</h1>'
+ u'<h1>Some Header</h1>\\n<h1 id="foo">Header with ID</h1>'
Use with MetaData extension:
@@ -111,8 +111,7 @@ class HeaderIdExtension (markdown.Extension) :
level = 6
h = etree.Element("h%d" % level)
parent_elem.append(h)
- inline = etree.SubElement(h, "inline")
- inline.text = m.group(2).strip()
+ h.text = m.group(2).strip()
if m.group(3) :
h.set('id', _unique_id(m.group(3)))
elif force_id: