diff options
author | Waylan Limberg <waylan@gmail.com> | 2010-10-11 23:40:50 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2010-10-11 23:40:50 -0400 |
commit | cbb8de8c5001b85dd28b6dca20c0bf58827167fb (patch) | |
tree | 92dd20e2a0930bd891057564eb0c25ec5da17a29 /markdown | |
parent | e2a79787f426bef4c2455d235252362586838773 (diff) | |
download | markdown-cbb8de8c5001b85dd28b6dca20c0bf58827167fb.tar.gz markdown-cbb8de8c5001b85dd28b6dca20c0bf58827167fb.tar.bz2 markdown-cbb8de8c5001b85dd28b6dca20c0bf58827167fb.zip |
Fixed Ticket 79. Linebreaks in reference link identifiers are now ignored. This matches the most recent version of markdown.pl among other implementations and allows links to work after editors do autolinebreak stuff to text.
Diffstat (limited to 'markdown')
-rw-r--r-- | markdown/inlinepatterns.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py index ebc6d8d..badcef1 100644 --- a/markdown/inlinepatterns.py +++ b/markdown/inlinepatterns.py @@ -325,6 +325,9 @@ class ImagePattern(LinkPattern): class ReferencePattern(LinkPattern): """ Match to a stored reference and return link element. """ + + NEWLINE_CLEANUP_RE = re.compile(r'[ ]?\n', re.MULTILINE) + def handleMatch(self, m): if m.group(9): id = m.group(9).lower() @@ -333,6 +336,8 @@ class ReferencePattern(LinkPattern): # we'll use "google" as the id id = m.group(2).lower() + # Clean up linebreaks in id + id = self.NEWLINE_CLEANUP_RE.sub(' ', id) if not id in self.markdown.references: # ignore undefined refs return None href, title = self.markdown.references[id] |