aboutsummaryrefslogtreecommitdiffstats
path: root/mdx_fenced_code.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2008-05-18 16:05:34 -0400
committerWaylan Limberg <waylan@gmail.com>2008-05-18 16:05:34 -0400
commit80172e52c04683af35ab4dce1f5c285d73754824 (patch)
tree0ff0b650f53abe68f4fd06138033c5562464e64b /mdx_fenced_code.py
parenta91e308363eeacd77270cdcb3df2109e0cfe2d18 (diff)
downloadmarkdown-80172e52c04683af35ab4dce1f5c285d73754824.tar.gz
markdown-80172e52c04683af35ab4dce1f5c285d73754824.tar.bz2
markdown-80172e52c04683af35ab4dce1f5c285d73754824.zip
The code & pre tags in Fenced Code Blocks are now closed properly.
Diffstat (limited to 'mdx_fenced_code.py')
-rw-r--r--mdx_fenced_code.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/mdx_fenced_code.py b/mdx_fenced_code.py
index 4b0e406..c3d9f7f 100644
--- a/mdx_fenced_code.py
+++ b/mdx_fenced_code.py
@@ -16,12 +16,12 @@ This extension adds Fenced Code Blocks to Python-Markdown.
... '''
>>> html = markdown.markdown(text, extensions=['fenced_code'])
>>> html
- u'<p>A paragraph before a fenced code block:\\n</p>\\n<pre><code>Fenced code block\\n<code><pre>'
+ u'<p>A paragraph before a fenced code block:\\n</p>\\n<pre><code>Fenced code block\\n</code></pre>'
Works with safe_mode also (we check this because we are using the HtmlStash):
>>> markdown.markdown(text, extensions=['fenced_code'], safe_mode='replace')
- u'<p>A paragraph before a fenced code block:\\n</p>\\n<pre><code>Fenced code block\\n<code><pre>'
+ u'<p>A paragraph before a fenced code block:\\n</p>\\n<pre><code>Fenced code block\\n</code></pre>'
Include tilde's in a code block and wrap with blank lines:
@@ -32,7 +32,7 @@ Include tilde's in a code block and wrap with blank lines:
...
... ~~~~~~~~'''
>>> markdown.markdown(text, extensions=['fenced_code'])
- u'<pre><code>\\n~~~~\\n\\n<code><pre>'
+ u'<pre><code>\\n~~~~\\n\\n</code></pre>'
Multiple blocks and language tags:
@@ -45,7 +45,7 @@ Multiple blocks and language tags:
... <p>block two</p>
... ~~~~{.html}'''
>>> markdown.markdown(text, extensions=['fenced_code'])
- u'<pre><code class="python">block one\\n<code><pre>\\n\\n<pre><code class="html">&lt;p&gt;block two&lt;/p&gt;\\n<code><pre>'
+ u'<pre><code class="python">block one\\n</code></pre>\\n\\n<pre><code class="html">&lt;p&gt;block two&lt;/p&gt;\\n</code></pre>'
"""
@@ -56,7 +56,7 @@ FENCED_BLOCK_RE = re.compile( \
r'(?P<fence>^~{3,})[ ]*\n(?P<code>.*?)(?P=fence)[ ]*(\{\.(?P<lang>[a-zA-Z0-9_-]*)\})?[ ]*$',
re.MULTILINE|re.DOTALL
)
-CODE_WRAP = '<pre><code%s>%s<code><pre>'
+CODE_WRAP = '<pre><code%s>%s</code></pre>'
LANG_TAG = ' class="%s"'