aboutsummaryrefslogtreecommitdiffstats
path: root/markdown
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2012-11-04 17:49:57 -0500
committerWaylan Limberg <waylan@gmail.com>2012-11-04 17:49:57 -0500
commit54a00d12c03ab3c05ffb57f5797b96b31b6d894f (patch)
tree06adfce1a6211b4803e25b2ac646b959e2c8ec6c /markdown
parent6aa18462014e9c6327b84bf39108dd5f56db37e5 (diff)
parentf7cb43fdc351904306851699a3c84cf19e64ea35 (diff)
downloadmarkdown-54a00d12c03ab3c05ffb57f5797b96b31b6d894f.tar.gz
markdown-54a00d12c03ab3c05ffb57f5797b96b31b6d894f.tar.bz2
markdown-54a00d12c03ab3c05ffb57f5797b96b31b6d894f.zip
Merge branch 'master' of https://github.com/waylan/Python-Markdown2.2.1.final
Diffstat (limited to 'markdown')
-rw-r--r--[-rwxr-xr-x]markdown/extensions/fenced_code.py0
-rw-r--r--markdown/inlinepatterns.py23
2 files changed, 20 insertions, 3 deletions
diff --git a/markdown/extensions/fenced_code.py b/markdown/extensions/fenced_code.py
index 9a1284f..9a1284f 100755..100644
--- a/markdown/extensions/fenced_code.py
+++ b/markdown/extensions/fenced_code.py
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py
index 6ec58c4..ab7b4c6 100644
--- a/markdown/inlinepatterns.py
+++ b/markdown/inlinepatterns.py
@@ -189,10 +189,27 @@ class Pattern:
stash = self.markdown.treeprocessors['inline'].stashed_nodes
except KeyError:
return text
+ def itertext(el):
+ ' Reimplement Element.itertext for older python versions '
+ tag = el.tag
+ if not isinstance(tag, basestring) and tag is not None:
+ return
+ if el.text:
+ yield el.text
+ for e in el:
+ for s in itertext(e):
+ yield s
+ if e.tail:
+ yield e.tail
def get_stash(m):
id = m.group(1)
if id in stash:
- return stash.get(id)
+ value = stash.get(id)
+ if isinstance(value, basestring):
+ return value
+ else:
+ # An etree Element - return text content only
+ return ''.join(itertext(value))
return util.INLINE_PLACEHOLDER_RE.sub(get_stash, text)
@@ -371,7 +388,7 @@ class ImagePattern(LinkPattern):
else:
truealt = m.group(2)
- el.set('alt', truealt)
+ el.set('alt', self.unescape(truealt))
return el
class ReferencePattern(LinkPattern):
@@ -416,7 +433,7 @@ class ImageReferencePattern(ReferencePattern):
el.set("src", self.sanitize_url(href))
if title:
el.set("title", title)
- el.set("alt", text)
+ el.set("alt", self.unescape(text))
return el