Item8383: TreeBrowser produces excess output when used with empty TREEVIEW
Priority: Enhancement
Current State: New
Released In: n/a
Target Release:
--
NeilMckett - 08 Jan 2010
when using the
TreeBrowserPlugin as follows:
%TREEBROWSER{"thread" title="<h5>%INCLUDINGTOPIC%</h5>"}%
%TREEVIEW{startlevel="1" topic="%INCLUDINGTOPIC%" web="%INCLUDINGWEB%" formatting="outline" format="* [[$web.$topic][$topic]]" levelprefix=" "}%
%INCLUDE{"%INCLUDINGWEB%.CreateGeneralDocPage"}%
the code in the
CreateGeneralDocPage is imported into the treebrowser if the
TREEVIEW is empty. The
CreateGeneralDocPage code is not in the format
that
TreeBrowser is expecting so the tree should just be empty.
In summary
TreeBrowser seems not to know when a tree has finished when a TREEVIEW
tag produces no output. Perhaps some tag could be used to let the
TreeBrowser
know that the end of the tree has been reached eg %ENDOFTREEBROWSER%
-- Main.??? - ?? ??? ????
There is some related discussion at
http://twiki.org/cgi-bin/view/Plugins/TreeBrowserPluginDev.
A quick work-around seems to be to add after the list a line with just three spaces and nothing else. This will stop
TreeBrowserPlugin from processing the page further in case that there is no tree before this line.
Example:
%TREEBROWSER{...}%
%TOC%
[a line with just 3 spaces at the beginning and nothing else]
Some other list that should not be modified
* ...
Maybe one way to fix this would be to add some sort of negative lookahead (e.g., (?!%ENDOFTREEBROWSER%)) somewhere into the regexp that is triggering handleTreeView, possibly into the "(([\n\r]+[^\t]{1}[^\n\r]*)*?)" part.
By the way, there is a link from the
TreeBrowserPlugin page to the TWiki page mentioned above, but not to the support page at foswiki.org.
--
JeffSebastian - 08 Jul 2011