Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf24df3e2e | ||
|
|
15329588b1 | ||
|
|
77d1e99bd5 | ||
|
|
34ad8485fa | ||
|
|
f0ce934bf8 | ||
|
|
97c78ef55b | ||
|
|
99cd237f27 | ||
|
|
b7e1ab889d | ||
|
|
29e86aec55 | ||
|
|
453b604096 | ||
|
|
2bde8d3e8e | ||
|
|
4f8937810b | ||
|
|
8c9b029756 | ||
|
|
ae50065872 |
@@ -5,7 +5,7 @@ import six
|
||||
|
||||
convert_heading_re = re.compile(r'convert_h(\d+)')
|
||||
line_beginning_re = re.compile(r'^', re.MULTILINE)
|
||||
whitespace_re = re.compile(r'[\r\n\s\t ]+')
|
||||
whitespace_re = re.compile(r'[\t ]+')
|
||||
html_heading_re = re.compile(r'h[1-6]')
|
||||
|
||||
|
||||
@@ -131,7 +131,8 @@ class MarkdownConverter(object):
|
||||
return text
|
||||
href = el.get('href')
|
||||
title = el.get('title')
|
||||
if self.options['autolinks'] and text == href and not title:
|
||||
# For the replacement see #29: text nodes underscores are escaped
|
||||
if self.options['autolinks'] and text.replace(r'\_', '_') == href and not title:
|
||||
# Shortcut syntax
|
||||
return '<%s>' % href
|
||||
title_part = ' "%s"' % title.replace('"', r'\"') if title else ''
|
||||
|
||||
2
setup.py
2
setup.py
@@ -10,7 +10,7 @@ read = lambda filepath: codecs.open(filepath, 'r', 'utf-8').read()
|
||||
pkgmeta = {
|
||||
'__title__': 'markdownify',
|
||||
'__author__': 'Matthew Tretter',
|
||||
'__version__': '0.6.0',
|
||||
'__version__': '0.6.3',
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,4 +10,4 @@ def test_soup():
|
||||
|
||||
|
||||
def test_whitespace():
|
||||
assert md(' a b \n\n c ') == ' a b c '
|
||||
assert md(' a b \t\t c ') == ' a b c '
|
||||
|
||||
@@ -34,7 +34,11 @@ def test_chomp():
|
||||
|
||||
|
||||
def test_a():
|
||||
assert md('<a href="http://google.com">Google</a>') == '[Google](http://google.com)'
|
||||
assert md('<a href="https://google.com">Google</a>') == '[Google](https://google.com)'
|
||||
assert md('<a href="https://google.com">https://google.com</a>', autolinks=False) == '[https://google.com](https://google.com)'
|
||||
assert md('<a href="https://google.com">https://google.com</a>') == '<https://google.com>'
|
||||
assert md('<a href="https://community.kde.org/Get_Involved">https://community.kde.org/Get_Involved</a>') == '<https://community.kde.org/Get_Involved>'
|
||||
assert md('<a href="https://community.kde.org/Get_Involved">https://community.kde.org/Get_Involved</a>', autolinks=False) == '[https://community.kde.org/Get\\_Involved](https://community.kde.org/Get_Involved)'
|
||||
|
||||
|
||||
def test_a_spaces():
|
||||
@@ -107,6 +111,11 @@ def test_hn():
|
||||
assert md('<h6>Hello</h6>') == '###### Hello\n\n'
|
||||
|
||||
|
||||
def test_hn_chained():
|
||||
assert md('<h1>First</h1>\n<h2>Second</h2>\n<h3>Third</h3>', heading_style=ATX) == '# First\n\n\n## Second\n\n\n### Third\n\n'
|
||||
assert md('X<h1>First</h1>', heading_style=ATX) == 'X# First\n\n'
|
||||
|
||||
|
||||
def test_hn_nested_tag_heading_style():
|
||||
assert md('<h1>A <p>P</p> C </h1>', heading_style=ATX_CLOSED) == '# A P C #\n\n'
|
||||
assert md('<h1>A <p>P</p> C </h1>', heading_style=ATX) == '# A P C\n\n'
|
||||
|
||||
Reference in New Issue
Block a user