aboutsummaryrefslogtreecommitdiffstats
path: root/mdx_codehilite.py
diff options
context:
space:
mode:
authorArtem Yunusov <nedrlab@gmail.com>2008-08-02 04:08:13 +0500
committerArtem Yunusov <nedrlab@gmail.com>2008-08-02 04:08:13 +0500
commite54a1868b38c53073eb54df313962a105819b03e (patch)
tree9710069e572ed8e743be4a01096579a5e15f4ad4 /mdx_codehilite.py
parent13d25f86f61bbce247a12b845c3675b57274a13e (diff)
downloadmarkdown-e54a1868b38c53073eb54df313962a105819b03e.tar.gz
markdown-e54a1868b38c53073eb54df313962a105819b03e.tar.bz2
markdown-e54a1868b38c53073eb54df313962a105819b03e.zip
Some other extensions ported to ElementTree, litle bugfix in core.
Diffstat (limited to 'mdx_codehilite.py')
-rwxr-xr-x[-rw-r--r--]mdx_codehilite.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/mdx_codehilite.py b/mdx_codehilite.py
index 6f81598..73c1a79 100644..100755
--- a/mdx_codehilite.py
+++ b/mdx_codehilite.py
@@ -80,10 +80,11 @@ class CodeHilite:
except ImportError:
# just escape and pass through
txt = self._escape(self.src)
- if num:
+ '''if num:
txt = self._number(txt)
else :
- txt = '<div class="codehilite"><pre>%s</pre></div>\n'% txt
+ txt = '<div class="codehilite"><pre>%s</pre></div>\n'% txt'''
+ txt = self._number(txt)
return txt
else:
try:
@@ -204,7 +205,10 @@ class CodeHiliteExtention(markdown.Extension):
text = "\n".join(detabbed).rstrip()+"\n"
code = CodeHilite(text, linenos=self.config['force_linenos'][0])
placeholder = md.htmlStash.store(code.hilite(), safe=True)
- parent_elem.appendChild(md.doc.createTextNode(placeholder))
+ if parent_elem.text:
+ parent_elem.text += placeholder
+ else:
+ parent_elem.text = placeholder
md._processSection(parent_elem, theRest, inList)
md._processCodeBlock = _hiliteCodeBlock