Index: twikiplugins/TreePlugin/lib/TWiki/Plugins/TreePlugin.pm =================================================================== --- twikiplugins/TreePlugin/lib/TWiki/Plugins/TreePlugin.pm (revision 11391) +++ twikiplugins/TreePlugin/lib/TWiki/Plugins/TreePlugin.pm (working copy) @@ -164,7 +164,7 @@ my $attrFormatting = TWiki::Func::extractNameValuePair( $attributes, "formatting" ) || ""; my $attrStoplevel = TWiki::Func::extractNameValuePair( $attributes, "stoplevel" ) || 999; my $doBookView = TWiki::Func::extractNameValuePair( $attributes, "bookview" ) || ""; - + my $attrLevelPrefix = TWiki::Func::extractNameValuePair( $attributes, "levelprefix" ) || ""; cgiOverride(\$attrFormatting, "formatting"); # set the type of formatting @@ -180,6 +180,7 @@ # else set the format(s), if any $formatter->data("format", $attrFormat) if ($attrFormat); $formatter->data("branchformat",$attrFormatBranch) if ($attrFormatBranch); + $formatter->data("levelprefix",$attrLevelPrefix) if ($attrLevelPrefix); } # get search results Index: twikiplugins/TreePlugin/lib/TWiki/Plugins/TreePlugin/FormatOutlineNodeFormatter.pm =================================================================== --- twikiplugins/TreePlugin/lib/TWiki/Plugins/TreePlugin/FormatOutlineNodeFormatter.pm (revision 11391) +++ twikiplugins/TreePlugin/lib/TWiki/Plugins/TreePlugin/FormatOutlineNodeFormatter.pm (working copy) @@ -48,6 +48,14 @@ sub formatNode { my ($this, $node, $count, $level) = @_; + + #SL: do not render at level 0 + if ($level == 0 && $this->data("levelprefix")) + { + return ""; + } + + my $res = $this->data("format"); my $nodeLinkName = '[[' . $node->name() . ']]'; @@ -79,7 +87,16 @@ $res, $node, qw(text summary)); # some meta substitutions go here - } + } + + #SL: levelprefix + my $i=$level; + while ($i>0) + { + $res=$this->data("levelprefix").$res; + $i--; + } + return $res; } Index: twikiplugins/TreePlugin/data/TWiki/TreePlugin.txt =================================================================== --- twikiplugins/TreePlugin/data/TWiki/TreePlugin.txt (revision 11391) +++ twikiplugins/TreePlugin/data/TWiki/TreePlugin.txt (working copy) @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="MartinRaabe" date="1043065324" format="1.0" version="1.3"}% +%META:TOPICINFO{author="StephaneLenclud" date="1156977833" format="1.1" reprev="1.4" version="1.4"}% ---++ %TOPIC% Enables dynamic generation of TWiki topic trees based on topics' parent-child relationships. @@ -12,71 +12,82 @@ Plugin settings are stored as preferences variables. To reference a plugin setting write ==%<plugin>_<setting>%==, for example, ==%INTERWIKIPLUGIN_SHORTDESCRIPTION%== - * One line description, shown in the %TWIKIWEB%.TextFormattingRules topic: - * Set SHORTDESCRIPTION = Dynamic generation of TWiki topic trees + * One line description, shown in the %TWIKIWEB%.TextFormattingRules topic: + * Set SHORTDESCRIPTION = Dynamic generation of TWiki topic trees - * Set DEBUG to 1 to get debug messages in =data/debug.txt=. Default: =0= - * Set DEBUG = 0 + * Set DEBUG to 1 to get debug messages in =data/debug.txt=. Default: =0= + * Set DEBUG = 0 ---+++ Syntax Rules Adds the following tags: - * %TREEVIEW% - displays a TWiki topic's children in a hierarchical fashion. + * %TREEVIEW% - displays a TWiki topic's children in a hierarchical fashion. Attributes: - * *web* - specify web - * *topic* - specify tree's root topic (if none, will do the entire web) - * *formatting* - specify the formatting method - * _ullist_ is a <ul>-list, see [[Sandbox.TreePluginSamples#UlList][sample UL lists]] - * _ollist_ is a <ol>-list, see [[Sandbox.TreePluginSamples#OlList][sample OL lists]] - * _outline_ is an outline list, see [[Sandbox.TreePluginSamples#SampleOutlines][sample Outlines]] - * _hlist_ is a <hn>-list of section heads, see [[Sandbox.TreePluginSamples#SampleHList][sample Headlines]] - * _coloroutline_ is an outline formatting with level values turned into colors, see [[Sandbox.TreePluginSamples#SampleNestedTables][sample Nested tables]] - * _imageoutline_ is a way to incorporate images into the outline format, - specifically to display thread-like and fodler views, see [[Sandbox.TreePluginSamples#SampleImageTrees][sample Image Trees]] - * *stoplevel* - the depth of the tree to show - * *header* - header output - * *bookview* - list topics in BookView form - * *format* - specify the format for each node (=outline= & =coloroutline=). Format variable options: - * _$topic_ - the topic name - * _$web_ - the topic's web - * _$spacetopic_ - the topic with spaces - * _$summary_ - the topic's summary - * _$text_ - the topic's text (which will get rendered) - * _$author_ - the topic's last author - * _$modTime_ - the topic's modification time - * _$level_ - the tree depth of the topic (in whatever format) - * _$count_ - the topic's child position - * _$onum_ - outline number for the topic (eg, 1.3.4.2) - * _$url_ - the current topic's URL - * *formatbranch* - specify the format for a group of children (=outline= & =coloroutline=) - * _$parent_ - the text of a node - * _$children_ - the text of all the node's children (if any) + * *web* - specify web + * *topic* - specify tree's root topic (if none, will do the entire web) + * *formatting* - specify the formatting method + * =ullist= is a <ul>-list, see [[TreePluginSamples#UlList][sample UL lists]] + * =ollist= is a <ol>-list, see [[TreePluginSamples#OlList][sample OL lists]] + * =outline= is an outline list, see [[TreePluginSamples#SampleOutlines][sample Outlines]] + * =hlist= is a <hn>-list of section heads, see [[TreePluginSamples#SampleHList][sample Headlines]] + * =coloroutline= is an outline formatting with level values turned into colors, see [[TreePluginSamples#SampleNestedTables][sample Nested tables]] + * =mageoutline= is a way to incorporate images into the outline format, + specifically to display thread-like and fodler views, see [[TreePluginSamples#SampleImageTrees][sample Image Trees]] + * *stoplevel* - the depth of the tree to show + * *header* - header output + * *bookview* - list topics in BookView form + * *format* - specify the format for each node (=outline= & =coloroutline=). Format variable options: + * _$topic_ - the topic name + * _$web_ - the topic's web + * _$spacetopic_ - the topic with spaces + * _$summary_ - the topic's summary + * _$text_ - the topic's text (which will get rendered) + * _$author_ - the topic's last author + * _$modTime_ - the topic's modification time + * _$level_ - the tree depth of the topic (in whatever format) + * _$count_ - the topic's child position + * _$onum_ - outline number for the topic (eg, 1.3.4.2) + * _$url_ - the current topic's URL + * *formatbranch* - specify the format for a group of children (=outline= & =coloroutline=) + * _$parent_ - the text of a node + * _$children_ - the text of all the node's children (if any) + * *levelprefix* - specify a prefix to a node format. The prefix is inserted $level times at the beginning of the rendered node format (=outline=). It allows generation of trees using TWiki bullet list syntax thus enabling usage of TreePlugin in [[#Combination_with_TreeBrowserPlug][Combination with TreeBrowserPlugin]]. -See Sandbox.TreePluginSamples for samples usage and output. +---+++ Samples +See the following pages for sample usage and output. + * TreePluginSamples + * HeadingOutlineSample + * TreeBookviewOutlineSample +---++++ Combination with TreeBrowserPlugin + +=%TREEBROWSER{"file" title="%WEB%"}%= %BR% +=%TREEVIEW{web="%WEB%" topic="GrandParent" formatting="outline" format="* $topic" levelprefix=" "}%= + + ---+++ Limitations and Known Issues - * The parameter *web* does not work correctly. The Tree gets rendered, but the WikiWords of the topics do not contain the *web* value, but refers to the current web. Since I have limited knowledge of perl OO, I can't repair for now. -- TWiki:Main.MartinRaabe - 16 Jan 2003 + * The parameter *web* does not work correctly. The Tree gets rendered, but the WikiWords of the topics do not contain the *web* value, but refers to the current web. Since I have limited knowledge of perl OO, I can't repair for now. -- TWiki:Main.MartinRaabe - 16 Jan 2003 ---+++ Plugin Installation Instructions - * Download the ZIP file from the Plugin web (see below). %BR% + * Download the ZIP file from the Plugin web (see below). %BR% Contents: | *File:* | *Description:* | | ==data/TWiki/%TOPIC%.txt== | Plugin topic | | ==data/TWiki/%TOPIC%.txt,v== | Version file of Plugin topic | - | ==data/Sandbox/%TOPIC%Samples.txt== | Plugin Samples | - | ==data/Sandbox/%TOPIC%Samples.txt,v== | Version file of Plugin Samples | - | ==data/Sandbox/HeadingOutlineSample.txt== | Heading Outline Sample | - | ==data/Sandbox/HeadingOutlineSample.txt,v== | Version file of Heading Outline Sample | - | ==data/Sandbox/TreeBookviewOutlineSample.txt== | Tree Bookview Outline Sample | - | ==data/Sandbox/TreeBookviewOutlineSample.txt,v== | Version file of Tree Bookview Outline Sample | + | ==data/Plugins/%TOPIC%Samples.txt== | Plugin Samples | + | ==data/Plugins/%TOPIC%Samples.txt,v== | Version file of Plugin Samples | + | ==data/Plugins/HeadingOutlineSample.txt== | Heading Outline Sample | + | ==data/Plugins/HeadingOutlineSample.txt,v== | Version file of Heading Outline Sample | + | ==data/Plugins/TreeBookviewOutlineSample.txt== | Tree Bookview Outline Sample | + | ==data/Plugins/TreeBookviewOutlineSample.txt,v== | Version file of Tree Bookview Outline Sample | | ==lib/TWiki/Plugins/%TOPIC%.pm== | Plugin Perl module | | ==lib/TWiki/Plugins/%TOPIC%/ColorNodeFormatter.pm== | Library component | | ==lib/TWiki/Plugins/%TOPIC%/FormatHelper.pm== | Library component | @@ -99,9 +110,9 @@ | ==pub/TWiki/TreePlugin/white.gif== | tree icon | | ==templates/booktree.tmpl== | Template for bookview mode | - * Unzip ==%TOPIC%.zip== in your twiki installation directory. - * (Dakar) Visit =configure= in your TWiki installation, and enable the plugin in the {Plugins} section. - * If you see a tree of this topic here: + * Unzip ==%TOPIC%.zip== in your twiki installation directory. + * (Dakar) Visit =configure= in your TWiki installation, and enable the plugin in the {Plugins} section. + * If you see a tree of this topic here: %TREEVIEW{topic="TreePlugin"}% @@ -109,7 +120,7 @@ ---+++ Plugin Info @@ -132,7 +143,7 @@ ---++++ Copyright This code is protected by the following copyrights: - * Copyright (C) 2002 Slava Kozlov. All Rights Reserved. + * Copyright (C) 2002 Slava Kozlov. All Rights Reserved. ---++++ License As required for the publication of all extensions to TWiki, this @@ -146,3 +157,12 @@ http://www.gnu.org/copyleft/gpl.html -- TWiki:Main.SlavaKozlov - 16 Feb 2002 + +%META:FILEATTACHMENT{name="oT.gif" attr="" autoattached="1" comment="" date="1154464059" path="oT.gif" size="879" user="UnknownUser" version=""}% +%META:FILEATTACHMENT{name="I.gif" attr="" autoattached="1" comment="" date="1154464059" path="I.gif" size="869" user="UnknownUser" version=""}% +%META:FILEATTACHMENT{name="white.gif" attr="" autoattached="1" comment="" date="1154464059" path="white.gif" size="56" user="UnknownUser" version=""}% +%META:FILEATTACHMENT{name="pL.gif" attr="" autoattached="1" comment="" date="1154464059" path="pL.gif" size="880" user="UnknownUser" version=""}% +%META:FILEATTACHMENT{name="oL.gif" attr="" autoattached="1" comment="" date="1154464059" path="oL.gif" size="874" user="UnknownUser" version=""}% +%META:FILEATTACHMENT{name="L.gif" attr="" autoattached="1" comment="" date="1154464059" path="L.gif" size="864" user="UnknownUser" version=""}% +%META:FILEATTACHMENT{name="T.gif" attr="" autoattached="1" comment="" date="1154464059" path="T.gif" size="873" user="UnknownUser" version=""}% +%META:FILEATTACHMENT{name="pT.gif" attr="" autoattached="1" comment="" date="1154464059" path="pT.gif" size="883" user="UnknownUser" version=""}%