Login  Register

Injecting a directory listing

Posted by Toolforger on Dec 26, 2019; 12:45pm
URL: https://discuss.asciidoctor.org/Injecting-a-directory-listing-tp7445.html

Hi all,

I am planning to use Asciidoctor to generate a static website (no other output format is considered).

The issue I don't know how to deal with is the table of website content, i.e. the list of other pages to be shown on each page.

Constraints:
- It needs to iterate over output pages, and ignore helper files.
- It needs to preserve the directory structure.
- Within a directory, the order should be according to file name.
- The text generated should be the page's title (NOT the file name).

One approach I have been considering:
- Start one Asciidoctor instance for each output file.
- Stop the Asciidoctor instances as soon as they know what the title is.
- Generate the ToC snippet.
- Continue the Asciidoctor instances.

How would one execute this approach?
Are there other approaches?

(Personal background: I don't know Ruby but I feel confident I can learn enough to get something done, as I have a bit of Smalltalk background and know quite a lot about very varied programming languages. I am currently most "into" Java, but I found that AsciidoctorJ data structures and algorithms would still require Ruby knowledge to properly use, so I'll want to stick with Ruby if programming is needed. I did some research into template engines and how they combine, and found a far too large selection of options to be able to even identify one that will will.)