IndentedPageList
Questions answered by this recipe
How to indent pagelist items according to the listed documents hierarchy
Description
Sort and indent pagelist items according to the listed documents hierarchy.
When listing pages of some documentation not by Name nor by Title sorting is always suitable.
More I wish to indent the listed titles like in the multilevel bulleted list.
Solution:
Put in your documents page text variable e.g. docnum by this example:
docnum value | in the page with the title |
0 | Introduction |
1 | System requirements |
11 | Hardware |
12 | Other parties software |
2 | Installation |
3 | Implementation |
4 | Users manual - by roles |
41 | Administrator |
42 | Management |
43 | Sales dpt. |
How to:
(:title Introduction:) (:docnum:0:)
etc.
The pagelist should look like this:
Introduction System requirements Hardware Other parties software Installation Implementation Users manual - by roles Administrator Management Sales dpt.
You can get it by sorting the pagelist
sort=$:docnum
and in the format using the markup (:indent =$:<PTVname>:)
which Caveman kindly created for me.
Just put the following lines into your local/config.php
# usage: (:indent =$:<PTVname>:) # indents text with groups of spaces - number of groups is given by PTV length Markup('zapindent', 'inline', '/\(:indent (.*?)\:\)/e', 'ZAPindent("$1")'); function ZAPindent($x) { $x = trim($x); for ($i = 0; $i < strlen($x); $i++) { $out .= " "; } return $out; }
example:
(:pagelist group=MyManual $:docnum=?* sort=$:docnum fmt=#fmtIndented:) (:if false:) [[#fmtIndented]] (:indent =$:docnum:){=$Title} [[#fmtIndentedend]] (:ifend:)
Thus the level 1 document is indented with 5 spaces, level 2 with 10 spaces.
You can replace the $out variable assignement
$out .= "*";
to get bulleted list of proper levels.
Notes
Release Notes
See Also
Contributors
Comments
See discussion at IndentedPageList-Talk?