diff --git a/lektor_pythonmarkdown.py b/lektor_pythonmarkdown.py index 9028d5b320b11617e7ba4eaaa484b8e639690d01..171c8c528ae409ec46f18fd6cc0d31502e1ade86 100644 --- a/lektor_pythonmarkdown.py +++ b/lektor_pythonmarkdown.py @@ -33,7 +33,7 @@ def sanitize_url(self, link): if get_ctx() and get_ctx().record is not None: url = url_parse(link) if not url.scheme: - link = get_ctx().record.url_to(link, + link = get_ctx().record.url_to("!" + link, base_url=get_ctx().base_url) return LinkPattern.sanitize_url(self, link) diff --git a/tests/demo-project/content/contents.lr b/tests/demo-project/content/contents.lr index 8f5c1aac048261f68e50deb2f5fbb4d0f8bc0375..ca90ac749e07a128ae8a34c6b13d7981d52bb36b 100644 --- a/tests/demo-project/content/contents.lr +++ b/tests/demo-project/content/contents.lr @@ -15,7 +15,7 @@ code here [Link to Invalid Page](invalid-page) -![alttxt](sub-page) +![alttxt](logo.png) ## Check references diff --git a/tests/demo-project/content/logo.png b/tests/demo-project/content/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..fea6b8ca659cbf3ec84d8a5150567e2175f0b197 Binary files /dev/null and b/tests/demo-project/content/logo.png differ diff --git a/tests/demo-project/demo.lektorproject b/tests/demo-project/demo.lektorproject index c263d769a123a5bb370a43705e0de84e64cd3b03..4be81a14fc4c970b0707692e526d1125f60e379f 100644 --- a/tests/demo-project/demo.lektorproject +++ b/tests/demo-project/demo.lektorproject @@ -1,2 +1,16 @@ [project] name = demo +url_style=absolute + +[alternatives.en] +name = English +name[fr] = Anglais +locale = en_US +url_prefix = /en/ + +[alternatives.fr] +primary = yes +name = French +name[fr] = Français +url_prefix = /fr/ +locale = fr \ No newline at end of file diff --git a/tests/test_lektor_pythonmarkdown.py b/tests/test_lektor_pythonmarkdown.py index 84f6e5d671a6ec38f94a74707b977e9c08fca14a..221ecd2b2dd8c41dab2f656414a21e9ac36f3321 100644 --- a/tests/test_lektor_pythonmarkdown.py +++ b/tests/test_lektor_pythonmarkdown.py @@ -34,7 +34,7 @@ class TestLektorPythonMarkdown(unittest.TestCase): def test_basic(self): failures = self.builder.build_all() assert not failures - page_path = os.path.join(self.builder.destination_path, 'index.html') + page_path = os.path.join(self.builder.destination_path, 'fr/index.html') html = open(page_path).read() print(html) assert '

Header 1

' in html @@ -42,12 +42,12 @@ class TestLektorPythonMarkdown(unittest.TestCase): # The output changes depending on the version of python-markdown uses. # assert '
code here
' in html # Check url & image substitution - assert 'Link to Sub Page' in html - assert 'Link to Slug' in html - assert 'Link to Invalid Page' in html - assert 'alttxt' in html + assert 'Link to Sub Page' in html + assert 'Link to Slug' in html + assert 'Link to Invalid Page' in html + assert 'alttxt' in html # Check references - assert 'Sub Page' in html + assert 'Sub Page' in html assert 'Yahoo' in html