问题标签 [asciidoctor-pdf]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
asciidoc - Better way to include content *as is* with AsciiDoc include directive
Context
I am making a script that dynamically inserts include directives in code blocks on an AsciiDoc file and then generates a PDF out of that. A generated AsciiDoc file could look like this:
I want the user to be free to include whatever char-based file he or she wants, even other AsciiDoc files.
Problems
My goal is to show the contents as are of these included files. I run into problems when the included file:
- is recognized as AsciiDoc beacuse of its extension, an thus any include directives it has are interpreted. I don't want nested includes, just to show the include directive in the code block. Example of undesired behaviour:
- contains the code block delimiter
----
, as seen on the image above when I end up with two code blocks instead of the intended single one. In this case, it does not matter if the file is recognized as an AsciiDoc file, the problem persists.
My workaround
The script I am writing uses AsciidoctorJ and I am leveraging that I can control how the content of each file is included by using an include processor. Using the include processor I wrap each line of each file with the pass:[]
macro. Additionally, I activate macro substitution on the desired code block. A demonstration of this idea is shown in the image above.
Is there a better way to show the exact contents of a file? This works, but it seems like a hack. I would much rather prefer not having to change the read lines as I am currently doing.
EDIT for futher information
I would like to:
- not have to escape the block delimiter. I am not exclusively referring to
----
, but whatever the delimiter happens to be. For example, the answer by cirrus still has the problem when a line of the included file has....
. - not have to escape the include directives in files recognized as AsciiDoc.
In a general note, I don't want to escape (or modify in any way) any lines.
Problem I found with my workaround:
- If the last char of a line is a backslash (
\
), it escapes the closing bracket of thepass:[]
macro.
asciidoc - asciidoc:如何使用页码等进行数学运算?
设置
我使用以下页脚导出 PDF:
问题:
我想同时增加page-number
和page-count
。page-offset
到目前为止我已经尝试过:
我找到了一个可能相关的讨论并尝试了类似的东西
所以我想我需要先实现calc
才能使用它,但我该怎么做呢?我找到了第二个可能相关的线程,但是我会在哪里放置这样的宏?
更新:
我找到了“数学表达式和函数”部分,它似乎只适用于变量。所以我在总结之前尝试将page-number
和转换为变量:page-offset
但是它们被视为它们的字符串;渲染输出为“1 + 42”...
所以基本上这个问题是:如何进行数学运算page-number
和/或如何将其转换为数字?
asciidoc - 从多个 Asciidoc 文件生成单个 PDF
我正在尝试将现有的 asciidoc 文档转换为 pdf。Asciidoctor-pdf 看起来很简单,我可以将单个文件转换为 pdf。
但是我的文档分布在许多文件中。我想从所有这些文件中创建一个 pdf。有谁知道如何做到这一点?
其次,我不希望生成的 pdf 位于 adoc 文件的旁边。我想指定一个目标路径。
我会很感激每一个提示。谢谢和最好的问候。塞巴斯蒂安
asciidoctor - 生成的 PDF 文档中没有图像(从 Asciidoc 到 PDF)
我正在使用 asciidoctor-web-pdf 从 asciidoc 生成 PDF 文档。到目前为止,大多数任务都可以正常工作。
但我的文档不包含图像或生成的图表(植物)。
文件夹结构遵循 Antora 的布局,因为我主要使用 Antora。PDF 只是一个必要的副产品。
我的文件夹结构如下所示(如 antora-layout 所述):
pdf.adoc 只是一个包含列表,以确保每个需要的 adoc 文件都是 PDF 的一部分。
根据文件夹结构,我的 logo.png 的正确路径是docs/modules/ROOT/assets/images/logo.png
(或绝对路径/home/sebastian/work/workspace/workspace-p/jira-ops-manual/docs/modules/ROOT/assets/images/logo.png
)。
当我使用上述命令生成 PDf 时,出现以下错误:
- 正常图像
- 植物图
我想问题是 asciidoctor-web-pdf 没有替换image$...
路径的一部分,所以引用是错误的(或者通常无法解决这些引用)。图像和图表嵌入如下:
有没有人提示如何解决我的问题?我也对其他解决方案持开放态度。也许安托拉有一种更简单的方法,所以我根本不需要 asciidoctor-web-pdf?
编辑:我通过在 pdf-adoc 顶部设置图像路径解决了普通图像的问题。
:imagesdir: ./assets/images
asciidoc - 如何在没有图像标签的情况下使用 Asciidoc 在嵌套列表中包含图像?
我想在使用 Asciidoc 的有序嵌套列表的末尾包含一个图像。例如:
但是,图像最终被标记为与第三个项目符号相同。有没有办法让图像与第一个项目符号保持在同一条垂直线上?
在图像不起作用之前摆脱 + ,因为这样排序列表中后续项目的编号就会被丢弃。
macros - Asciidoctor 无法解析格式化文本:“<a data-type
我正在使用以下命令运行 asciidoctor:
它无法解析以下文本:
出现以下错误:
我该如何解决?
asciidoctor - 我可以更改 Asciidoctor PDF 在源块中使用的字体吗?
是否可以在source
生成的 PDF 块中指定不同的字体asciidoctor-pdf
?
我猜它与我正在使用的主题(目前只是默认主题)有关,但我已经检查了主题指南并且看不到任何与source
块相关的配置。