From 0639c0b728ceb63c7d4031d11d5d66c150cd3337 Mon Sep 17 00:00:00 2001 From: pmario Date: Fri, 2 Feb 2024 00:41:35 +0100 Subject: [PATCH] toc - bring docs in line with the code --- .../tiddlers/macros/TableOfContentsMacro.tid | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid b/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid index 54343bf32..132a2a80c 100644 --- a/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid +++ b/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid @@ -1,27 +1,33 @@ created: 20140919155729620 -modified: 20230427125500432 +modified: 20240201233726111 tags: Macros [[Core Macros]] title: Table-of-Contents Macros type: text/vnd.tiddlywiki -~TiddlyWiki provides several macros for generating a tree of tiddler links by analysing [[tags|Tagging]]: +~TiddlyWiki provides several macros for generating a tree of tiddler links by analysing tiddler [[tagging|Tagging]]: -;<<.var toc>> +!! Macros + +; toc : A simple tree -;<<.var toc-expandable>> + +; toc-expandable : A tree in which all the branches can be expanded and collapsed -;<<.var toc-selective-expandable>> + +; toc-selective-expandable : A tree in which the non-empty branches can be expanded and collapsed -;<<.var toc-tabbed-internal-nav>> and <<.var toc-tabbed-external-nav>> + +; toc-tabbed-internal-nav
toc-tabbed-external-nav : A two-panel browser: -:* on the left, a selectively expandable tree that behaves like a set of vertical tabs -:* on the right, the content of whichever tiddler the user selects in the tree +:* On the left, a selectively expandable tree that behaves like a set of vertical tabs +:* On the right, the content of whichever tiddler the user selects in the tree The difference between the last two has to do with what happens when the user clicks a link in the right-hand panel: -;<<.var toc-tabbed-internal-nav>> +; toc-tabbed-internal-nav : The target tiddler appears in the right-hand panel, replacing the tiddler that contained the link -;<<.var toc-tabbed-external-nav>> + +; toc-tabbed-external-nav : The target tiddler appears in the normal way (which depends on the user's configured storyview) !! Structure @@ -42,16 +48,19 @@ To make a table of contents appear in the sidebar, see [[How to add a new tab to !! Parameters -;tag +; tag : The root tag that identifies the top level of the tree -;sort + +; sort : An optional extra [[filter step|Filter Step]], e.g. `sort[title]` -These two parameters are combined into a single [[filter expression|Filter Expression]] like this: +The sort parameter substituted into a single [[filter expression|Filter Expression]] like this. For backwards compatibility it is done as follows: -> `[tag[$tag$]$sort$]` +> ``<$list filter=`[all[shadows+tiddlers]tag!has[draft.of]$(sort)$] -[] -[subfilter]`>`` -<<.var toc-tabbed-internal-nav>> and <<.var toc-tabbed-external-nav>> take additional parameters: +!! Tabbed TOC Additional Parameters + +`toc-tabbed-internal-nav` and `toc-tabbed-external-nav` take additional parameters: ; selectedTiddler : The title of the [[state tiddler|StateMechanism]] for noting the currently selected tiddler, defaulting to `$:/temp/toc/selectedTiddler`. It is recommended that this be a [[system tiddler|SystemTiddlers]] @@ -87,8 +96,8 @@ The default settings can be overwritten in your code using the define-pragma or ''Define new icons using a pragma'' ``` -\define toc-open-icon() $:/core/images/fold-button -\define toc-closed-icon() $:/core/images/folder +\procedure toc-open-icon() $:/core/images/fold-button +\procedure toc-closed-icon() $:/core/images/folder ... ```