diff options
author | Adam Backstrom <adam@sixohthree.com> | 2013-01-27 11:38:50 -0500 |
---|---|---|
committer | Adam Backstrom <adam@sixohthree.com> | 2013-01-27 11:38:50 -0500 |
commit | 5086e58e3c20bb091c4e8141048f395f96360db4 (patch) | |
tree | dfc3aaec5c9119b326fdc3c85045d4e080aa5f0e | |
parent | 0227d9f8ca43e1c1378d7f3948151c8d9d9f6ffa (diff) | |
download | markdown-5086e58e3c20bb091c4e8141048f395f96360db4.tar.gz markdown-5086e58e3c20bb091c4e8141048f395f96360db4.tar.bz2 markdown-5086e58e3c20bb091c4e8141048f395f96360db4.zip |
Enable attributes inside image references
-rw-r--r-- | markdown/inlinepatterns.py | 4 | ||||
-rw-r--r-- | tests/misc/attributes-image-ref.html | 1 | ||||
-rw-r--r-- | tests/misc/attributes-image-ref.txt | 4 |
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 + |