On 1 April 2014 20:51, <[email protected]> wrote: > Hi, > I am facing the same issue using asciidoc 8.6.9
It doesn't appear to be similar. The problem referred to above is non-encoding, not incorrect encoding. > > Some of the images are encoded wrongly with the latest version. > After some investigation I found that some of the lines in the data that > should contain +++ have been reduced to a single plus +, the line is also > shorter than all the other lines. Please provide more useful information, what lines, where, how did you determine that? > It is not a python issue, when I encode the same image in python using > base64.b64encode I get the correct data on Windows, Cygwin and Ubuntu Linux. > Again please provide more useful information. > I use this with a slidy backend. > And this is the exact slide that is giving me problems: > https://gerrit.googlesource.com/training/gerrit/+/master/presentations/git-gerrit-workshop/distributed-versioning-systems-2.txt You are saying that the image is wrongly encoded, please provide that information, the asciidoc that uses it isn't much help. Also please provide the Python versions. Cheers Lex > > Thanks, > Peter Bruin > > > > On Tuesday, March 11, 2014 9:39:55 PM UTC+8, Will wrote: >> >> Hi, >> >> I have an issue with the latest release of AsciiDoc (8.6.9) when using the >> XHTML backend in conjunction with the data-uri attribute to encode images as >> base64. Basically, processing just hangs. Was just wondering if anyone >> else has experienced the same issue, or if it is an issue with my >> setup/environment. >> >> >> Environment >> >> My environment is as follows: >> >> OS: Windows 7 Enterprise SP1 64-bit >> AsciiDoc: 8.6.9 >> Python: 2.7.6 64-bit >> >> >> I found the issue is caused by a change (since 8.6.8) in the xhtml11 conf >> file: >> >> >> xhtml11 conf file (8.6.8): >> >> [image-blockmacro] >> <div class="imageblock{style? {style}}{role? {role}}{unbreakable-option? >> unbreakable}"{id? id="{id}"}{align? style="text-align:{align};"}{float? >> style="float:{float};"}> >> <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}")}"}" /> >> >> >> xhtml11 conf file (8.6.9): >> >> [image-blockmacro] >> <div class="imageblock{style? {style}}{role? {role}}{unbreakable-option? >> unbreakable}"{id? id="{id}"}{align? style="text-align:{align};"}{float? >> style="float:{float};"}> >> <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}"} >> {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}")}"}" /> >> >> >> The difference is 8.6.8 version uses the conf file to output the "src=..." >> part, but the 8.6.9 uses the system call to have Python print it. The issue >> appears to be the escaped quote contained in the print statement in the >> latter. >> >> >> Steps to reproduce >> >> To reproduce, I create a basic document like this: >> >> = Image test >> >> == Foo >> >> .Bar >> image::tst.png[Foo bar] >> >> >> Then render with the following command: >> >> C:\>python C:/bin/asciidoc-8.6.9/asciidoc.py --verbose --attribute >> data-uri --backend=xhtml11 --out-file="C:\tst\image_test.xhtml" >> "C:\tst\image_test.txt" >> >> >> Process hangs, with output as: >> >> asciidoc: reading: C:\bin\asciidoc-8.6.9\asciidoc.conf >> asciidoc: reading: C:\tst\image_test.txt >> asciidoc: reading: C:\bin\asciidoc-8.6.9\xhtml11.conf >> asciidoc: include1: C:\bin\asciidoc-8.6.9\stylesheets\asciidoc.css >> asciidoc: image_test.txt: line 1: ifeval: "source-highlight"=="pygments": >> False >> asciidoc: include1: C:\bin\asciidoc-8.6.9\javascripts\asciidoc.js >> asciidoc: reading: C:\bin\asciidoc-8.6.9\filters\code\code-filter.conf >> asciidoc: reading: >> C:\bin\asciidoc-8.6.9\filters\graphviz\graphviz-filter.conf >> asciidoc: reading: C:\bin\asciidoc-8.6.9\filters\latex\latex-filter.conf >> asciidoc: reading: C:\bin\asciidoc-8.6.9\filters\music\music-filter.conf >> asciidoc: reading: >> C:\bin\asciidoc-8.6.9\filters\source\source-highlight-filter.conf >> asciidoc: image_test.txt: line 1: ifeval: >> "source-highlight"=="source-highlight": True >> asciidoc: image_test.txt: line 1: ifeval: "source-highlight"=="highlight": >> False >> asciidoc: image_test.txt: line 1: ifeval: "source-highlight"=="pygments": >> False >> asciidoc: reading: C:\bin\asciidoc-8.6.9\lang-en.conf >> asciidoc: writing: C:\tst\image_test.xhtml >> asciidoc: image_test.txt: line 7: evaluating: >> {eval:os.path.join(r"C:\tst",r"",r"tst.png")} >> asciidoc: image_test.txt: line 7: evaluating: >> {sys:"C:\bin\python-2.7.6-64\python.exe" -u -c "import mimetypes,base64,sys; >> print ' >> src=\"data:'+mimetypes.guess_type(r'tst.png')[0]+';base64,'; >> base64.encode(sys.stdin,sys.stdout)" < "C:\tst\tst.png"} >> asciidoc: image_test.txt: line 7: shelling: >> C:\bin\python-2.7.6-64\python.exe -u -c "import mimetypes,base64,sys; print >> 'src=\"dat >> a:'+mimetypes.guess_type(r'tst.png')[0]+';base64,'; >> base64.encode(sys.stdin,sys.stdout)" < C:\tst\tst.png > c:\users\will\appd >> ata\local\temp\tmpzlzbjt >> src="data:image/png;base64, >> >> >> Second way to reproduce >> >> I also found the same issue outside of AsciiDoc, so I guess it is actually >> a Python problem. I use a basic text file with a few lines in it. >> >> At the command line I run the following command successfully: >> >> C:\tst>python -u -c "import sys; print 'foobar:'; print >> sys.stdin.readlines()" < "test.txt" >> foobar: >> ['foo\r\n', 'bar\r\n', 'baz'] >> >> However, including an escaped quote hangs: >> >> C:\tst>python -u -c "import sys; print 'foobar:\"'; print >> sys.stdin.readlines()" < "test.txt" >> foobar:" >> >> It only happens when trying to read from stdin though, as the following >> command works: >> >> C:\tst>python -u -c "import sys; print 'foobar:\"'; print sys.stdin.mode" >> < "test.txt" >> foobar:" >> r >> >> >> Cheers, >> Will > > -- > 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. -- 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.
