gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 04:25:38 25 4
gpt4 key购买 nike

有没有办法配置 AsciiDoctor Maven 插件从多个 .adoc 文件中生成一个 PDF 文件?

目前,它只是将 asciidoc 文件的结构转换为相同的结构,但使用的是 PDF。我想要一个文件,当我单击链接时,它会将我移动到同一 PDF 中的目标位置。这甚至可以使用 Maven 插件吗?

我当前的 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>
...

最佳答案

您需要将单篇文章聚合成一篇,例如:

:toc: macro
:toclevels: 3
:toc-title: Contents
:doctype: book
:chapter-label:

toc::[]

:doctype: book

include::article1.adoc[]

include::article2.adoc[]

...

并设置 maven 插件来编译单个 adoc:

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

似乎 Q 更多是关于 asciidoc 而不是 maven...

我认为要支持文档链接,我们需要创建具有唯一名称的 anchor ,例如:

构建工具.adoc:

[#building_tool]
= Building tool

== Status
Accepted

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

关于java - 配置 AsciiDoctor Maven 插件以生成单个 PDF 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73198176/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com