Hi Lex,
thanks for your comments. It looks like the problem is related to the
generated docbook XML or the toolchain processing this XML.
The generated docbook XML contains elements like:
<mediaobject>
<imageobject>
<imagedata fileref="C:\docdir\asciidoc\images\myimage.png"/>
...
If this is converted either to xhtml or to LaTeX, this path appears
unchanged in both output files. For xhtml, the output won't work because
<img src=" C:\docdir\asciidoc\images\myimage.png " ...
contains an invalid URI.
For the LaTeX backend, pdflatex chokes at the path with backslashes, even
on Windows.
>From my point of view, the either generated docbook XML is wrong with
respect to the *fileref *attribute, or the postprocessing of the XML has to
take care of the conversions.
Adding my own macro to docbook45.conf is a workaround, though.
Thanks
Thomas
Am Dienstag, 17. Juli 2012 13:01:15 UTC+2 schrieb Lex Trotman:
>
> On 17 July 2012 20:00, Thomas K. <[email protected]> wrote:
> > Hi,
> >
> > I am trying to use the {indir} attribute as part as a path when
> including
> > images, e.g.
> >
> > image::{indir}/images/myimage.png[]
> >
> >
> > The document is converted via a2x and dblatex backend on Windows.
> >
> > LaTeX fails, because it chokes when discovering a path containing
> > backslashes like 'C:\docdir\asciidoc/images/myimage.png[]'.
>
> I would have expected Latex on windows to work with backslashes, since
> thats the default on that platform. Having it work with a mixed path
> might be the problem. If having all backslashes doesn't work or you
> want to be portable try your own macro as below.
>
> Unfortunately asciidoc doesn't know the thing it is substituting
> {indir} into is a path, so it can't convert it, and the image source
> could be any URL so having asciidoc do a simple slash/backslash
> substitution is not a general solution either. So AFAICT there isn't
> a good general solution that asciidoc can apply.
>
> Since you know you are only dealing with files you might try
> generating your own macro that uses the Python os.path.join and
> os.path.normpath to make the path and then do what image does (just
> copy that section from the system docbook45.conf to a local
> docbook45.conf). That way it will use the correct {indir} in included
> files.
>
> Cheers
> Lex
>
> >
> > As a workaround, I am currently using {docdir} instead of {indir} and
> > converting the backslashes in the docdir path into a LaTeX-friendly
> format:
> >
> > :docdir: {eval:r"{docdir}".replace("\\","/")}
> >
> >
> > This is done at the beginning of my toplevel document. Doing the same
> with
> > {indir} would mean that I would have to do it at the beginning of each
> of my
> > (included) documents, which is a bit painful.
> >
> > Would it be possible for asciidoc to convert all backslashes in path
> names
> > into forward slashes by default? This obviously works for all operating
> > systems. Or my problem actually related to dblatex, which should perform
> > this conversion instead?
> >
> > Greetings
> >
> > Thomas
> >
> >
> >
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "asciidoc" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/asciidoc/-/EAvTLt7nCHAJ.
> > 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.
>
--
You received this message because you are subscribed to the Google Groups
"asciidoc" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/asciidoc/-/vBVvYfGe_JYJ.
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.