Asciidoctor:如何替换包含文档中的表达式?

Asciidoctor: how to replace expression in included document?

给定的 asciidoctor 文件 my-document.adoc 内容为:

include::included-document.adoc[]

included-document.adoc 包含

The content of this file cannot be changed.

This text *has to be replaced*.

渲染时my-document.adoc,我想要可见的内容

无法更改此文件的内容。
此文本 已成功替换

不改变 included-document.adoc 这可能吗? my-document.adoc可能会改变。

有一个 Asciidoctor 扩展实验室为此提供了示例,例如一个将制表符换成空格的包含处理器。

希望这能让你入门。

https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/lib/whitespace-include-processor.rb