问题标签 [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.

0 投票
1 回答
273 浏览

asciidoc - 在 PDF 中突出显示 TypeScript JSX (TSX) 的 AsciiDoc 语法

我正在使用 AsciiDoc 编写大学 React 和 TypeScript 课程。对于 HTML5 后端,我设法配置了Prism源代码荧光笔,效果很好。

在 PDF 中突出显示 TypeScript JSX (TSX) 源代码的建议是什么?据我所知,rougepygments还不支持这一点。

0 投票
1 回答
618 浏览

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:

Unwanted nested includes

  • 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

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 the pass:[] macro.
0 投票
1 回答
258 浏览

asciidoc - asciidoc:如何使用页码等进行数学运算?

设置

我使用以下页脚导出 PDF:

问题:

我想同时增加page-numberpage-countpage-offset

到目前为止我已经尝试过:

我找到了一个可能相关的讨论并尝试了类似的东西

所以我想我需要先实现calc才能使用它,但我该怎么做呢?我找到了第二个可能相关的线程,但是我会在哪里放置这样的宏?

更新:

我找到了“数学表达式和函数”部分,它似乎只适用于变量。所以我在总结之前尝试将page-number和转换为变量:page-offset

但是它们被视为它们的字符串;渲染输出为“1 + 42”...

所以基本上这个问题是:如何进行数学运算page-number和/或如何将其转换为数字?

0 投票
2 回答
586 浏览

asciidoc - 从多个 Asciidoc 文件生成单个 PDF

我正在尝试将现有的 asciidoc 文档转换为 pdf。Asciidoctor-pdf 看起来很简单,我可以将单个文件转换为 pdf。

但是我的文档分布在许多文件中。我想从所有这些文件中创建一个 pdf。有谁知道如何做到这一点?

其次,我不希望生成的 pdf 位于 adoc 文件的旁边。我想指定一个目标路径。

我会很感激每一个提示。谢谢和最好的问候。塞巴斯蒂安

0 投票
1 回答
1002 浏览

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 时,出现以下错误:

  1. 正常图像
  1. 植物图

我想问题是 asciidoctor-web-pdf 没有替换image$...路径的一部分,所以引用是错误的(或者通常无法解决这些引用)。图像和图表嵌入如下:

有没有人提示如何解决我的问题?我也对其他解决方案持开放态度。也许安托拉有一种更简单的方法,所以我根本不需要 asciidoctor-web-pdf?


编辑:我通过在 pdf-adoc 顶部设置图像路径解决了普通图像的问题。

:imagesdir: ./assets/images

0 投票
1 回答
129 浏览

asciidoc - 如何在没有图像标签的情况下使用 Asciidoc 在嵌套列表中包含图像?

我想在使用 Asciidoc 的有序嵌套列表的末尾包含一个图像。例如:

但是,图像最终被标记为与第三个项目符号相同。有没有办法让图像与第一个项目符号保持在同一条垂直线上?

在图像不起作用之前摆脱 + ,因为这样排序列表中后续项目的编号就会被丢弃。

0 投票
1 回答
234 浏览

macros - Asciidoctor 无法解析格式化文本:“​<a data-type

我正在使用以下命令运行 asciidoctor:

它无法解析以下文本:

出现以下错误:

我该如何解决?

0 投票
1 回答
48 浏览

cyrillic - 章节标题中的非拉丁符号

我有以下 asciidoc 源文件:

出现以下错误:

我使用以下命令运行它:

my.yml 有这个内容的地方:

显然,问题出在乌克兰符号上。我应该如何解决它?

编辑:

仅当章节标题为西里尔文时才会发生这种情况,并且正文可以正常工作。

0 投票
0 回答
58 浏览

pdf - PDF 页面自动调整大小以适应 asciidoctor-pdf 的内容

我想使用强大的 Asciidoctor 语法从表中生成独立的 PDF。使用 Asciidoctor 文档属性,我可以删除页眉、页脚并设置零边距和 PDF 页面大小,如下例所示:

该文件是用asciidoctor-pdf -s example-table.adoc.

这个例子的问题是,在选择了页面宽度之后,我必须通过反复试验来设置页面高度以去除底部边距。

在此处输入图像描述

我在问是否有一种方法可以从内容中自动查找和设置页面高度,以便结果是一个 PDF 完全适合没有边距的表格。

注意 在评论中描述了使用该工具的两步解决方法pdfcrop

0 投票
1 回答
29 浏览

asciidoctor - 我可以更改 Asciidoctor PDF 在源块中使用的字体吗?

是否可以在source生成的 PDF 块中指定不同的字体asciidoctor-pdf

我猜它与我正在使用的主题(目前只是默认主题)有关,但我已经检查了主题指南并且看不到任何与source块相关的配置。