Question
I am trying to use %WEBLIST% to generate text for all (visible) webs on my TWiki. I'm finding that there are two problems:
- The "\n" as newline metacharacter doesn't work in the format or seperator line.
- Any % characters within a format or other option cause %WEBLIST% to break.
Sample of what I'm trying to do -- generate a stats page with global statistics for all webs. Though this works, the headers (---++) don't resolve properly because they don't align with a newline:
%<nop>WEBLIST{ format="%INCLUDE{'$name.WebStatistics'}%" }%
What I see:
Admin Design Know Main Plugins Portals Sales Sandbox TWiki Tech Test" }%
What I expect to see is (repeated for each web):
(Disabling stats output for everyone's sanity)
%INCLUDE{"Support.WebStatistics"}%
- TWiki version: 01 Dec 2001
- Web server: Apache
- Server OS: RH Linux 7.2
- Web browser: Galeon 1.x
- Client OS: Debian GNU/Linux (Woody)
--
KarstenSelf - 13 May 2002
Answer
The
separator attribute in
%WEBLIST% currently does not support "\n" or "$n" for new line, omitting
separator will default to new line.
Another problem in your example is that TWiki does not match the correct curly bracket, the closing
%WEBLIST% bracket is incorrectly matched by the closing bracket of
%INCLUDE% (based on a simple non-greedy regex)
%SEARCH% has more options, this is probably what you want to use. Example: We search for topic names in all public webs and show the result in
BookView.
%SEARCH{ "^WebStatistics[^a-zA-Z]" scope="topic" web="all" regex="on" bookview="on" nosearch="on" noheader="on" nototal="on" }%
If you want to go fancy you could specify a
FormattedSearch with a regular expression instead of the BookView to pick a subset from the topic. Edit the
Codev.WebHome topic to see how to show only the statistics of the current month.
--
PeterThoeny - 14 May 2002
Thanks, that's exactly it. I'd actually arrived at the recipie independently.
Followup -- I note that the terminator for "WebStatistics" is "[!a-zA-Z]" (actually, I used [^A-z0-9]), rather than "$". Is there a reason that the end-of-line metacharacter isn't appropriate? Hmm...probably a FAQ I'll bet
--
KarstenSelf - 16 May 2002
I can't remember the exact reason, but
$ at the end does not seem to work in TWiki, hence
[^A-z0-9].
--
PeterThoeny - 14 May 2002
Line end match is now fixed, see
Codev.CantAnchorSearchREToEnd
--
PeterThoeny - 15 Jul 2002