Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
585f207
Refactor HTML Parser
waylan Mar 7, 2019
77baade
fix silly error
waylan Mar 7, 2019
d4c8951
Add some new tests
waylan Mar 8, 2019
356f5c3
More tests.
waylan Mar 8, 2019
ff0f8f2
Round out tests of valid markup.
waylan Mar 11, 2019
6efe8d5
Some cleanup and bugfixes
waylan Mar 11, 2019
e5f9ca4
Some minor tweaks
waylan Mar 11, 2019
95e8498
comments partially fixed.
waylan Mar 11, 2019
ea98546
Support 0-3 spaces of indent for raw HTML blocks
waylan Mar 13, 2019
23e41d3
Remove need to wrap raw in blank lines
waylan Mar 14, 2019
46b3a1b
More tests passing
waylan Mar 14, 2019
8a17794
All handle_* methods are now defined and tested
waylan Mar 15, 2019
845637a
Some test cleanup
waylan Mar 16, 2019
eee4e49
Monkeypatch HTMLParser piclose
waylan Mar 16, 2019
b8f70b7
unknown_decl is not a handle method
waylan Mar 16, 2019
7a8a6b5
Switch back to a preprocessor
waylan Mar 16, 2019
22151c7
Start audit of legacy tests
waylan Mar 20, 2019
a0c37e1
More legacy test audits.
waylan Mar 20, 2019
0e4a545
More test audits
waylan Mar 21, 2019
49c187d
Fix amperstand handling
waylan Mar 21, 2019
3bc2960
preserve actual closing tags
waylan Mar 21, 2019
4953272
More bugs fixed
waylan Mar 22, 2019
29cc7ba
Account for code spans at start of line.
waylan Mar 22, 2019
d09d602
Code spans at start of line 2nd attempt.
waylan Mar 24, 2019
1e16fd0
Drop py2 and cleanup after rebase.
waylan Jul 1, 2020
9fe2473
First attempt at md in raw.
waylan Jul 1, 2020
e4a8796
Support markdown=1
waylan Jul 2, 2020
1d17525
Eliminate extra blank lines.
waylan Jul 7, 2020
6b4b351
Add more tests
waylan Jul 7, 2020
c0194f3
Track index of containing tag in stack.
waylan Jul 7, 2020
23375a5
Minor tweaks.
waylan Jul 7, 2020
9ffead5
break md_in_html out into subclass of HTML parser.
waylan Jul 8, 2020
e3ff368
Only put raw tags in stack.
waylan Jul 8, 2020
c96efad
Refactor and simplify logic.
waylan Jul 9, 2020
37ff86a
Disable 'incomplete' entity handling of HTMLParser.
waylan Jul 12, 2020
f02b427
Fixed whitespace issues.
waylan Jul 13, 2020
efa36c8
Import copy of html.parser so our monkeypatches don't break user's code.
waylan Jul 13, 2020
a8145f8
Handle raw blocks in tail of previous block.
waylan Jul 14, 2020
70d2624
Account for extra whitespace on blank lines.
waylan Jul 14, 2020
335816e
Handle inline raw html in tail.
waylan Jul 14, 2020
5776e97
Update md_in_html with recent htmlparser changes.
waylan Jul 15, 2020
4888464
Add test_md_in_html.py
waylan Jul 22, 2020
aae6676
More tests
waylan Jul 27, 2020
183537f
Handle markdown=1 attrs.
waylan Jul 28, 2020
7783d48
Fix some bugs.
waylan Sep 1, 2020
cae2ef0
track mdstate down and back up nested elements.
waylan Sep 1, 2020
56111c4
fix nested multiline paragraphs.
waylan Sep 2, 2020
dda2755
Move link reference handling to block parser.
waylan Sep 3, 2020
370d601
Move abbr reference handling to block parser.
waylan Sep 8, 2020
81ac09d
Move footnote reference handling to block parser.
waylan Sep 8, 2020
6b068e3
Cleanup
waylan Sep 8, 2020
7a85397
Remove reference to comments and PIs in TreeBuilder as unused.
waylan Sep 8, 2020
42299a8
Remove other reference to comments and PIs in TreeBuilder.
waylan Sep 8, 2020
fbae484
Rewrite extension docs.
waylan Sep 9, 2020
097f52c
Fix normalization docs to match behavior.
waylan Sep 9, 2020
df14000
Update spelling dict with unclosed
waylan Sep 9, 2020
f61eb28
Address some coverage.
waylan Sep 11, 2020
2d8ce54
Ensure extension doesn't break default behavior.
waylan Sep 15, 2020
4856e86
update abbr tests
waylan Sep 15, 2020
07c9267
add basic link ref tests.
waylan Sep 15, 2020
82b97e5
flake8 cleanup
waylan Sep 15, 2020
1a0a893
footnote tests. 100% patch coverage
waylan Sep 15, 2020
46ac436
Add test for case in #1012.
waylan Sep 15, 2020
9cfbf20
Add release notes.
waylan Sep 15, 2020
1eb9fd3
Avoid duplicate tests.
waylan Sep 15, 2020
6f3b417
Fix a broken link
waylan Sep 15, 2020
15b431a
Final cleanup.
waylan Sep 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update abbr tests
  • Loading branch information
waylan committed Sep 15, 2020
commit 4856e86622ee7ad08ade437c5398689f6965b095
4 changes: 0 additions & 4 deletions tests/extensions/extra/abbr.html

This file was deleted.

13 changes: 0 additions & 13 deletions tests/extensions/extra/abbr.txt

This file was deleted.

242 changes: 242 additions & 0 deletions tests/test_syntax/extensions/test_abbr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
# -*- coding: utf-8 -*-
"""
Python Markdown

A Python implementation of John Gruber's Markdown.

Documentation: https://python-markdown.github.io/
GitHub: https://github.com/Python-Markdown/markdown/
PyPI: https://pypi.org/project/Markdown/

Started by Manfred Stienstra (http://www.dwerg.net/).
Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org).
Currently maintained by Waylan Limberg (https://github.com/waylan),
Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser).

Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later)
Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b)
Copyright 2004 Manfred Stienstra (the original version)

License: BSD (see LICENSE.md for details).
"""

from markdown.test_tools import TestCase


class TestAbbr(TestCase):

default_kwargs = {'extensions': ['abbr']}

def test_abbr_upper(self):
self.assertMarkdownRenders(
self.dedent(
"""
ABBR

*[ABBR]: Abbreviation
"""
),
self.dedent(
"""
<p><abbr title="Abbreviation">ABBR</abbr></p>
"""
)
)

def test_abbr_lower(self):
self.assertMarkdownRenders(
self.dedent(
"""
abbr

*[abbr]: Abbreviation
"""
),
self.dedent(
"""
<p><abbr title="Abbreviation">abbr</abbr></p>
"""
)
)

def test_abbr_multiple(self):
self.assertMarkdownRenders(
self.dedent(
"""
The HTML specification
is maintained by the W3C.

*[HTML]: Hyper Text Markup Language
*[W3C]: World Wide Web Consortium
"""
),
self.dedent(
"""
<p>The <abbr title="Hyper Text Markup Language">HTML</abbr> specification
is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.</p>
"""
)
)

def test_abbr_override(self):
self.assertMarkdownRenders(
self.dedent(
"""
ABBR

*[ABBR]: Ignored
*[ABBR]: The override
"""
),
self.dedent(
"""
<p><abbr title="The override">ABBR</abbr></p>
"""
)
)

def test_abbr_no_blank_Lines(self):
self.assertMarkdownRenders(
self.dedent(
"""
ABBR
*[ABBR]: Abbreviation
ABBR
"""
),
self.dedent(
"""
<p><abbr title="Abbreviation">ABBR</abbr></p>
<p><abbr title="Abbreviation">ABBR</abbr></p>
"""
)
)

def test_abbr_no_space(self):
self.assertMarkdownRenders(
self.dedent(
"""
ABBR

*[ABBR]:Abbreviation
"""
),
self.dedent(
"""
<p><abbr title="Abbreviation">ABBR</abbr></p>
"""
)
)

def test_abbr_extra_space(self):
self.assertMarkdownRenders(
self.dedent(
"""
ABBR

*[ABBR] : Abbreviation
"""
),
self.dedent(
"""
<p><abbr title="Abbreviation">ABBR</abbr></p>
"""
)
)

def test_abbr_line_break(self):
self.assertMarkdownRenders(
self.dedent(
"""
ABBR

*[ABBR]:
Abbreviation
"""
),
self.dedent(
"""
<p><abbr title="Abbreviation">ABBR</abbr></p>
"""
)
)

def test_abbr_ignore_unmatched_case(self):
self.assertMarkdownRenders(
self.dedent(
"""
ABBR abbr

*[ABBR]: Abbreviation
"""
),
self.dedent(
"""
<p><abbr title="Abbreviation">ABBR</abbr> abbr</p>
"""
)
)

def test_abbr_partial_word(self):
self.assertMarkdownRenders(
self.dedent(
"""
ABBR ABBREVIATION

*[ABBR]: Abbreviation
"""
),
self.dedent(
"""
<p><abbr title="Abbreviation">ABBR</abbr> ABBREVIATION</p>
"""
)
)

def test_abbr_unused(self):
self.assertMarkdownRenders(
self.dedent(
"""
foo bar

*[ABBR]: Abbreviation
"""
),
self.dedent(
"""
<p>foo bar</p>
"""
)
)

def test_abbr_double_quoted(self):
self.assertMarkdownRenders(
self.dedent(
"""
ABBR

*[ABBR]: "Abbreviation"
"""
),
self.dedent(
"""
<p><abbr title="&quot;Abbreviation&quot;">ABBR</abbr></p>
"""
)
)

def test_abbr_single_quoted(self):
self.assertMarkdownRenders(
self.dedent(
"""
ABBR

*[ABBR]: 'Abbreviation'
"""
),
self.dedent(
"""
<p><abbr title="'Abbreviation'">ABBR</abbr></p>
"""
)
)