Le 24/12/2014 22:17, dutille a écrit :
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

And it works.

Hi all,

Thanks Dutille for sharing.

At some point in the past I generated both HTML and PDF versions of documents. I wished I had some macro adjument that would simplify the lines above into just:

image::myfigure

that would automatically pick the appropriate variant (png, pdf) by adding an extension based on the document output format, and possibly additional arguments. Indeed in docbook/asciidoc context it often makes sense that the arguments depend on output format but are the same for all pictures in a document.

The variants of included image would have been generated via a Makefile rule like :

%.png: %.pdf
    convert $< (some relevant convert options) $@

I have not edited enough documents at that time in both HTML and PDF to justify this effort, now PDF is virtually my only output format.

The overall benefit is simpler, more readable, more backend-independent asciidoc source file, keeping high quality output.
Has anyone worked in such a direction ?
Else if I do it some day I'll share, especially if someone shows interest.

Regards,

--
Stéphane Gourichon 06 03 34 84 21

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