asciidoctor / asciidoctor-maven-examples

A collection of example projects that demonstrates how to use the Asciidoctor Maven plugin.
http://asciidoctor.org/docs/asciidoctor-maven-plugin
Other
196 stars 243 forks source link

Add an example showing how to load a custom template #15

Open abelsromero opened 9 years ago

abelsromero commented 9 years ago

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.

abelsromero commented 5 years ago

Take hints form: http://discuss.asciidoctor.org/Small-changes-to-default-HTML5-templates-td6851.html

mokdeve commented 1 year ago

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?

abelsromero commented 1 year ago

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.

abelsromero commented 1 year ago

@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.

mokdeve commented 1 year ago

@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.

abelsromero commented 1 year ago

@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>.

mokdeve commented 1 year ago

@abelsromero Thanks for your solution, I run it now and it works fine.