|
Cookbook /
IndentedPageListSummary:Sort and indent pagelist items using page text variable
Version:
Prerequisites:
Status: tested
Maintainer: Jiri
Categories: Pagelists
Questions answered by this recipeHow to indent pagelist items according to the listed documents hierarchy DescriptionSort 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. Solution:
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
# 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. NotesRelease Notes
CommentsSee AlsoContributors |