Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hi,
I'm using Asciidoctor (and po4a) to build a multilingual document system. The default styling looks great, but I'd like to make some small changes, and I'm not sure of the best approach. The templates in the asciidoctor-backends repository aren't maintained – the slim/html5 template throws an error on "image::name.jpg[]", so that's probably not what I should use. (I also wasn't sure which of eml, haml or slim to choose.) What's the recommended way to make minor changes to the existing html5 template? Before I realized the problem with the images, I edited the slim templates to generate this with a logo and placeholder for some links above the table of contents. The "This document is also available in PDF ... español, français" part is generated with a custom extension that looks at what else is in the repository, ideally I'd also like that to be outside the document (above the TOC) as well. Can a template call an extension for this? Thanks :) |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
I don’t know that it is recommended but my way is to put the modified styles in the docinfo.html file. Regards
-Mark |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
|
Asciidoctor gives you lots of options for modifying the generated HTML (and supplementing it with additional CSS). One way is to use templates. As Mark points out, docinfo is another option. The templates in https://github.com/asciidoctor/asciidoctor-backends are just meant to be a reference to get you started. You only need to use the templates for the nodes you want to change. If a template is missing, Asciidoctor falls back to the built-in HTML converter. Another solution, new in Asciidoctor 2, is to override the converter directly. This is the same as using templates, but done in Ruby. For example, if you want to override the HTML for a paragraph, you can use: class MyHtmlConverter < (Asciidoctor::Converter.for 'html5') register_for 'html5' def convert_paragraph node %(<p>#{node.content}</p>) end end Then just pass that script to the asciidoctor command using the -r option. Best, -Dan On Tue, Apr 16, 2019 at 2:12 PM msc [via Asciidoctor :: Discussion] <[hidden email]> wrote:
... [show rest of quote] -- Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Thanks Dan (and Mark), that's exactly what I needed.
> You only need to use the templates for the nodes you want to change. I had been trying only to use _toc.html.slim, but now I see why that wouldn't work. I've used a bit of both methods and am very pleased with the result. Anyone finding this question can see the source. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
|
Matt, In regards to your question: > I had been trying only to use _toc.html.slim, but now I see why that wouldn't work. That seems to be a residual file. The template you'd need to override is outline.html.slim (which can also be named block_outline.html.slim as the block_ prefix is optional). The files that are prefixed with underscore are specific to how the slim templates were implemented in the backends repository. If you're starting from scratch, you don't have to make use of these partials...and frankly you would be better off because then you aren't coupled to how it was done there. Cheers, -Dan On Wed, Apr 17, 2019 at 7:20 AM MattBlissett [via Asciidoctor :: Discussion] <[hidden email]> wrote: Thanks Dan (and Mark), that's exactly what I needed. -- Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Free forum by Nabble | Edit this page |