简体   繁体   English

配置AsciiDoctor Maven插件生成单个PDF文件

[英]Configure AsciiDoctor Maven plugin to generate a single PDF file

Is there a way to configure AsciiDoctor Maven plugin to generate one PDF file out of many .adoc files?有没有办法配置 AsciiDoctor Maven 插件以从许多.adoc文件中生成一个 PDF 文件?

Currently, it simply translates the structure of asciidoc files into the same structure, but using PDFs.目前,它只是将 asciidoc 文件的结构转换为相同的结构,但使用的是 PDF。 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.我想要一个文件,当我单击链接时,它会将我移动到同一 PDF 中的目标位置。 Is this even possible using Maven plugin?这甚至可以使用 Maven 插件吗?

My current pom.xml:我当前的 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:并设置 maven 插件来编译该单个 adoc:

<configuration>
   <sourceDocumentName>single.adoc</sourceDocumentName>
</configuration>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM