aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2012-01-19 06:13:21 -0500
committerWaylan Limberg <waylan@gmail.com>2012-01-19 06:13:21 -0500
commite3c5efd182d9a80f34e3b9a770eed63c1d62b2f9 (patch)
tree077c4203b0ad851c62e839b86df5d1ead70c0579
parent481e50700e269f9a56337cd9fabc3b5251958d10 (diff)
downloadmarkdown-e3c5efd182d9a80f34e3b9a770eed63c1d62b2f9.tar.gz
markdown-e3c5efd182d9a80f34e3b9a770eed63c1d62b2f9.tar.bz2
markdown-e3c5efd182d9a80f34e3b9a770eed63c1d62b2f9.zip
Partial fix for issue introduced in fix for #59
Markdown markup inside angle bracktes now gets rendered properly in all cases except when safe_mode='escape'. Also added tests.
-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>