aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2013-01-28 07:03:28 -0800
committerWaylan Limberg <waylan@gmail.com>2013-01-28 07:03:28 -0800
commitc201f3c706316fbafff51631ce86a0a3784f3218 (patch)
treedfc3aaec5c9119b326fdc3c85045d4e080aa5f0e
parent0227d9f8ca43e1c1378d7f3948151c8d9d9f6ffa (diff)
parent5086e58e3c20bb091c4e8141048f395f96360db4 (diff)
downloadmarkdown-c201f3c706316fbafff51631ce86a0a3784f3218.tar.gz
markdown-c201f3c706316fbafff51631ce86a0a3784f3218.tar.bz2
markdown-c201f3c706316fbafff51631ce86a0a3784f3218.zip
Merge pull request #182 from abackstrom/img-ref-attributes
Enable attributes inside image references
-rw-r--r--markdown/inlinepatterns.py4
-rw-r--r--tests/misc/attributes-image-ref.html1
-rw-r--r--tests/misc/attributes-image-ref.txt4
3 files changed, 9 insertions, 0 deletions
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py
index d0f4490..a1b264c 100644
--- a/markdown/inlinepatterns.py
+++ b/markdown/inlinepatterns.py
@@ -432,6 +432,10 @@ class ImageReferencePattern(ReferencePattern):
el.set("src", self.sanitize_url(href))
if title:
el.set("title", title)
+
+ if self.markdown.enable_attributes:
+ text = handleAttributes(text, el)
+
el.set("alt", self.unescape(text))
return el
diff --git a/tests/misc/attributes-image-ref.html b/tests/misc/attributes-image-ref.html
new file mode 100644
index 0000000..6974420
--- /dev/null
+++ b/tests/misc/attributes-image-ref.html
@@ -0,0 +1 @@
+<p><img alt="img" id="foo" src="http://example.com/i.jpg" /></p> \ No newline at end of file
diff --git a/tests/misc/attributes-image-ref.txt b/tests/misc/attributes-image-ref.txt
new file mode 100644
index 0000000..a216971
--- /dev/null
+++ b/tests/misc/attributes-image-ref.txt
@@ -0,0 +1,4 @@
+![img{@id=foo}][img]
+
+ [img]: http://example.com/i.jpg
+