On 25 December 2014 at 21:18, Stéphane Gourichon <[email protected]> wrote: > 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.
One problem (for it to be a general Asciidoc capability) is that the correct format can also depend on the toolchain. FOP for example does not accept PDF images, even when generating PDF http://xmlgraphics.apache.org/fop/1.1/graphics.html#format-map. But Asciidoc doesn't know the toolchain. Certainly extra attributes could be set by the user but the number of combinations gets quite high. > > The variants of included image would have been generated via a Makefile rule > like : > > %.png: %.pdf > convert $< (some relevant convert options) $@ Actually using your favourite stream editor (sed, Perl, Python etc) inside the make rules to set the Asciidoc image lines correctly is probably the best way of doing it when you are 'make'ing documents. Cheers Lex > > 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. -- 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.
