asciidoctor-maven-examples
asciidoctor-maven-examples copied to clipboard
Add an example showing how to load a custom template
As discuessed in http://discuss.asciidoctor.org/Maven-plugin-and-extensions-td3149.html#a3151, an example showing custom template loading should be added to show this feature.
It's important to remark in the example templates are useful when changing the HTML generated by Asciidoctor.
Take hints form: http://discuss.asciidoctor.org/Small-changes-to-default-HTML5-templates-td6851.html
Hi All,
I downloaded a template (erb) from backends and saved it to my workspace, and added the templateDir for asciidoc-to-html-example in the POM, As follows:
<configuration>
<sourceDirectory>src/docs/asciidoc</sourceDirectory>
<templateDirs>
<templateDir>D:\worksapce\online-documentation-guide\src\docs\erb\html5</templateDir>
</templateDirs>
<attributes>
<endpoint-url>http://example.org</endpoint-url>
<sourcedir>${project.build.sourceDirectory}</sourcedir>
<project-version>${project.version}</project-version>
</attributes>
</configuration>
When I use build command mvn clean package got error Failed to load AsciiDoc docum ent - Unknown ERB implementation , as follows:
[ERROR] Failed to execute goal org.asciidoctor:asciidoctor-maven-plugin:2.2.2:process-asciidoc (asciidoc-to-html) on project asciidoc-to-html-example: Execution asciidoc-to-html of goal org.asciidoctor:asciidoctor-maven-plugin:2.2.2
:process-asciidoc failed: org.jruby.exceptions.ArgumentError: (ArgumentError) asciidoctor: FAILED: D:/worksapce/asciidoctor-maven-examples/asciidoc-to-html-example/src/docs/asciidoc/example-manual.adoc: Failed to load AsciiDoc docum
ent - Unknown ERB implementation: : (ArgumentError) Unknown ERB implementation: -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
Could you help me how to fix it?
Could you help me how to fix it?
I am afraid there's some issue. Good things...I could reproduce it and run it directly with AsciidoctorJ, so :crossed_fingers: it's some parameter combination. Or some classpath issue, I need to find why it cannot find the implementation for eRubis. But other engines like slim work.
@mokdeve btw, you did not explain your use case, but for certain cases is definetly easier to implement an extension. You can drop by https://asciidoctor.zulipchat.com/ and expose it to get some advice if you want.
@abelsromero
Thanks, I want to use asciidoctor-maven-plugin in my java project to load a custom template for auto build.
Run it directly with AsciidoctorJ -T D:\worksapce\online-documentation-guide\src\docs\erb\html5 work fine as a temporary solution.
I need to find why it cannot find the implementation for eRubis.
I look forward to your good news.
@mokdeve thanks for the patience, the issue is in the configuration of eruby . We inject an empty string and that should set the default, but it's not doing so. For now set it manually like <eruby>erb</eruby>.
@abelsromero Thanks for your solution, I run it now and it works fine.