Forum OpenACS Q&A: xowiki toc includelet error

Collapse
Posted by Torben Brosten on
Hi,

Can someone post a working example of an xowiki toc includelet?

I created a test case using the example provided by xowiki here: https://openacs.org/xowiki/toc-test

It returns an error message "must have an even number of elements". I've added 0 to the last element to get an even number, and tried a few variations but am just not understanding the syntax with given example.

Torben

Collapse
Posted by Stefan Sobernig on
Torben,

Mmmh. I had a look at your test page and, actually, I recognised that you simply copy&pasted the xowiki-doc {{toc ...}} statement into the page. This is somewhat problematic because the string is a auto-generated one meant for documentation purposes, it reflects parameters and the default values (which might be hidden). Nevertheless, the issue with the uneven list is due to a loss of information when using double-quotes for empty-string argument values, e.g.:

{{toc -decoration plain -expand_all 1 -source ""}}

If you write ...

{{toc -decoration plain -expand_all 1 -source {} }}

you should be fine. I rewrote your example at the test page accordingly.

As for the background, whether this is intended or error behaviour, I will check back later with a code crawl. Or, maybe, Gustaf Neumann may shed light on this in the meantime.

//stefan

Collapse
Posted by Gustaf Neumann on
your example page is a moving target.

the installation of xowiki on openacs.org is quite ancient (nearly a year old). I guess, the problem was due to regexp parsing of curly braces. make sure, you have a blank before the two closing braces of the includelet definition.

note that you have to have some entries with page_order (section) set, to get a toc. I have added a few.

hope, this helps

Collapse
Posted by Gustaf Neumann on
The problem with the double-quotes was fixed a while ago.
Collapse
Posted by Torben Brosten on
Thank you, both.

Is there a way to coax a toc that does not use page_order?

I'm looking for an includelet that creates an alphabetized or sortable (ad_list style) list of existing pages.. until I can figure out from the xowiki documentation on how to add page_order values to each of the pages.

Collapse
Posted by Gustaf Neumann on
have your read http://alice.wu-wien.ac.at:8000/xowiki-faq/#ordering ?
What is it that you are trying to do?
Collapse
Posted by Torben Brosten on
Gustaf,

I had not seen the xowiki-faq before (or maybe I did but was sleep browsing). It answers many of my questions. Thank you.

An includelet that lists published files by date, name or size, something like xowiki/admin/list with the various admin actions not active and not shown could be useful.

Categories will work for the current instance, so am using it.

There are definitely times when a simpler UI (no categories) would be useful. I can see how having one category item and using {{categories -title "Table of Contents" -tree_name *toc* -open_page de:iMac}} could emulate a simple dir-list includelet, but then I hope (for end user's sake) that the UI is smart enough to automatically choose a required category item if there is only 1 choice.

Also, having just read Christopher Alexander's "A Timeless Way of Building" and "A Pattern Language", I see how powerful XoWiki really is. Bravo and thanks for this.