Login  Register

Re: Injecting a directory listing

Posted by Toolforger on Dec 27, 2019; 10:23pm
URL: https://discuss.asciidoctor.org/Injecting-a-directory-listing-tp7445p7456.html

Heh. Yes, I may be wrong about Antora. I tried too many template engines in the past two weeks, and the details have started becoming fuzzy. It didn't work, likely because I couldn't figure out how to adopt, circumvent or abuse its features to give me the use case I wanted.
Which has been the experience with most toolchain combinations I tried. (Some quickly turned out to be unsuitable. I knew I was doing something wrong when I started looking for reasons to fail a given combination, instead of making it work...)

So the approach I'm trying now is to use Asciidoc in inline mode, and do all the scaffolding in Ruby:
1. Collect all .adoc files.
2. Have Asciidoc parse them. (Sweet: Asciidoc allows me to do exactly that, as I just found out.)
3. For each file, extract whatever Asciidoc will give me as the first title, use that as the title for the ToC.
4. For each file, Assemble (static) page frame, ToC, and Asciidoctor output into a .html page.

I have proofs of concept of steps 1 and 2. (And learned a bit of Ruby, which I have been wanting to do anyway.)
I am not so sure about step 3. I don't really know how the Asciidoc data model looks like, so I'll try to find that information (pointers appreciated).
Step 4 is where I'm not sure yet. There are just too many template engines around; I'd want something that has a clean semantics (i.e. prefers to emit an error message over trying to second-guess my intentions), doesn't have Ruby code inside the template (that's just asking for layer violations).

Well, back to coding for me :-)