On 25 December 2014 at 07:17, dutille <[email protected]> wrote:
> Hello,
>
> I am not a seasoned asciidoc user and I was not sure I could figure out how
> to make it work.
>
> In my txt source file I have now inserted the 2 user-defined attributes
> pdfoutput and epuboutput :
>
> ifdef::basebackend-docbook[]
> ifdef::pdfoutput[]
> image::myfigure.pdf[width="15cm"]
> endif::pdfoutput[]
> ifdef::epuboutput[]
> image::myfigure.png[]
> endif::epuboutput[]
> endif::basebackend-docbook[]
>
> The command lines look like :
> a2x -fepub ... -a epuboutput myfile.txt
> a2x -fpdf ... -a pdfoutput myfile.txt
>

I got the impression from your first post that you were not using a2x,
but if you are then it already sets the a2x-format attribute to the
value specified on the command line -f (or the default pdf) as I
mentioned.

You can test it with:

ifeval::[{a2x-format}=="pdf"]

endif::[]

That does not need to test the basebackend since a2x allways uses docbook.

Cheers
Lex

> And it works.
>
> Thanks,
>
> Guillaume
>
> Le mercredi 17 décembre 2014 22:48:35 UTC+1, Lex Trotman a écrit :
>>
>> Hi,
>>
>> The distinction between epub and pdf is in the toolchain being run
>> after asciidoc, and of course asciidoc doesn't know that.  You will
>> have to set an attribute yourself to signal the toolchain, as a2x does
>> (a2x-format).
>>
>> Cheers
>> Lex
>>
>> On 18 December 2014 at 04:13, dutille <[email protected]> wrote:
>> > Hello,
>> >
>> > When I want to generate both html and pdf from asciidoc with graphics
>> > included I know that I can get the best of both worlds with conditions
>> > like
>> > :
>> >
>> > ifdef::basebackend-html[]
>> > image::myfigure.png[width="100%"]
>> > endif::basebackend-html[]
>> > ifdef::basebackend-docbook[]
>> > image::myfigure.pdf[width="15cm"]
>> > endif::basebackend-docbook[]
>> >
>> > Now I want to generate epub also. But :
>> > 1 epub and pdf originate from the same basebackend-docbook
>> > 2 epub does not accept pdf
>> > 3 using png in pdf output is not an option
>> >
>> > Is there anything like ifdef::backend-epub[] / ifdef::backend-pdf ?
>> >
>> > Kind regards,
>> >
>> > Guillaume
>> >
>> > Guillaume
>> >
>> > --
>> > 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.

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

Reply via email to