Asciidoctor :: HTML5 :: DocumentTemplate替代品

时间:2014-09-15 16:35:01

标签: ruby html5 gradle asciidoctor

我没有Asciidoctor,Ruby或gradle的经验。我已经负责一个由其他人开发的项目,该项目使用了所有这三个项目。在代码中是函数Asciidoctor::HTML5::DocumentTemplate,它会抛出错误

我们最近升级到Asciidoctor 1.5.0,当尝试编译此项目时,它会抛出以下错误消息:

16:25:53.429 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.jruby.exceptions.RaiseException: (NameError) uninitialized constant Asciidoctor::HTML5
16:25:53.429 [ERROR] [org.gradle.BuildExceptionReporter] at org.jruby.RubyModule.const_missing(org/jruby/RubyModule.java:2689)
16:25:53.430 [ERROR] [org.gradle.BuildExceptionReporter] at RUBY.__singleton__(/tmp/document.html.erb:108)

第108行是:<%= ::Asciidoctor::HTML5::DocumentTemplate.outline(self, (attr :toclevels, 2).to_i) %>

从我所看到的情况来看,它会从一个标题中填充内容表,标题前面带有##标记。

我从这里做什么?

2 个答案:

答案 0 :(得分:0)

您的第108行应更改为:

<%= ::Asciidoctor::Converter::Html5Converter.outline(self) =%>

然而,正如我在评论中所说,我需要看到更多,看是否有其他事情需要改变。

答案 1 :(得分:0)

您的 document.html.erb 可能基于asciidoctor-v0.1.4/erb/html5/document.html.erb。那个适用于asciidoctor 0.1.4,但不适用于1.5。可以在此处找到适用于1.5的版本:master/erb/html5/document.html.erb

在这两个版本之间,行

<%= ::Asciidoctor::HTML5::DocumentTemplate.outline(self, (attr :toclevels, 2).to_i) %>

替换为

<%= converter.convert self, 'outline' %>

更改 document.html.erb 副本中的那一行为我解决了错误。

相关问题