How can I embed a list of subpages of any wiki page into another one, in a way that exports to PDF? I know about the “documentTree” Macro, but it does not work for PDF export as it seems to be dynamically generated, and I can’t use it inline with a velocity script.
My situation is this:
I have a number of pages starting with the same prefix. All of these pages have a subpage, starting with another defined prefix, but the rest of the title is the same. I’d like to reuse the same code for all pages, so I want to build the references on the fly. I know how to work with strings, so the first shouldn’t be a problem, but the document references give me headaches.
Now what I want is to display a list of the subpages of a subpage of the main page .
E.g. I have this structure:
Prefix My Page
PrefixLong My Page
Subpage 1
Subpage 2
etc.
Inside of “Prefix My Page” I want to display the subpages of “PrefixLong MyPage” dynamically, I’d say with a velocity script. The best thing would be if I wouldn’t have to enter one static page name, but build the strings on the fly. So from “Prefix My Page” I can extract “My Page” and build the name of the Subpage, “PrefixLong My Page”.
And the whole thing should be exportable to PDF.
Can anyone please point me to the right direction? I’m not very familiar with velocity and XWiki yet (though the API is mighty!)
Uhh… I might have formulated my question a bit unclear: I don’t want to export multiple pages at once, I want to see a list of subpages inside another wiki page. This page in turn will be exported to PDF, and inside the PDF I want to see this list as well. So just a list with titles, no actual contents of the subpages.
However I haven’t even found a way to create a list of subpages of any wiki page and embed this list into another page (with velocity). Additionally, I’d like to do it dynamically (not $xwiki.getDocument("A.B.C")).
Amazing, quick and easy without having to hassle with references etc.
That nearly does what I’d like to have, just one little thing is missing for my use case:
I saw you noticed the issue (on IRC) as well, some list items are not clickable. Though I don’t need the stringtool anymore.
It’s clearer now, yes. Saves you two minutes of debugging…
Everything that I wanted works now, thanks for your quick help. I’ve now added links to the subpages, then put the whole script into a small wiki page. Now I can {{include.../}} this page in every page which needs it. And I can export the whole thing to PDF.