1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 05:19:57 +00:00

update docs rename SimpleToc to /param/<parameterName>

This commit is contained in:
pmario 2024-08-27 17:32:51 +02:00
parent 218cf9d501
commit e07edae502
13 changed files with 165 additions and 57 deletions

View File

@ -1,6 +1,6 @@
created: 20240208143409196
modified: 20240208152306199
modified: 20240826163400275
title: $:/config/RelinkOnRename
type: text/vnd.tiddlywiki
no
yes

View File

@ -0,0 +1,4 @@
title: $:/config/flibbles/relink/fields/import-compound
type: text/vnd.tiddlywiki
title

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,13 @@
author: Flibbles
core-version: >=5.1.22
created: 20240221025320294
demo: http://flibbles.github.io/tw5-relink/
dependents:
description: Flexibility when relinking renamed tiddlers
list: readme configuration license
name: Relink
plugin-type: plugin
source: https://github.com/flibbles/tw5-relink
title: $:/plugins/flibbles/relink
type: application/json
version: 2.4.3

View File

@ -1,8 +1,8 @@
created: 20240724082221230
import-compound: Examples/TOC/SimpleToc
modified: 20240730081240127
import-compound: Examples/TOC/param/tag
modified: 20240826164358077
tags: $:/tags/wiki-test-spec
title: Examples/TOC/SimpleToc/captionField
title: Examples/TOC/param/captionField
type: text/vnd.tiddlywiki-multiple
title: Description

View File

@ -0,0 +1,57 @@
created: 20240826160050805
description: Simple TOC
modified: 20240826162927425
tags: $:/tags/wiki-test-spec
title: Examples/TOC/param/itemTemplate
type: text/vnd.tiddlywiki-multiple
title: Narrative
* The following code defines a "Simple Table of Contents" using "root" as the base tag
* Click through all the tabs to get additional info
<$transclude $tiddler="Narrative-extended" $mode="block"/>
+
title: root
list: First Third Fourth
The list-field in the "root" tag-tiddler can be used to define the "sort order" of the TOC
+
title: First
tags: root
1st 1st 1st 1st 1st
+
title: Second
tags: First
2nd 2nd 2nd 2nd 2nd
+
title: Third
tags: root
3rd 3rd 3rd 3rd 3rd
+
title: Fourth
caption: fourth-caption
tags: root
4th 4th 4th 4th 4th
This tiddler contains a caption, which will be shown in the TOC instead of the tiddler title
+
title: myTemplate
<$let tv-wikilinks="no">
<$transclude $field="caption">
<$transclude $field="title"/> - param itemTemplate
</$transclude>
</$let>
+
title: Output
<div class="tc-table-of-contents">
<<toc tag:"root" itemTemplate:"myTemplate">>
</div>

View File

@ -1,8 +1,8 @@
created: 20240730081443212
description: Simple TOC - parentField parameter
modified: 20240803121600331
modified: 20240826162950242
tags: $:/tags/wiki-test-spec
title: Examples/TOC/SimpleToc/parentField
title: Examples/TOC/param/parentField
type: text/vnd.tiddlywiki-multiple
title: Narrative

View File

@ -1,8 +1,8 @@
created: 20240724070813184
description: Simple TOC
modified: 20240729112105751
description: TOC tag parameter
modified: 20240826164015156
tags: $:/tags/wiki-test-spec
title: Examples/TOC/SimpleToc
title: Examples/TOC/param/tag
type: text/vnd.tiddlywiki-multiple
title: Narrative

View File

@ -1,14 +1,15 @@
created: 20240729105221520
description: Simple TOC - tagField = tagLike
modified: 20240729110636440
modified: 20240826163000897
tags: $:/tags/wiki-test-spec
title: Examples/TOC/SimpleToc/tagField
title: Examples/TOC/param/tagField
type: text/vnd.tiddlywiki-multiple
title: Narrative
* This test-case creates a "Simple Table of Contents" using "root" as the base tag
* It uses a field named: ''tagLike'' which defines the TOC structure
* The parameter is: `tagField:"tagLike"`
* Click through all the tabs to get additional info
<$transclude $tiddler="Narrative-extended" $mode="block"/>
@ -39,9 +40,27 @@ tagLike: root
4th 4th 4th 4th 4th
+
title: Fifth
tagLike: Second
5th 5th 5th 5th 5th
+
title: Sixth
tagLike: Second
6th 6th 6th 6th 6th
+
title: Output
<!--
This variable set to yes allows you to show a New-Child button.
This button will create a "real" tiddler, which will _not_ be listed here
-->
\define tv-toc-show-new-child() yes
<div class="tc-table-of-contents">
<<toc tag:"root" tagField:"tagLike">>
</div>

View File

@ -0,0 +1,11 @@
created: 20240826172211655
modified: 20240826172607528
tags: [[Macro Examples]] [[Table-of-Contents Macros]]
title: Table-of-Contents Macros (Advanced Examples)
type: text/vnd.tiddlywiki
The following examples provide information about the "rewritten" toc macors. For the standard examples look at: [[Table-of-Contents Macros (Examples)]]
<<list-links filter:"[prefix[Examples/TOC/]]">>
<<tree prefix:"Examples/TOC/">>

View File

@ -1,5 +1,5 @@
created: 20140919155729620
modified: 20240207142704165
modified: 20240826172206506
tags: Macros [[Core Macros]]
title: Table-of-Contents Macros
type: text/vnd.tiddlywiki
@ -10,19 +10,14 @@ To make a table of contents appear in the sidebar, see [[How to add a new tab to
!! Macros
; toc
: A simple tree
|Macro |Description |h
|''toc'' |A simple tree |
|''toc-expandable'' |A tree in which all the branches can be expanded and collapsed |
|''toc-selective-expandable'' |A tree in which the non-empty branches can be expanded and collapsed |
|''toc-tabbed-internal-nav'' |A two-panel browser:<br>- On the left, a selectively expandable tree that behaves like a set of vertical tabs.<br>- On the right, the content of whichever tiddler the user selects in the tree|
|''toc-tabbed-external-nav'' |~|
; toc-expandable
: A tree in which all the branches can be expanded and collapsed
; toc-selective-expandable
: A tree in which the non-empty branches can be expanded and collapsed
; toc-tabbed-internal-nav<br> 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
!!! Differences
The difference between the last two has to do with what happens when the user clicks a link in the right-hand panel:
@ -33,15 +28,22 @@ The difference between the last two has to do with what happens when the user cl
: The target tiddler appears in the normal way in the story river, which depends on the user's configured storyview
!! Parameters
!! Common Macro Parameters
These parameters are ''used by all'' toc-macros.
|Parameter |Description |h
|''tag'' |The root tag that identifies the top level of the tree |
|''sort'' |An optional extra [[filter step|Filter Step]], e.g. `sort[title]`. See more info below. |
|''exclude'' |This optional parameter can be used to exclude tiddlers from the TOC list |
|''captionField'' |default: `caption`. Expects a field-name.If set it uses this field instead of the caption-field.<br>If the field is empty, or does not exists, it tries to use "caption" or falls back to the "tiddler-title". See more info below. |
|''tagField''|Uses any “tag-like” field instead of the “tags” field to create the “tag-like” tree.<br>tagField takes precedence over parentField. |
|''parentField''|Instead of using tags, the toc tree is built using “parent” fields. There is no default, but usually it will be "parent". This function uses the same filter behaviour as the tocP plugin. |
|''itemTemplate''|Expects a: template tiddler-title. By default toc macros use the `toc-defaultItemTemplate` procedure, which is specific to toc-macros.If itemTemplate is set, it uses the content of the template tiddler to display a toc node. If itemTemplate is used captionField is set to `text`.<br>''Important:'' If the toc-itemTemplate field is set in the current node it will take precedence over the macro parameter |
; tag
: The root tag that identifies the top level of the tree
; sort
: An optional extra [[filter step|Filter Step]], e.g. `sort[title]`
:The sort parameter substituted into a single [[filter expression|Filter Expression]] like this. For backwards compatibility it is done as follows:
:The sort parameter is substituted into a single [[filter expression|Filter Expression]] like this. For backwards compatibility it is done as follows:
:> ``<$list filter=`[all[shadows+tiddlers]tag<tag>!has[draft.of]$(sort)$] -[<tag>] -[subfilter<exclude>]`>``
@ -53,17 +55,11 @@ The difference between the last two has to do with what happens when the user cl
`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]]
; unselectedText
: The text to display when no tiddler is selected in the tree
; missingText
: The text to display if the selected tiddler doesn't exist
; template
: Optionally, the title of a tiddler to use as a [[template|TemplateTiddlers]] for transcluding the selected tiddler into the right-hand panel
|Parameter |Descriptoin |h
|''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]] |
|''unselectedText'' |The text to display when no tiddler is selected in the tree |
|''missingText'' |The text to display if the selected tiddler doesn't exist |
|''template'' |Optionally, the title of a tiddler to use as a [[template|TemplateTiddlers]] for transcluding the selected tiddler into the right-hand panel |
!! Tiddler Fields
@ -71,19 +67,11 @@ The top level of the tree consists of the tiddlers that carry a particular tag,
At each level, the tiddlers can be [[ordered|Order of Tagged Tiddlers]] by means of the <<.field list>> field of the parent tag tiddler. They can also be ordered by the macro's <<.param sort>> parameter.
!!! Tiddler Fields
; caption
: The tree displays the <<.field caption>> field of a tiddler if it has one, or the tiddler's <<.field title>> otherwise.
; toc-link
: Each tiddler in the tree is normally displayed as a link. To suppress this, give the tiddler a <<.field toc-link>> field with the the value <<.value no>>. In the [[examples|Table-of-Contents Macros (Examples)]], the SecondThree tiddler is set up like this. Clicking such a tiddler in the tree causes its branch to expand or collapse.
; target
:<<.from-version "5.1.23">> By default, the links open the tiddlers making up the table of contents. Alternatively, if the tiddler contains a <<.field target>> field then its contents will be used as the target of the link.
; tooltip
: Will be used to show a tooltip about the node on mouse hover
|Field |Description |h
|''caption'' |The tree displays the <<.field caption>> field of a tiddler if it has one, or the tiddler's <<.field title>> otherwise. |
|''toc-link'' |Each tiddler in the tree is normally displayed as a link. To suppress this, give the tiddler a <<.field toc-link>> field with the the value <<.value no>>. In the [[examples|Table-of-Contents Macros (Examples)]], the SecondThree tiddler is set up like this. Clicking such a tiddler in the tree causes its branch to expand or collapse. |
|''target'' |<<.from-version "5.1.23">> By default, the links open the tiddlers making up the table of contents. Alternatively, if the tiddler contains a <<.field target>> field then its contents will be used as the target of the link.|
|''tooltip'' |Will be used to show a tooltip about the node on mouse hover |
!! Custom Icons
@ -119,4 +107,5 @@ The default settings can be overwritten in your code using the define-pragma or
!! Examples
Learn more at [[Examples|Table-of-Contents Macros (Examples)]]
Learn more at [[Standard Examples|Table-of-Contents Macros (Examples)]]
Learn much more at: [[Advanced Examples|Table-of-Contents Macros (Advanced Examples)]]

View File

@ -1,9 +1,11 @@
created: 20150221193056000
modified: 20240207125739904
modified: 20240826172042818
tags: [[Table-of-Contents Macros]] [[Macro Examples]]
title: Table-of-Contents Macros (Examples)
type: text/vnd.tiddlywiki
The following examples provide information about the "core" toc macors. The rewritten toc-macros should be 100% compatible with the functionality presented here.
These examples derive tables of contents from the root tag <<.tag Contents>>. See [[Table-of-Contents Macros]] for details on how to use the Table-of-Contents Macros to make your own structured table-of-contents.
You can explore the tag-based structure with these clickable tag pills:

View File

@ -0,0 +1,12 @@
created: 20240826162020234
modified: 20240826162157753
tags: testTOC
title: test-contacts-itemTemplate-parameter
type: text/vnd.tiddlywiki
* This tiddler was created to test [[contacts]] tiddler, which contains a `toc-include`
* There is a [[Talk-thread|https://talk.tiddlywiki.org/t/proposal-toc-macros-rewrite-using-if-functions-and-procedures-new-fuctionality/9046/32?u=pmario]], where Scott posts his version as a JSON file.
<<wikitext-example-without-html src:"""<div class="tc-table-of-contents">
<<toc "root" item-template:"template">>
</div>""">>