From 0dc9ae0d62829a4b9856a3979c967facafc2d128 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sun, 21 Oct 2012 15:02:19 -0400 Subject: Fixed #152. Spaces in links are now escaped. --- markdown/inlinepatterns.py | 1 + tests/basic/angle-links-and-img.html | 2 +- tests/misc/url_spaces.html | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py index d3ef4e0..285e7e5 100644 --- a/markdown/inlinepatterns.py +++ b/markdown/inlinepatterns.py @@ -328,6 +328,7 @@ class LinkPattern(Pattern): `username:password@host:port`. """ + url = url.replace(' ', '%20') if not self.markdown.safeMode: # Return immediately bipassing parsing. return url diff --git a/tests/basic/angle-links-and-img.html b/tests/basic/angle-links-and-img.html index 1ca3b0b..255c299 100644 --- a/tests/basic/angle-links-and-img.html +++ b/tests/basic/angle-links-and-img.html @@ -1,4 +1,4 @@ -

link +

link image link image

\ No newline at end of file diff --git a/tests/misc/url_spaces.html b/tests/misc/url_spaces.html index ebacb75..f9c91b3 100644 --- a/tests/misc/url_spaces.html +++ b/tests/misc/url_spaces.html @@ -1,2 +1,2 @@ -

Dawn of War

-

Dawn of War

\ No newline at end of file +

Dawn of War

+

Dawn of War

\ No newline at end of file -- cgit v1.2.3