aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/inlinepatterns.py
diff options
context:
space:
mode:
authorfacelessuser <faceless.shop@gmail.com>2014-09-19 17:44:05 -0600
committerWaylan Limberg <waylan.limberg@icloud.com>2014-09-26 10:27:48 -0400
commit9082ed45deef99a0ff3c20aaa9f2c9b63e576838 (patch)
tree983354f7a5cd7089ba22c89376d9601fbbda7b93 /markdown/inlinepatterns.py
parent8f878c37dc3613b7279a0787bdcaf2d66b348d74 (diff)
downloadmarkdown-9082ed45deef99a0ff3c20aaa9f2c9b63e576838.tar.gz
markdown-9082ed45deef99a0ff3c20aaa9f2c9b63e576838.tar.bz2
markdown-9082ed45deef99a0ff3c20aaa9f2c9b63e576838.zip
Fix the lost tail issue in inlineprocessors.
See #253. Prior to this patch, if any inline processors returned an element with a tail, the tail would end up empty. This resolves that issue and will allow for #253 to be fixed. Thanks to @facelessuser for the work on this.
Diffstat (limited to 'markdown/inlinepatterns.py')
-rw-r--r--markdown/inlinepatterns.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py
index eaf4040..e990418 100644
--- a/markdown/inlinepatterns.py
+++ b/markdown/inlinepatterns.py
@@ -156,7 +156,7 @@ class Pattern(object):
"""
self.pattern = pattern
- self.compiled_re = re.compile("^(.*?)%s(.*?)$" % pattern,
+ self.compiled_re = re.compile("^(.*?)%s(.*?)$" % pattern,
re.DOTALL | re.UNICODE)
# Api for Markdown to pass safe_mode into instance
@@ -210,7 +210,7 @@ class Pattern(object):
return value
else:
# An etree Element - return text content only
- return ''.join(itertext(value))
+ return ''.join(itertext(value))
return util.INLINE_PLACEHOLDER_RE.sub(get_stash, text)
@@ -228,7 +228,7 @@ class EscapePattern(Pattern):
if char in self.markdown.ESCAPED_CHARS:
return '%s%s%s' % (util.STX, ord(char), util.ETX)
else:
- return None
+ return None
class SimpleTagPattern(Pattern):
@@ -300,7 +300,7 @@ class HtmlPattern(Pattern):
return self.markdown.serializer(value)
except:
return '\%s' % value
-
+
return util.INLINE_PLACEHOLDER_RE.sub(get_stash, text)
@@ -320,7 +320,7 @@ class LinkPattern(Pattern):
el.set("href", "")
if title:
- title = dequote(self.unescape(title))
+ title = dequote(self.unescape(title))
el.set("title", title)
return el
@@ -344,19 +344,19 @@ class LinkPattern(Pattern):
if not self.markdown.safeMode:
# Return immediately bipassing parsing.
return url
-
+
try:
scheme, netloc, path, params, query, fragment = url = urlparse(url)
except ValueError: #pragma: no cover
# Bad url - so bad it couldn't be parsed.
return ''
-
+
locless_schemes = ['', 'mailto', 'news']
allowed_schemes = locless_schemes + ['http', 'https', 'ftp', 'ftps']
if scheme not in allowed_schemes:
# Not a known (allowed) scheme. Not safe.
return ''
-
+
if netloc == '' and scheme not in locless_schemes: #pragma: no cover
# This should not happen. Treat as suspect.
return ''