cross
New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists
This question about Missing functionality: Needs followup in Tasks

Better control of header lists

(Still using TWiki).

I like the idea of the hlist formatting option in TreeBrowser but it's too constricting. I only want a simple TREE of topics and header. No numbers. No fancy font sizes. No summary!

I want to build a table of contents for topics "under" this one

Topic A Section 1 Section 2 Section 3 Topic B Section 1 Section 2 Section 3

I'd like for hlist to support the format parameter so I have more control.

I tried to write what I wanted using formatting="outline" but the backslashes didn't work as expected and the TOC failed.

Shouldn't this work?

%TREEVIEW{topic="VbrownBagelry" formatting="outline" format="$topic <br /> $percntTOC{\"$topic\"}$percnt  <br />" }%

The backslashes get eaten frown, sad smile


I've had similar problems. TreePlugin doesn't seem to expand vars in the format string.

However I doubt you'll get %TOC% to work in a format string. It expands out to some HTML that uses double-qutoes, breaking the format string.

If it were me and I really wanted to do this, I'd use DBRECURSE from DBCachePlugin to traverse the topic hierarchy with a nested SEARCH done against each topic (or one of FilterPlugin's macros) to use regular expressions to extract the headings. It wouldn't be terribly CPU efficient...

Something like this:
%DBRECURSE{
  "Support.WebHome" 
  format="---+$indent(+) [[$topic]] $percntSEARCH{ \
    \"^---[+]+\" \
    type=\"regex\" \
    topic=\"$topic\" \
    nonoise=\"on\" \
    multiple=\"on\" \
    header=\"$n\" \
    format=\"---+$indent(+)$dollarpattern(^---([+]+[^\n\r]+).*)\"}$percnt"
}%

This should generate the entire topic hierarchy for the current web as a bunch of nested headings, and under each topic heading is the topic's own headings nested under that.

But probably too much nesting! (XHTML defines only 6 levels). So you'll probably have to re-write this to generate HTML rather than TML bullets and headings.

If you find this works out for you please write it up in BestPracticeTips

Should really raise an enhancement task to get TreePlugin to expand macros in its format string though.

-- PaulHarvey - 17 Jan 2010

QuestionForm edit

Subject Missing functionality
Extension TreePlugin
Version TWikiRelease04x02x04
Status Needs followup in Tasks
Topic revision: r5 - 10 Jan 2013, GeorgeClark - This page was cached on 16 Jul 2018 - 14:50.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy