mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-10 16:10:02 +00:00
toc - bring docs in line with the code
This commit is contained in:
parent
b322a70b86
commit
0639c0b728
@ -1,27 +1,33 @@
|
|||||||
created: 20140919155729620
|
created: 20140919155729620
|
||||||
modified: 20230427125500432
|
modified: 20240201233726111
|
||||||
tags: Macros [[Core Macros]]
|
tags: Macros [[Core Macros]]
|
||||||
title: Table-of-Contents Macros
|
title: Table-of-Contents Macros
|
||||||
type: text/vnd.tiddlywiki
|
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
|
: A simple tree
|
||||||
;<<.var toc-expandable>>
|
|
||||||
|
; toc-expandable
|
||||||
: A tree in which all the branches can be expanded and collapsed
|
: 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
|
: 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<br> toc-tabbed-external-nav
|
||||||
: A two-panel browser:
|
: A two-panel browser:
|
||||||
:* on the left, a selectively expandable tree that behaves like a set of vertical tabs
|
:* 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 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:
|
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
|
: 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)
|
: The target tiddler appears in the normal way (which depends on the user's configured storyview)
|
||||||
|
|
||||||
!! Structure
|
!! Structure
|
||||||
@ -44,14 +50,17 @@ To make a table of contents appear in the sidebar, see [[How to add a new tab to
|
|||||||
|
|
||||||
; tag
|
; tag
|
||||||
: The root tag that identifies the top level of the tree
|
: The root tag that identifies the top level of the tree
|
||||||
|
|
||||||
; sort
|
; sort
|
||||||
: An optional extra [[filter step|Filter Step]], e.g. `sort[title]`
|
: 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<tag>!has[draft.of]$(sort)$] -[<tag>] -[subfilter<exclude>]`>``
|
||||||
|
|
||||||
<<.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
|
; 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]]
|
: 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 new icons using a pragma''
|
||||||
|
|
||||||
```
|
```
|
||||||
\define toc-open-icon() $:/core/images/fold-button
|
\procedure toc-open-icon() $:/core/images/fold-button
|
||||||
\define toc-closed-icon() $:/core/images/folder
|
\procedure toc-closed-icon() $:/core/images/folder
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user