使用 asciidoctor 创建自定义 HTML

use*_*073 5 asciidoc asciidoctor

我正在使用 CMS 来发布我的博客文章。我正在寻找一种从简单文本文件离线创建 HTML 文章的方法。\n这是我通常在文章中使用的一段 HTML:

\n\n
<p>\xc2\xa0We want to show how you can gather information such as the author name:</p>\n<pre class="brush:java">package com.sample;\n\nimport org.apache.camel.builder.RouteBuilder;\nimport org.apache.camel.main.Main;\n\n\npublic class XMLCamel {\n\n    public static void main(String[] args) throws Exception {\n        Main main = new Main();\n\n    }\n}\n\nclass Sample  extends RouteBuilder {\n\n    @Override\n    public void config() throws Exception {\n\n        from("file:/usr/data/files?noop=true")\n            .split(xpath("//catalog/book/author/text()")).to("stream:out"); \n\n    }\n}</pre>\n<p>The above route will print the author names according to the <strong>XPath</strong> query: //catalog/book/author/text()</p>\n<p>The authors will be sent to the Stream.out so you will see them on the console once you run the code.</p>\n<p><strong>Result:</strong></p>\n<p><strong>John Smith Sally Joy</strong></p>\n
Run Code Online (Sandbox Code Playgroud)\n\n

正如您所看到的,我使用一些自定义来包装代码(课前等)。这是可以用 Asciidoctor 轻松完成的事情吗?我是 Asciidoctor 的新手,只是想知道是否值得为此目的投入时间学习它。
\n谢谢!

\n

Lig*_*ard 2

回答这个问题,是的,这是可能的。然而,对于像这样的小事情,asciidoctor ootb 的输出以及选择的荧光笔可能适合您正在做的事情。

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