forked from readthedocs/recommonmark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request readthedocs#166 from gibfahn/allow_overwriting_lin…
…k_schemes Add `accepted_url_schemes` option to allow toplevel refs
- Loading branch information
Showing
4 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ class TestParsing(unittest.TestCase): | |
def assertParses(self, source, expected, alt=False): # noqa | ||
parser = CommonMarkParser() | ||
parser.parse(dedent(source), new_document('<string>')) | ||
self.maxDiff = None | ||
self.assertMultiLineEqual( | ||
dedent(expected).lstrip(), | ||
dedent(parser.document.asdom().toprettyxml(indent=' ')), | ||
|
@@ -223,6 +224,46 @@ def test_links(self): | |
""" | ||
) | ||
|
||
def test_known_schemes(self): | ||
self.assertParses( | ||
""" | ||
[https link](https://example.com) | ||
[http link](http://example.com) | ||
[mailto link](mailto:[email protected]) | ||
[custom scheme](custom:example.com) | ||
[ref link](path/to/file:heading) | ||
[ref link with spaces](<path/to/file:heading with spaces>) | ||
""", | ||
""" | ||
<?xml version="1.0" ?> | ||
<document source="<string>"> | ||
<paragraph> | ||
<reference refuri="https://example.com">https link</reference> | ||
<reference refuri="http://example.com">http link</reference> | ||
<reference refuri="mailto:[email protected]">mailto link</reference> | ||
<reference refuri="custom:example.com">custom scheme</reference> | ||
<pending_xref refdomain="None" refexplicit="True" reftarget="path/to/file:heading" reftype="any" refwarn="True"> | ||
<reference refuri="path/to/file:heading">ref link</reference> | ||
</pending_xref> | ||
<pending_xref refdomain="None" refexplicit="True" reftarget="path/to/file:heading with spaces" reftype="any" refwarn="True"> | ||
<reference refuri="path/to/file:heading%20with%20spaces">ref link with spaces</reference> | ||
</pending_xref> | ||
</paragraph> | ||
</document> | ||
""" | ||
) | ||
pass | ||
|
||
def test_image(self): | ||
self.assertParses( | ||
""" | ||
|