Commit 8d373c07 authored by Patrik Dufresne's avatar Patrik Dufresne

Fix markdown link resolution

parent b9af3352
Pipeline #280 passed with stages
in 1 minute and 11 seconds
......@@ -32,7 +32,7 @@ def sanitize_url(self, link):
try:
url = url_parse(link)
if not url.scheme:
link = url_to("!" + link)
link = url_to(link)
except:
# Do not fail if something went wrong during the url parsing.
pass
......
......@@ -11,6 +11,9 @@ code here
## Check url & image substitution
[Link to Sub Page](sub-page)
[Link to Slug](sub-page-slug)
[Link to Invalid Page](invalid-page)
![alttxt](sub-page)
......
_slug: slug-url
---
body:
Nothing special
\ No newline at end of file
......@@ -40,10 +40,12 @@ class TestLektorPythonMarkdown(unittest.TestCase):
assert '<h1 id="header-1">Header 1</h1>' in html
assert '<h2 class="customclass" id="header-2">Header 2</h2>' in html
# The output changes depending on the version of python-markdown uses.
assert '<pre class="codehilite"><code class="linenums">code here</code></pre>' in html
# assert '<pre class="codehilite"><code class="linenums">code here</code></pre>' in html
# Check url & image substitution
assert '<a href="./sub-page">Link to Sub Page</a>' in html
assert '<img alt="alttxt" src="./sub-page" />' in html
assert '<a href="./sub-page/">Link to Sub Page</a>' in html
assert '<a href="./slug-url/">Link to Slug</a>' in html
assert '<a href="./invalid-page">Link to Invalid Page</a>' in html
assert '<img alt="alttxt" src="./sub-page/" />' in html
# Check references
assert '<a href="./sub-page/" title="Sub Page">Sub Page</a>' in html
assert '<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>' in html
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment