On Tue, Aug 26, 2014 at 2:52 AM, Lex Trotman <[email protected]> wrote:

> [...]
> > I encountered the same symptoms (running asciidoc on windows with
> data-uri
> > enabled hangs) today. If this is the solution indeed, any specific
> reasons
> > it has not been committed?
>
> Probably because nobody has contributed it.
>

​Would the patch below qualify as contributing the fix:

---------------------------------------------------------------------------

# HG changeset patch
# User Ahmad Khayyat <[email protected]>
# Date 1409059195 -10800
#      Tue Aug 26 16:19:55 2014 +0300
# Node ID 25c3acea2d9dab74bd904fa5be216f5e728f8a27
# Parent  7863b0a0ab0dc4f2b274fd0d72d5224869000337
Fix embedded images (data-uri) for html backedns on Windows

diff --git a/html4.conf b/html4.conf
--- a/html4.conf
+++ b/html4.conf
@@ -42,7 +42,7 @@
 # src attribute must be first attribute for blogpost compatibility.
 {data-uri%}<img src="{imagesdir=}{imagesdir?/}{target}"
style="border-width: 0; vertical-align: text-bottom;"
alt="{alt={target}}"{width? width="{width}"}{height?
height="{height}"}{title? title="{title}"}>
 {data-uri#}<img style="border-width: 0; vertical-align: text-bottom;"
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}")}"}">
+{data-uri#}{sys:"{python}" -u -c "import mimetypes,base64,sys; print
'src=\x22data:'+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>

 [image-blockmacro]
@@ -51,7 +51,7 @@
 <a href="{link}">
 {data-uri%}<img src="{imagesdir=}{imagesdir?/}{target}"
style="border-width: 0;" alt="{alt={target}}"{width?
width="{width}"}{height? height="{height}"}>
 {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}")}"}">
+{data-uri#}{sys:"{python}" -u -c "import mimetypes,base64,sys; print
'src=\x22data:'+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>
 <p><b>{caption={figure-caption} {counter:figure-number}. }</b>{title}</p>
 </div>
diff --git a/html5.conf b/html5.conf
--- a/html5.conf
+++ b/html5.conf
@@ -81,7 +81,7 @@
 <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}"}
-{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}")}"}">
+{data-uri#}{sys:"{python}" -u -c "import mimetypes,base64,sys; print
'src=\x22data:'+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>

@@ -91,7 +91,7 @@
 <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}"}
-{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}")}"}">
+{data-uri#}{sys:"{python}" -u -c "import mimetypes,base64,sys; print
'src=\x22data:'+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>
diff --git a/xhtml11.conf b/xhtml11.conf
--- a/xhtml11.conf
+++ b/xhtml11.conf
@@ -80,7 +80,7 @@
 <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}"}
-{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}")}"}" />
+{data-uri#}{sys:"{python}" -u -c "import mimetypes,base64,sys; print
'src=\x22data:'+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>

@@ -90,7 +90,7 @@
 <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}"}
-{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}")}"}" />
+{data-uri#}{sys:"{python}" -u -c "import mimetypes,base64,sys; print
'src=\x22data:'+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>
​

-- 
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/asciidoc.
For more options, visit https://groups.google.com/d/optout.

Reply via email to