【发布时间】:2015-09-09 00:29:08
【问题描述】:
我正在使用 CMS 发布我的博客文章。我正在寻找一种从简单的文本文件离线创建 HTML 文章的方法。 这是我通常用于我的文章的一段 HTML:
<p> We want to show how you can gather information such as the author name:</p>
<pre class="brush:java">package com.sample;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.main.Main;
public class XMLCamel {
public static void main(String[] args) throws Exception {
Main main = new Main();
}
}
class Sample extends RouteBuilder {
@Override
public void config() throws Exception {
from("file:/usr/data/files?noop=true")
.split(xpath("//catalog/book/author/text()")).to("stream:out");
}
}</pre>
<p>The above route will print the author names according to the <strong>XPath</strong> query: //catalog/book/author/text()</p>
<p>The authors will be sent to the Stream.out so you will see them on the console once you run the code.</p>
<p><strong>Result:</strong></p>
<p><strong>John Smith Sally Joy</strong></p>
如您所见,我使用了一些自定义来包装代码(预类等)。用 Asciidoctor 可以轻松完成吗?我是 Asciidoctor 的新手,我只是想知道是否值得为此花时间学习它。
谢谢!
【问题讨论】:
标签: asciidoc asciidoctor