Is there a way to configure AsciiDoctor Maven plugin to generate one PDF file out of many .adoc files?
Currently, it simply translates the structure of asciidoc files into the same structure, but using PDFs. I would like to have a single file and when I click on the link it moves me to the target location in the same PDF. Is this even possible using Maven plugin?
My current pom.xml:
...
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>2.2.2</version>
<dependencies>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-pdf</artifactId>
<version>2.1.4</version>
</dependency>
</dependencies>
<configuration>
<sourceDirectory>documentation</sourceDirectory>
<outputDirectory>target/pdf-doc</outputDirectory>
<backend>pdf</backend>
<preserveDirectories>true</preserveDirectories>
</configuration>
<executions>
<execution>
<id>generate-pdf-doc</id>
<phase>generate-resources</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<backend>pdf</backend>
<attributes>
<source-highlighter>rouge</source-highlighter>
<icons>font</icons>
<pagenums/>
<toc/>
<idprefix/>
<idseparator>-</idseparator>
</attributes>
</configuration>
</execution>
</executions>
</plugin>
...
You need to aggregate individual articles into single one like:
:toc: macro
:toclevels: 3
:toc-title: Contents
:doctype: book
:chapter-label:
toc::[]
:doctype: book
include::article1.adoc[]
include::article2.adoc[]
...
and setup maven plugin to compile that single adoc:
<configuration>
<sourceDocumentName>single.adoc</sourceDocumentName>
</configuration>
It seems the Q is more about asciidoc rather than maven...
I believe to support document links we need to create anchors with unique names, something like:
building-tool.adoc:
[#building_tool]
= Building tool
== Status
Accepted
cloud.adoc:
[#cloud]
= Cloud
== Status
Accepted
adr-log.adoc:
| 08/07/2022
| xref:adr/building-tool.adoc#building_tool[Building tool]
| Accepted
| 08/07/2022
| xref:adr/cloud.adoc#cloud[Cloud]
| Accepted
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With