Skip to content

Commit 8497161

Browse files
committed
New markdown2 release changed output with code highlighting (take 2)
code highight div generated/used by pygments is on a separate line in 2.4.4 release of markdown2. python 2.7 still needs expected form without additonal newlines as 2.4.4 is python3 only.
1 parent 6e03639 commit 8497161

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/test_templating.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,10 @@ def test_string_markdown_code_block(self):
854854
self.assertEqual(p.markdown().strip().replace('\n\n', '\n'), u2s(u'<p>embedded code block &lt;pre&gt;</p>\n<pre><code>line 1\nline 2\n</code></pre>\n<p>new &lt;/pre&gt; paragraph</p>'))
855855

856856
def test_string_markdown_code_block_attribute(self):
857+
import sys
858+
859+
_py3 = sys.version_info[0] > 2
860+
857861
''' also verify that embedded html is escaped '''
858862
p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'embedded code block <pre>\n\n``` python\nline 1\nline 2\n```\n\nnew </pre> paragraph'))
859863
m = p.markdown().strip()
@@ -864,7 +868,11 @@ def test_string_markdown_code_block_attribute(self):
864868
self.assertEqual(m.replace('\n\n','\n'), '<p>embedded code block &lt;pre&gt;</p>\n<pre><code class="language-python">line 1\nline 2\n</code></pre>\n<p>new &lt;/pre&gt; paragraph</p>')
865869
else:
866870
test_output = m.replace('\n\n', '\n')
867-
expected_result = '<p>embedded code block &lt;pre&gt;</p>\n<div class="codehilite">\n<pre><span></span><code><span class="n">line</span> <span class="mi">1</span>\n<span class="n">line</span> <span class="mi">2</span>\n</code></pre>\n</div>\n<p>new &lt;/pre&gt; paragraph</p>'
871+
if _py3:
872+
nl = "\n"
873+
else:
874+
nl = ""
875+
expected_result = '<p>embedded code block &lt;pre&gt;</p>\n<div class="codehilite">%(nl)s<pre><span></span><code><span class="n">line</span> <span class="mi">1</span>\n<span class="n">line</span> <span class="mi">2</span>\n</code></pre>%(nl)s</div>\n<p>new &lt;/pre&gt; paragraph</p>' % { 'nl': nl }
868876
if test_output != expected_result:
869877
print("test_output:", test_output)
870878
print("expected_result:", expected_result)

0 commit comments

Comments
 (0)