summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Rackham <srackham@methods.co.nz>2012-07-31 08:38:54 +1200
committerStuart Rackham <srackham@methods.co.nz>2012-07-31 08:38:54 +1200
commit427d4f244bcdcadec491393e18b97c8e31be31bf (patch)
tree28e918826412d3d0c83b0d8ea8f80f373182854f
parentced2674c188a7d4888016448405cdd001952a74f (diff)
downloadasciidoc-427d4f244bcdcadec491393e18b97c8e31be31bf.tar.gz
Embedded data-uri images now figure file mimetype from file contents rather
than the file extension. Patch submitted by Lex Trotman. See: https://groups.google.com/group/asciidoc/browse_thread/thread/dbdfaf838f93e020
-rw-r--r--xhtml11.conf8
1 files changed, 4 insertions, 4 deletions
diff --git a/xhtml11.conf b/xhtml11.conf
index 998a49a..b648301 100644
--- a/xhtml11.conf
+++ b/xhtml11.conf
@@ -79,8 +79,8 @@ latexmath-style=template="latexmathblock",subs=()
<span class="image{role? {role}}">
<a class="image" href="{link}">
{data-uri%}<img src="{imagesdir=}{imagesdir?/}{target}" alt="{alt={target}}"{width? width="{width}"}{height? height="{height}"}{title? title="{title}"} />
-{data-uri#}<img alt="{alt={target}}"{width? width="{width}"}{height? height="{height}"}{title? title="{title}"} src="data:image/{eval:os.path.splitext(r'{target}')[1][1:]};base64,
-{data-uri#}{sys3:"{python}" -u -c "import base64,sys; base64.encode(sys.stdin,sys.stdout)" < "{eval:os.path.join(r"{indir={outdir}}",r"{imagesdir=}",r"{target}")}"}" />
+{data-uri#}<img alt="{alt={target}}"{width? width="{width}"}{height? height="{height}"}{title? title="{title}"}
+{data-uri#}{sys:"{python}" -u -c "import mimetypes,base64,sys; print 'src=\"data:'+mimetypes.guess_type(r'{target}')[0]+';base64,'; base64.encode(sys.stdin,sys.stdout)" < "{eval:os.path.join(r"{indir={outdir}}",r"{imagesdir=}",r"{target}")}"}" />
{link#}</a>
</span>
@@ -89,8 +89,8 @@ latexmath-style=template="latexmathblock",subs=()
<div class="content">
<a class="image" href="{link}">
{data-uri%}<img src="{imagesdir=}{imagesdir?/}{target}" alt="{alt={target}}"{width? width="{width}"}{height? height="{height}"} />
-{data-uri#}<img alt="{alt={target}}"{width? width="{width}"}{height? height="{height}"} src="data:image/{eval:os.path.splitext(r'{target}')[1][1:]};base64,
-{data-uri#}{sys:"{python}" -u -c "import base64,sys; base64.encode(sys.stdin,sys.stdout)" < "{eval:os.path.join(r"{indir={outdir}}",r"{imagesdir=}",r"{target}")}"}" />
+{data-uri#}<img alt="{alt={target}}"{width? width="{width}"}{height? height="{height}"}
+{data-uri#}{sys:"{python}" -u -c "import mimetypes,base64,sys; print 'src=\"data:'+mimetypes.guess_type(r'{target}')[0]+';base64,'; base64.encode(sys.stdin,sys.stdout)" < "{eval:os.path.join(r"{indir={outdir}}",r"{imagesdir=}",r"{target}")}"}" />
{link#}</a>
</div>
<div class="title">{caption={figure-caption} {counter:figure-number}. }{title}</div>