On 17 July 2012 22:26, Thomas K. <[email protected]> wrote:
> Actually, even when using 'asciidoc' (without data-uri set) instead of
> 'a2x', the absolute Windows path appears in the generated html. :-(
Heh, well, you did prepend an absolute directory path ({docdir} or
{indir}), so of course the result is absolute.
> Furthermore, there are lots of discussions going on in docbook/dblatex
> forums regarding problems with 'fileref' and absolute/relative paths.
>
Not surprised given that its totally undefined, each tool could
require something different here. Mind you I can't blame the docbook
developers for not buying into the argument either :)
> My conclusion to avoid as many problems as possible: In Asciidoc, images
> must always be included using relative paths which are interpretable as
> relative URIs at the same time!
Yeah, thats a good rule.
Cheers
Lex
>
> Am Dienstag, 17. Juli 2012 14:13:04 UTC+2 schrieb Lex Trotman:
>>
>> On 17 July 2012 21:37, Thomas K. <[email protected]> wrote:
>> > 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.
>>
>> Sigh, I guess Latex/dblatex doesn't acknowledge platform local
>> conventions. That means asciidoc can't do anything about it, if it
>> generates unix paths some windows tools might object, if it generates
>> windows paths clearly dblatex/latex objects.
>>
>> >
>> > 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.
>>
>> Well, the fileref looks like what was asked for. What goes in a
>> fileref isn't defined by docbook (it just says CDATA, so it could be
>> anything).
>>
>> >
>> > Adding my own macro to docbook45.conf is a workaround, though.
>>
>> Good luck.
>>
>> Cheers
>> Lex
>>
>>
>> >
>> > 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.
>
> --
> 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/-/R4JdQcuFUScJ.
>
> 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 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.