aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--markdown/inlinepatterns.py9
-rw-r--r--tests/basic/inline-html-simple.html4
-rw-r--r--tests/basic/inline-html-simple.txt1
-rw-r--r--tests/safe_mode/remove.html1
-rw-r--r--tests/safe_mode/remove.txt1
-rw-r--r--tests/safe_mode/replace.html1
-rw-r--r--tests/safe_mode/replace.txt1
7 files changed, 15 insertions, 3 deletions
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py
index 2a33816..3f92737 100644
--- a/markdown/inlinepatterns.py
+++ b/markdown/inlinepatterns.py
@@ -280,8 +280,13 @@ class HtmlPattern(Pattern):
return text
def get_stash(m):
id = m.group(1)
- if id in stash:
- return '\%s' % stash.get(id)
+ value = stash.get(id)
+ if value is not None:
+ try:
+ return util.etree.tostring(value)
+ except:
+ return '\%s' % value
+
return util.INLINE_PLACEHOLDER_RE.sub(get_stash, text)
diff --git a/tests/basic/inline-html-simple.html b/tests/basic/inline-html-simple.html
index cb10451..2159e1d 100644
--- a/tests/basic/inline-html-simple.html
+++ b/tests/basic/inline-html-simple.html
@@ -55,4 +55,6 @@ Blah
<hr class="foo" id="bar"/>
-<hr class="foo" id="bar" > \ No newline at end of file
+<hr class="foo" id="bar" >
+
+<p><some <a href="http://example.com">weird</a> stuff></p> \ No newline at end of file
diff --git a/tests/basic/inline-html-simple.txt b/tests/basic/inline-html-simple.txt
index 14aa2dc..7210750 100644
--- a/tests/basic/inline-html-simple.txt
+++ b/tests/basic/inline-html-simple.txt
@@ -67,3 +67,4 @@ Hr's:
<hr class="foo" id="bar" >
+<some [weird](http://example.com) stuff>
diff --git a/tests/safe_mode/remove.html b/tests/safe_mode/remove.html
index a1e1626..d86b2b4 100644
--- a/tests/safe_mode/remove.html
+++ b/tests/safe_mode/remove.html
@@ -31,4 +31,5 @@
<p></p>
<p></p>
<p></p>
+<p></p>
<p></p> \ No newline at end of file
diff --git a/tests/safe_mode/remove.txt b/tests/safe_mode/remove.txt
index 14aa2dc..7210750 100644
--- a/tests/safe_mode/remove.txt
+++ b/tests/safe_mode/remove.txt
@@ -67,3 +67,4 @@ Hr's:
<hr class="foo" id="bar" >
+<some [weird](http://example.com) stuff>
diff --git a/tests/safe_mode/replace.html b/tests/safe_mode/replace.html
index fdf666e..cb6bfb5 100644
--- a/tests/safe_mode/replace.html
+++ b/tests/safe_mode/replace.html
@@ -31,4 +31,5 @@
<p>[HTML_REMOVED]</p>
<p>[HTML_REMOVED]</p>
<p>[HTML_REMOVED]</p>
+<p>[HTML_REMOVED]</p>
<p>[HTML_REMOVED]</p> \ No newline at end of file
diff --git a/tests/safe_mode/replace.txt b/tests/safe_mode/replace.txt
index 14aa2dc..7210750 100644
--- a/tests/safe_mode/replace.txt
+++ b/tests/safe_mode/replace.txt
@@ -67,3 +67,4 @@ Hr's:
<hr class="foo" id="bar" >
+<some [weird](http://example.com) stuff>