Skip to content

Commit e7c7507

Browse files
authored
Merge pull request #18 from livio/spaces
Add support for spaces in platform section tag
2 parents 57fce76 + e285d9e commit e7c7507

6 files changed

Lines changed: 40 additions & 4 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.2 (2019-06-05)
6+
------------------
7+
8+
* Fix Platform Section Markdown Extension bug with spaces in platform section names
9+
510
0.2.1 (2019-05-31)
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.1'
5+
__version__ = '0.2.2'

docdown/platform_section.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class PlatformSectionPreprocessor(Preprocessor):
1919

2020
RE = re.compile(r'''
21-
^@!\[(?P<sections>[\w,]+)\]\W*\n
21+
^@!\[(?P<sections>[\w, ]+)\]\W*\n
2222
(?P<content>.*?)(?<=\n)
2323
!@\W*$''', re.MULTILINE | re.DOTALL | re.VERBOSE)
2424

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.1
2+
current_version = 0.2.2
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.1',
23+
version='0.2.2',
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: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,37 @@ def test_multiple_platforms_section(self):
9797
expected_output = '<p>some content\nshown</p>'
9898
self.assertEqual(expected_output, html)
9999

100+
def test_platform_sections_with_spaces(self):
101+
text = ('@![asdf, qwerty]\n'
102+
'some content\nshown\n\n'
103+
'!@\n')
104+
105+
html = markdown.markdown(
106+
text,
107+
extension_configs=self.build_config_for_platform_section('qwerty'),
108+
extensions=self.MARKDOWN_EXTENSIONS,
109+
output_format='html5'
110+
)
111+
expected_output = '<p>some content\nshown</p>'
112+
self.assertEqual(expected_output, html)
113+
114+
def test_platform_section_with_space(self):
115+
text = ('@![asdf, qwerty, another platform]\n'
116+
'some content\nshown\n\n'
117+
'!@\n'
118+
'@![another platform]\n'
119+
'some extra content\nshown\n\n'
120+
'!@\n')
121+
122+
html = markdown.markdown(
123+
text,
124+
extension_configs=self.build_config_for_platform_section('another platform'),
125+
extensions=self.MARKDOWN_EXTENSIONS,
126+
output_format='html5'
127+
)
128+
expected_output = '<p>some content\nshown</p>\n<p>some extra content\nshown</p>'
129+
self.assertEqual(expected_output, html)
130+
100131
def test_multiple_sections(self):
101132
text = ('@![asdf,QwErTy]\n'
102133
'some content\nnot shown\n\n'

0 commit comments

Comments
 (0)