Maven, one file pdf and html site

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Maven, one file pdf and html site

Nicolas
Hello,
I'm new to asciidoc and I'm trying to mutuallise documentation on a Java project.
I must have a html site and a single pdf file that aggregate all pages of the site with include.

I have managed to create file with maven and asciidoctor plugin.

I have some trouble with link inside my pdf doc.
if I use anchor :
<<Release Note, API Release Notes>>
it work in pdf but not in html as there is no reference to the adoc file.
if I use link or xref
 xref:NEWS.adoc#Release-Note[API Release Notes]
it's working on html but not in aggregation pdf.

I have found a way to bypass this by defining and using a variable
ifdef::backend-pdf[]
:NEWSURI: <<Release Note, API Release Notes>>
endif::[]
ifdef::backend-html5[]
:NEWSURI: xref:NEWS.adoc#Release-Note[API Release Notes]
endif::[]

But it is a bit ugly... and really verbose solution.
Is there a (cleaner) way to do this ?

Many thanks for your help..

Best regards,
Nicolas
Reply | Threaded
Open this post in threaded view
|

Re: Maven, one file pdf and html site

Linda
I have declared in the header section my adoc file:

ifdef:env-pdf[:outfilesuffix: .pdf]

a link within my document looks like <<filename#section>>

I do not give an extention, only the name, as it will become a link after compilation.  So, it works for both html and pdf.

note: I include multiple .adoc files in one main .adoc with include::filename.adoc[...]. If I want to link a section, i use the filename of the main document (without extention!).

In the POM file, I have two executions defined. One for html output, one for pdf output.