Customizing footnotes using templates

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Customizing footnotes using templates

phil
Just recently started to use Asciidoc and I love it!

I'm trying to customise how footnotes are rendered by using custom templates.
I have passed the --template-dir option to asciidoctor and customised the inline_footnotes.html.haml file (from asciidoctor-backends git repository), which works :)

The problem is customising the footnote text at the bottom of the page, I couldn't see any way of doing it without providing a template for document.html.haml.
I tried creating _footnotes.html.haml, but that had no effect.

Any suggestions?
Reply | Threaded
Open this post in threaded view
|

Re: Customizing footnotes using templates

phil
Does anyone have any ideas?
Reply | Threaded
Open this post in threaded view
|

Re: Customizing footnotes using templates

mojavelinux
Administrator
@phil,

First, Haml doesn't support includes (at least not in our setup), so you have to use the Slim templates instead. (A better choice in my mind anyway).

However, at the moment, Slim is only configured to resolve an included file relative to the file that's including it. Instead, I would expect Slim to search in all the specified template directories (in reverse order, just like it does for the main templates).

As it turns out, I found a note to myself to report this problem, so I went ahead and filed an issue for it.


One this is resolved, you'll be able to put _footnotes.html.slim in template-overrides/html5 and call Asciidoctor as follows to use it:

 $ asciidoctor -T asciidoctor-backends/slim/html5 -T template-overrides/html5 input.adoc

It's necessary to use the Slim templates as a base since the footnotes are not handled as a separate node (like the outline)*. However, be aware that the Slim templates have drifted slightly from the built-in html5 converter and are in need of being updated.

Cheers,

-Dan

* I think a strong case could be made for updating core to handle the footnotes block as a separate node. This would be similar to what we do for the outline (i.e., TOC content).

On Wed, May 24, 2017 at 6:13 AM, phil [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Does anyone have any ideas?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Customizing-footnotes-using-templates-tp5553p5619.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux