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

--template-dir argument doesn't seem to override the built-in slim templates #177

Closed
danielhodson opened this issue Jan 19, 2018 · 5 comments · Fixed by #318
Closed

--template-dir argument doesn't seem to override the built-in slim templates #177

danielhodson opened this issue Jan 19, 2018 · 5 comments · Fixed by #318

Comments

@danielhodson
Copy link

I'd like to use the --template-dir asciidoctor argument to change formatting produced by the default asciidoctor-revealjs slim templates. I've used this successfully with asciidoctor-bespoke, but when doing the same with asciidoctor-revealjs it doesn't seem to work (the backend template is not overridden). I'm thinking this might be due to #131 but would like to know if -T is supported or if there's a workaround that doesn't involve tinkering with the asciidoctor-revealjs backend.

thanks,

@obilodeau
Copy link
Member

Yes, because of #131, templates are no longer available directly.

What kind of changes are you doing to the templates? Maybe it should be pushed to the main repository?

Otherwise, I see two options:

  1. build and use your own compiled converter: bundle exec rake build then bundle exec asciidoctor-revealjs will use it
  2. reintroduce --template-dir as a flag in the ruby front-end that will bypass the built template and use the slim templates directly

Option 2) will require some development and will be ruby-only. I can guide you through the implementation. I think we have a task in our Rakefile that is close to what needs to be done.

Let me know what you prefer.

@danielhodson
Copy link
Author

Thanks for confirming it's related to #131 @obilodeau 👍

I'm wanting to update the slim templates to have more control over how HTML is generated.. an example might be putting titles in their own div, content in another, and appending an empty div for the footer - so that it's easier to manipulate with CSS. This is an approach I have successfully taken before when using asciidoctor-bespoke. The main reason for going down this path is without customising how backend templates work, my .adoc files become very cluttered with syntactic sugar so they can play nice with multiple backends like revealjs/pdf/html5. In a crux, I feel like it takes away my focus from being on prose and places more emphasis on getting syntax right.

I was hoping to avoid option 1. if possible, but may not know enough Ruby to implement option 2 myself (I'll take a look at the Rakefile though to see what's involved).

Cheers,

@ggrossetie
Copy link
Member

I think it should be possible if the converter has the supports_templates trait:

https://github.com/asciidoctor/asciidoctor/blob/32a269e71723ba10537a13b2b3dfa611b0131566/lib/asciidoctor/converter.rb#L125

In this case, I believe that Asciidoctor will create a composite converter using a template converter with a fallback on the reveal.js converter.

@obilodeau
Copy link
Member

That would be very interesting to explore and document.

@ggrossetie
Copy link
Member

I've just tried it and it's working but we need to make a change in jirutka/asciidoctor-templates-compiler#5

ggrossetie added a commit to ggrossetie/asciidoctor-reveal.js that referenced this issue Jan 22, 2020
ggrossetie added a commit to ggrossetie/asciidoctor-reveal.js that referenced this issue Jan 22, 2020
ggrossetie added a commit to ggrossetie/asciidoctor-reveal.js that referenced this issue Jan 22, 2020
ggrossetie added a commit to ggrossetie/asciidoctor-reveal.js that referenced this issue Jan 22, 2020
obilodeau added a commit that referenced this issue Jan 23, 2020
resolves #177 allow to override the built-in slim templates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants