Hi Suraj

You are correct, this is a bug (the workaround is to run asciidoc twice, the first time it will give and error but generate the images, the second time it will work. The problem with this workaround is that subsequent runs work but any updated images won't appear until they're processed twice.

The fix is easy but unfortunately it breaks the auto file name generation introduced in r756. I need to come up with a fix that won't break things.


Cheers, Stuart



On 01/08/10 14:28, Suraj N. Kurapati wrote:
Hello,

I am using asciidoc 8.5.3 and I noticed that the data-uri filter is
executed _before_ the graphviz filter, causing broken images (empty
data URIs) in the resulting HTML.

For example, consider the following `simple.asciidoc` file.

====================================================================
$ ls
simple.asciidoc

$ cat simple.asciidoc
["graphviz", "sample1.png"]
---------------------------------------------------------------------
digraph G { rankdir=LR; Graphviz->AsciiDoc->HTML}
---------------------------------------------------------------------

$ asciidoc -d manpage -a icons -a data-uri -a toc -v simple.asciidoc
asciidoc: reading: /etc/asciidoc/asciidoc.conf
asciidoc: reading: /etc/asciidoc/xhtml11.conf
asciidoc: reading: /etc/asciidoc/xhtml11-quirks.conf
asciidoc: reading: /etc/asciidoc/filters/source/source-highlight-
filter.conf
asciidoc: reading: /etc/asciidoc/filters/graphviz/graphviz-filter.conf
asciidoc: reading: /etc/asciidoc/filters/music/music-filter.conf
asciidoc: reading: /etc/asciidoc/filters/code/code-filter.conf
asciidoc: reading: /etc/asciidoc/lang-en.conf
asciidoc: reading: /home/sun/tmp/bar/simple.asciidoc
asciidoc: writing: /home/sun/tmp/bar/simple.html
asciidoc: ERROR: simple.asciidoc: line 1: manpage document title is
mandatory
asciidoc: simple.asciidoc: line 2: evaluating: {eval:os.path.join("/
home/sun/tmp/bar","","sample1.png")}
asciidoc: simple.asciidoc: line 2: evaluating: {sys:python -uc "import
base64,sys; base64.encode(sys.stdin,sys.stdout)"<  "/home/sun/tmp/bar/
sample1.png"}
sh: /home/sun/tmp/bar/sample1.png: No such file or directory
asciidoc: WARNING: simple.asciidoc: line 2: {sys:python -uc "import
base64,sys; base64.encode(sys.stdin,sys.stdout)"<  "/home/sun/tmp/bar/
sample1.png"}: non-zero exit status
asciidoc: simple.asciidoc: line 2: evaluating:
{eval:os.path.splitext('sample1.png')[1][1:]}
asciidoc: simple.asciidoc: line 3: filtering: "/etc/asciidoc/filters/
graphviz/graphviz2png.py" -v -o "/home/sun/tmp/bar/sample1.png" -L dot
-
Execute: dot -Tpng "/home/sun/tmp/bar/sample1.txt">  "/home/sun/tmp/
bar/sample1.png"

$ grep -A1 data: simple.html
<img alt="sample1.png" src="data:image/png;base64,
" />
====================================================================

Notice the WARNING emitted by the data-uri filter, saying that it
could not find the `sample1.png` file to embed.  Now if we run
asciidoc again, the data-uri filter will find the file.

====================================================================
$ asciidoc -d manpage -a icons -a data-uri -a toc -v simple.asciidoc
asciidoc: reading: /etc/asciidoc/asciidoc.conf
asciidoc: reading: /etc/asciidoc/xhtml11.conf
asciidoc: reading: /etc/asciidoc/xhtml11-quirks.conf
asciidoc: reading: /etc/asciidoc/filters/source/source-highlight-
filter.conf
asciidoc: reading: /etc/asciidoc/filters/graphviz/graphviz-filter.conf
asciidoc: reading: /etc/asciidoc/filters/music/music-filter.conf
asciidoc: reading: /etc/asciidoc/filters/code/code-filter.conf
asciidoc: reading: /etc/asciidoc/lang-en.conf
asciidoc: reading: /home/sun/tmp/bar/simple.asciidoc
asciidoc: writing: /home/sun/tmp/bar/simple.html
asciidoc: ERROR: simple.asciidoc: line 1: manpage document title is
mandatory
asciidoc: simple.asciidoc: line 2: evaluating: {eval:os.path.join("/
home/sun/tmp/bar","","sample1.png")}
asciidoc: simple.asciidoc: line 2: evaluating: {sys:python -uc "import
base64,sys; base64.encode(sys.stdin,sys.stdout)"<  "/home/sun/tmp/bar/
sample1.png"}
asciidoc: simple.asciidoc: line 2: evaluating:
{eval:os.path.splitext('sample1.png')[1][1:]}
asciidoc: simple.asciidoc: line 3: filtering: "/etc/asciidoc/filters/
graphviz/graphviz2png.py" -v -o "/home/sun/tmp/bar/sample1.png" -L dot
-
Execute: dot -Tpng "/home/sun/tmp/bar/sample1.txt">  "/home/sun/tmp/
bar/sample1.png"

$ grep -A1 data: simple.html
<img alt="sample1.png" src="data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAAhUAAAA7CAYAAADM3XgRAAAABmJLR0QA/wD/AP
+gvaeTAAAgAElE
====================================================================

Please correct this problem by defering the data-uri filter until
after all other filters have executed.

Thanks for your consideration.


--
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/asciidoc?hl=en.

Reply via email to