aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/postprocessors.py
diff options
context:
space:
mode:
authorMike Dirolf <mike@dirolf.com>2012-01-12 23:20:45 -0500
committerMike Dirolf <mike@dirolf.com>2012-01-12 23:20:45 -0500
commit425fde141f17973aea0a3a85e44632fe18737996 (patch)
tree68dbb0f1ac105795fe7971115eb31a50a21a9404 /markdown/postprocessors.py
parent4c7c189ae3d32f0cc947c78c1b116539b2ca0bf6 (diff)
downloadmarkdown-425fde141f17973aea0a3a85e44632fe18737996.tar.gz
markdown-425fde141f17973aea0a3a85e44632fe18737996.tar.bz2
markdown-425fde141f17973aea0a3a85e44632fe18737996.zip
attempt at a fix for issue w/ MD links inside of html tagish stuff with safe mode on.
Diffstat (limited to 'markdown/postprocessors.py')
-rw-r--r--markdown/postprocessors.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/markdown/postprocessors.py b/markdown/postprocessors.py
index b21a569..962728b 100644
--- a/markdown/postprocessors.py
+++ b/markdown/postprocessors.py
@@ -49,7 +49,6 @@ class RawHtmlPostprocessor(Postprocessor):
""" Iterate over html stash and restore "safe" html. """
for i in range(self.markdown.htmlStash.html_counter):
html, safe = self.markdown.htmlStash.rawHtmlBlocks[i]
- html = self.unescape(html)
if self.markdown.safeMode and not safe:
if str(self.markdown.safeMode).lower() == 'escape':
html = self.escape(html)
@@ -61,6 +60,7 @@ class RawHtmlPostprocessor(Postprocessor):
text = text.replace("<p>%s</p>" %
(self.markdown.htmlStash.get_placeholder(i)),
html + "\n")
+ html = self.unescape(html)
text = text.replace(self.markdown.htmlStash.get_placeholder(i),
html)
return text
@@ -69,7 +69,10 @@ class RawHtmlPostprocessor(Postprocessor):
""" Unescape any markdown escaped text within inline html. """
for k, v in self.markdown.treeprocessors['inline'].stashed_nodes.items():
ph = util.INLINE_PLACEHOLDER % k
- html = html.replace(ph, '\%s' % v)
+ try:
+ html = html.replace(ph, '%s' % util.etree.tostring(v))
+ except:
+ html = html.replace(ph, '\%s' % v)
return html
def escape(self, html):