Skip to content

Commit 57fce76

Browse files
authored
Merge pull request #17 from livio/code-block-fix
Code block fix
2 parents 2c55105 + 68bf279 commit 57fce76

6 files changed

Lines changed: 27 additions & 5 deletions

File tree

HISTORY.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
History
33
=======
44

5+
0.2.1 (2019-05-31)
6+
------------------
7+
8+
* Fix Platform Section Markdown Extension bug with code blocks
9+
510
0.2.0 (2019-05-29)
611
------------------
712

docdown/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
__author__ = """Jason Emerick"""
44
__email__ = 'jason@mobelux.com'
5-
__version__ = '0.2.0'
5+
__version__ = '0.2.1'

docdown/platform_section.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class PlatformSectionPreprocessor(Preprocessor):
2020
RE = re.compile(r'''
2121
^@!\[(?P<sections>[\w,]+)\]\W*\n
2222
(?P<content>.*?)(?<=\n)
23-
\W*!@\W*$''', re.MULTILINE | re.DOTALL | re.VERBOSE)
23+
!@\W*$''', re.MULTILINE | re.DOTALL | re.VERBOSE)
2424

2525
def __init__(self, platform_section, **kwargs):
2626
self.platform_section = platform_section.lower().strip()

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.2.0
2+
current_version = 0.2.1
33
commit = True
44
tag = True
55

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
setup(
2222
name='docdown',
23-
version='0.2.0',
23+
version='0.2.1',
2424
description="DocDown is a Markdown extension for source code documentation.",
2525
long_description=readme + '\n\n' + history,
2626
author="Jason Emerick, Justin Michalicek",

tests/test_platform_section_extension.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,23 @@ def test_multiple_sections(self):
115115
expected_output = '<p>some content\nshown</p>'
116116
self.assertEqual(expected_output, html)
117117

118+
def test_section_with_code_snippet(self):
119+
text = ('@![Android]\n'
120+
'some Android content shown\n\n'
121+
'``` java\n'
122+
'String java = "asdf";\n'
123+
'```\n'
124+
'!@\n')
125+
126+
html = markdown.markdown(
127+
text,
128+
extension_configs=self.build_config_for_platform_section('Android'),
129+
extensions=self.MARKDOWN_EXTENSIONS,
130+
output_format='html5'
131+
)
132+
expected_output = '<p>some Android content shown</p>\n<p><code>java\nString java = "asdf";</code></p>'
133+
self.assertEqual(expected_output, html)
134+
118135
def test_multiple_sections_with_code_snippet(self):
119136
text = ('@![iOS]\n'
120137
'some iOS content not shown\n\n'
@@ -133,5 +150,5 @@ def test_multiple_sections_with_code_snippet(self):
133150
extensions=self.MARKDOWN_EXTENSIONS,
134151
output_format='html5'
135152
)
136-
expected_output = '<p>some Android content shown</p>\n<p>``` java\nString java = "asdf";</p>'
153+
expected_output = '<p>some Android content shown</p>\n<p><code>java\nString java = "asdf";</code></p>'
137154
self.assertEqual(expected_output, html)

0 commit comments

Comments
 (0)