Jea*_* T. 3 asciidoc asciidoctor
有谁知道如何在 Asciidoc 中将变量传递{var}给[source]块和示例块(带有====)?
我已经尝试了以下
:country: France
:city: Shanghai
[source]
----
print("{country} is a country")
print("{city} is a city")
----
.Example
====
{country} is a country +
{city} is a city
====
.Example with better alignment
====
{country} is a country
{city} is a city
====
Run Code Online (Sandbox Code Playgroud)
但这就是我得到的:
实际上,第一个“示例”正在运行,但它不是理想的解决方案,因为:
+在每一行的末尾添加一个期待您的投入。提前致谢!
如此处所述,您需要在代码块中打开属性替换。你可以用[subs="attributes"]完整的例子来实现它应该是这样的:
[source, subs="attributes"]
----
print("{country} is a country")
print("{city} is a city")
----
.Example with better alignment
====
[subs="attributes"]
{country} is a country
{city} is a city
====
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1048 次 |
| 最近记录: |