If the path to an image contains white space, then a2x will not
convert the image tag during PDF conversion. This results in the
failure of PDF conversion.

For example, the following image tag and path will cause the image::
tag to not be recognized:

image::path/with spaces/image.png[]


This can be resolved by changing the following Block Macro in
asciidoc.conf:

# Macros using default syntax.
(?u)^(?P<name>image|unfloat)::(?P<target>\S*?)(\[(?P<passtext>.*?)\]
$=#

to this:

# Macros using default syntax.
(?u)^(?P<name>image|unfloat)::(?P<target>[\S ]*?)(\[(?P<passtext>.*?)\]
$=#

So that it looks for whitespace characters in the path/name as well.

This is also an issue with the inline image macro which uses only the
"\S" group for matching and omits whitespace.  The inline macro should
probably be split into two macros - one that allows white space (local
file paths, image paths, etc) and one that does not (web URLs, etc) so
that white space can be used in file paths.

I was unable to override the default macro by adding the modified
macro to my custom "asciidoc.conf" file in the directory of the
asciidoc text file, so it appears that this can only be resolved by
modifying the original asciidoc.conf file and therefore should be
fixed in the original.

++++++++++++++++++++++++
HOWEVER, fixing the issue above revealed another significant defect
somewhere in dblatex (I think?) which I have not yet found a way to
fully resolve, but have worked around.

Specifically, when the white space ' ' character is allowed in file
paths for images using the above patch, if a link to an image is
specified where the image does not exist, then instead of simply
displaying the file path in the PDF output, it instead fails to export
the PDF altogether, with errors.  This is a big pain when working on
documents that are "works in progress" with placeholders for some
images inserted but the images themselves not yet created.

This failure does not occur if the target image exists, nor if the
spaces are removed from the file path to the image.

To work around the issue, I simply commented the image tags out of the
original asciidoc document:
//image::path to/image.png[]

I am not sure how to fix this problem and am quite unfamiliar with
latex, so any help would be greatly appreciated.  I will try to post
more information such as error messages and the .tex file content
where the failure occurred when I have time.


Of course, "why not use paths without spaces?"  is the obvious
question in all this, but I will explain that as a separate defect in
another thread.

Thanks,
-Tim

-- 
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