Discussion:
[xwiki-users] Master table of contents page based on toc's for different pages
Stubdal, Inge
13 years ago
Permalink
Hello!

I want to set up a table of contents page where each top-level entry in the TOC is the name of another page, and then I want the level1 headings of each page to appear as level 2 items in the master toc page.

Is this very complicated to do? Has anyone done something like this?

It will get rather tedious to maintain the master toc whenever the other documents are changed.

Thanks!

-Inge


Think green - keep it on the screen.
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
Thomas Mortagne
13 years ago
Permalink
Post by Stubdal, Inge
Hello!
I want to set up a table of contents page where each top-level entry in the TOC is the name of another page, and then I want the level1 headings of each page to appear as level 2 items in the master toc page.
Is this very complicated to do? Has anyone done something like this?
It will get rather tedious to maintain the master toc whenever the other documents are changed.
Thanks!
In theory this it's not too hard to do but one issue is that it
require to do some things that are not possible with Velocity syntax
(using enum, create a new instance of ClassBlockMatcher amon other
things).

So I can see two solutions:
* write a java macro that you would then use in your TOC page like we
use {{toc/}} macro when we want to display a toc of the current page
(that would be my choice but I'm a Java dev ;))
* write a groovy script but this will require programming right either
in the TOC page itself or in a wiki macro that you will then use in
the TOC page

In both cases a good thing to look at is the toc macro code to see how
to extract headings titles from a document XDOM. See
https://github.com/xwiki/xwiki-rendering/blob/master/xwiki-rendering-macros/xwiki-rendering-macro-toc/src/main/java/org/xwiki/rendering/internal/macro/toc/TocMacro.java.
...
--
Thomas Mortagne
Continue reading on narkive:
Loading...