Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slim templates #380

Closed
jmcc0nn3ll opened this issue Dec 10, 2018 · 5 comments
Closed

Slim templates #380

jmcc0nn3ll opened this issue Dec 10, 2018 · 5 comments

Comments

@jmcc0nn3ll
Copy link

I am using slim templates with the plugin but I have only been able to get it working by taking all of the html5 slim templates from the asciidoctor-backends project and dropping them into a templateDir. This was largely working until I discovered there was html being generated from outside of the template structure (sectlevel2 in the toc) and I can't seem to track down where or how to get that adjusted via a template. Is there a more up to date set of slim templates I should be building off of? Some other strategy I should be using? The ones in backend appear to be woefully out of date and been pulled into asciidoctor core some time back.

@jmcc0nn3ll
Copy link
Author

Typical, just needed to ask and get a breakthrough...needed to set the template_dir: on the extra call to Asciidoctor.load_file I am making inside of the slim template and things are making sense again. Regardless, am still curious if there are other approaches recommended for using slim templates I might have missed.

@abelsromero
Copy link
Member

abelsromero commented Dec 10, 2018

the asciidoctor-backends

I assume you mean this https://github.com/asciidoctor/asciidoctor-backends/tree/master/slim/html5.
If so, I just build an example copying them directly into a project and setting the templateDir configuration and it worked fine. Note you need to copy the whole set of templates.

About the repo, can't say more than what is mentioned here asciidoctor/asciidoctor-backends#124 (comment) -> The purpose of this repository is to provide reference templates for the built-in converters.

If you want to have a look at another example, you may be interested in the reveal.js converter, which works using them https://github.com/asciidoctor/asciidoctor-maven-examples/tree/master/asciidoc-to-revealjs-example.

Finally if you are interested in a more complex scenario like having several template directories (https://asciidoctor.org/docs/user-manual/#storing-multiple-templates), the maven plugin does not support it. But I am thinking it would make a lot of sense to add a multivalued templateDirs configuration (and remove the single value templateDir in version 2.0.0).
Would you be interested?

@jmcc0nn3ll
Copy link
Author

Got things working so I'll close out this issue, not the most elegant solution but I am now about to insert my own arbitrarily crafted toc.adoc and have to render correctly using templates.

As for contributing the change for templateDirs, I'll see what I can do, that issue #265 has been around for years so it has to be more complex than it seems but I'll see if I can take a look later this week.

@abelsromero
Copy link
Member

As for contributing the change for templateDirs, I'll see what I can do, that issue #265 has been around for years so it has to be more complex than it seems but I'll see if I can take a look later this week.

Nice "in your face" 🤣 It's true that release 1.6.0 has taken a long time and I've been slacking too much lately. But it's going to be release soon, no joking (asciidoctor/asciidoctorj#702 (comment)). Note 1.6.0 issues have not been implemented because they break backward compatibility.

As for contributing the change for templateDirs, I'll see what I can do, that issue #265 has been around for years so it has to be more complex than it seems but I'll see if I can take a look later this week.

You are more than welcome to try, feel free to ask anything. Just keep in mind to keep the current field to avoid breaking compatibility, we could have two fields (singular and plural) until we go 1.6.0 and leave just the plural.

@jmcc0nn3ll
Copy link
Author

Lol, no offense intended, we have had our fair share of similar issues in Jetty over the years. Agree on keeping the two fields for the time being, the single template field should just use the plural templates behind the scene anyway. I'll try and take a look and get you something this week, I am pretty familiar with maven plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants