Skip to content

Commit d4a1047

Browse files
authored
Merge pull request #74 from Alir3z4/commonmark-0.8.1
Add commonmark 0.8.1 compatibility
2 parents a180bea + 9444e13 commit d4a1047

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

ChangeLog.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
1.6.1
2+
================
3+
----
4+
5+
* Add commonmark 0.8.1 compatibility
6+
17
1.6.0 2017-12-03
28
================
39
----

django_markwhat/templatetags/markup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
1212
* reStructuredText, which requires docutils from http://docutils.sf.net/
1313
14-
* CommonMark, which requires CommonMark http://commonmark.org/
14+
* CommonMark, which requires commonmark http://commonmark.org/
1515
"""
1616

1717
from django import template
@@ -78,7 +78,7 @@ def markdown(value, args=''):
7878
@register.filter(is_safe=True)
7979
def commonmark(value):
8080
"""
81-
Runs CommonMark over a given value.
81+
Runs commonmark over a given value.
8282
8383
Syntax::
8484
@@ -88,10 +88,10 @@ def commonmark(value):
8888
8989
:rtype: str
9090
"""
91-
import CommonMark
91+
import commonmark
9292

93-
parser = CommonMark.Parser()
94-
renderer = CommonMark.HtmlRenderer()
93+
parser = commonmark.Parser()
94+
renderer = commonmark.HtmlRenderer()
9595
ast = parser.parse(force_text(value))
9696
return mark_safe(
9797
force_text(renderer.render(ast))

django_markwhat/tests.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
markdown = None
1919

2020
try:
21-
import CommonMark
21+
import commonmark
2222
except ImportError:
23-
CommonMark = None
23+
commonmark = None
2424

2525
try:
2626
import docutils
@@ -143,15 +143,15 @@ def test_no_markdown(self):
143143
{'markdown_content': self.markdown_content})).strip()
144144
self.assertEqual(rendered, self.markdown_content)
145145

146-
@unittest.skipUnless(CommonMark, 'commonmark not installed')
146+
@unittest.skipUnless(commonmark, 'commonmark not installed')
147147
def test_commonmark(self):
148148
t = Template("{% load markup %}{{ markdown_content|commonmark }}")
149149
rendered = t.render(
150150
Context({'markdown_content': self.markdown_content})).strip()
151151
pattern = re.compile("""<p>Paragraph 1\s*</p>\s*<h2>\s*An h2</h2>""")
152152
self.assertTrue(pattern.match(rendered))
153153

154-
@unittest.skipUnless(CommonMark, 'commonmark not installed')
154+
@unittest.skipUnless(commonmark, 'commonmark not installed')
155155
def test_commonmark_html_code(self):
156156
t = Template("{% load markup %}{{ markdown_content|commonmark }}")
157157
rendered = t.render(Context({
@@ -163,7 +163,7 @@ def test_commonmark_html_code(self):
163163
)
164164
self.assertTrue(pattern.match(rendered))
165165

166-
@unittest.skipUnless(CommonMark, 'commonmark not installed')
166+
@unittest.skipUnless(commonmark, 'commonmark not installed')
167167
def test_commonmark_html_iframe_code(self):
168168
t = Template("{% load markup %}{{ markdown_content|commonmark }}")
169169
rendered = t.render(Context({
@@ -177,13 +177,13 @@ def test_commonmark_html_iframe_code(self):
177177
)
178178
self.assertTrue(pattern.match(rendered))
179179

180-
@unittest.skipUnless(CommonMark, 'commonmark not installed')
180+
@unittest.skipUnless(commonmark, 'commonmark not installed')
181181
def test_commonmark_empty_str(self):
182182
t = Template("{% load markup %}{{ markdown_content|commonmark }}")
183183
rendered = t.render(Context({'markdown_content': ''})).strip()
184184
self.assertEqual(rendered, '')
185185

186-
@unittest.skipUnless(CommonMark, 'commonmark not installed')
186+
@unittest.skipUnless(commonmark, 'commonmark not installed')
187187
def test_commonmark_none(self):
188188
t = Template("{% load markup %}{{ markdown_content|commonmark }}")
189189
rendered = t.render(Context({'markdown_content': None})).strip()

requirements/dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Markdown==2.6.9
2-
CommonMark==0.7.4
2+
commonmark==0.8.1
33
textile==3.0.0
44
docutils==0.14
55
flake8==3.5.0

0 commit comments

Comments
 (0)