aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/postprocessors.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2010-03-01 13:07:57 -0500
committerWaylan Limberg <waylan@gmail.com>2010-03-15 20:41:26 -0400
commit114770b3043bca52a8e3fa4f007012b3b4dff602 (patch)
tree7cf4de3a8759442338cf1f2875f3996661ecf4dc /markdown/postprocessors.py
parenta7844d9eb42c2786d5809443b5a9c3cc1dae0788 (diff)
downloadmarkdown-114770b3043bca52a8e3fa4f007012b3b4dff602.tar.gz
markdown-114770b3043bca52a8e3fa4f007012b3b4dff602.tar.bz2
markdown-114770b3043bca52a8e3fa4f007012b3b4dff602.zip
Fix bug with rawhtml and markdown escaping. Previously, any inline rawhtml that contained text that fit markdown's escaping syntax (i.e. <x\]>) was never unescaped. Now it is. Markdown probably shouldn't be escaping before removing rawhtml in the first place, but this will do for now.
Diffstat (limited to 'markdown/postprocessors.py')
-rw-r--r--markdown/postprocessors.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/markdown/postprocessors.py b/markdown/postprocessors.py
index 80227bb..e5c2e06 100644
--- a/markdown/postprocessors.py
+++ b/markdown/postprocessors.py
@@ -44,6 +44,7 @@ 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)
@@ -59,6 +60,13 @@ class RawHtmlPostprocessor(Postprocessor):
html)
return text
+ def unescape(self, html):
+ """ Unescape any markdown escaped text within inline html. """
+ for k, v in self.markdown.treeprocessors['inline'].stashed_nodes.items():
+ ph = markdown.INLINE_PLACEHOLDER % k
+ html = html.replace(ph, '\%s' % v)
+ return html
+
def escape(self, html):
""" Basic html escaping """
html = html.replace('&', '&amp;')