4

我正在使用 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 的新手,只是想知道是否值得为此花时间学习它。
谢谢!

4

2 回答 2

2

除了 LightGuard 的高级答案之外,值得一提的是,您可以使用++++将自定义 HTML 添加到输出中。

++++<h1>hello</h1>++++

只会生成

<h1>hello</h1>
于 2015-09-08T16:29:08.467 回答
2

要回答这个问题,是的,这是可能的。但是,对于像这样微不足道的事情,asciidoctor ootb 的输出以及选择的荧光笔可能适用于您正在做的事情。

如果您需要自定义您需要创建自定义后端的内容。由于创建自定义后端的文档尚未完成,因此此邮件列表帖子应该会有所帮助。

于 2015-09-03T03:48:47.880 回答