Creating on-the-fly reverse TOC?

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.

Creating on-the-fly reverse TOC?

Postby oceanclub on Mon Sep 13, 2021 10:40 am

Say I have a HTML5 target which publishes a TOC which is a blog (being continually updated) which is in reverse chronological order; that is, the most recent entries are at the top of the TOC.

But I'd also like to create a book (PDF or EPUB) version which is in chronological order; that is, the earliest entry is at the top of TOC and so start of the book.

To simply things, the TOC only has one level of entries; no topics are nested.

Is there a way to do this on the fly, without having to manually create and update one TOC to be the reverse of the other?

User avatar
Sr. Propeller Head
Posts: 257
Joined: Thu Oct 10, 2013 4:45 am
Location: Dublin

Re: Creating on-the-fly reverse TOC?

Postby robdocsmith on Tue Sep 14, 2021 4:07 pm

Not that I can think of within Flare. The only option I can think of is to write an external script to do this.

I could imagine a bit of Python that reads TOCA, converts it to TOCB, which is then used by the target to build the document. You could then call the script as a pre-build event from a batch file.

Or perhaps you could build a simpler sub-TOC that is based on a list of files in your blog directory, sorted in date order. This sub-TOC is then embedded as an entry in your main print TOC.

I do similar sorts of things with my documents. I include the schematics for a product in my print output. They change regularly so I have a script that builds a simple list of the files in a directory into a sub-TOC. This way I can guarantee I've always got the most up to date files in my document.

Sr. Propeller Head
Posts: 145
Joined: Thu May 24, 2018 3:11 pm
Location: Queensland, Australia

Return to Printed Documentation Targets

Who is online

Users browsing this forum: No registered users and 5 guests