1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-03 06:49:58 +00:00

improve docs

This commit is contained in:
pmario 2024-05-01 13:02:27 +02:00
parent cfbd4bace0
commit 8674a4d326
5 changed files with 21 additions and 16 deletions

View File

@ -1,5 +1,5 @@
created: 20240219185725834 created: 20240219185725834
modified: 20240429134515751 modified: 20240501103053921
tags: Features tags: Features
title: VariableFormat title: VariableFormat
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -8,9 +8,9 @@ type: text/vnd.tiddlywiki
Finding "self explaining" variable names for functions, procedures, widgets and macros is difficult. So if variables are listed with <<.mlink dumpvariables>>, <<.mlink search-variables>> or from the "Variables" tab in the $:/AdvancedSearch, it's not obvious ''how'' they work and how they are defined. Finding "self explaining" variable names for functions, procedures, widgets and macros is difficult. So if variables are listed with <<.mlink dumpvariables>>, <<.mlink search-variables>> or from the "Variables" tab in the $:/AdvancedSearch, it's not obvious ''how'' they work and how they are defined.
The <<.olink variables>> operator returns all "visible" variables from the current context, depending on where the filter run is executed. The <<.olink getvariable>> allows us to return the "text" or the "value" of variables. But this information is not enough to get a good understanding of existing variables. The <<.olink variables>> operator returns all "visible" variables from the current context, depending on where the filter run is executed. The getvariable-operator allows us to return the "text" or the "value" of variables. But this information is not enough to get a good understanding of existing variables.
So using <<.olink getvariable>> operator in combination with the <<.olink format>> operator we are able to improve information in variable listings. So using getvariable-operator in combination with the <<.olink format>> operator we are able to improve information in variable listings.
|Token |Substituted Value |h |Token |Substituted Value |h
|`$type$` |variabe type eg: `\function`, `\procedure` and so on | |`$type$` |variabe type eg: `\function`, `\procedure` and so on |
@ -18,3 +18,5 @@ So using <<.olink getvariable>> operator in combination with the <<.olink format
|`$params$` |returns a list of parameters, which are defined with functions, procedures ... | |`$params$` |returns a list of parameters, which are defined with functions, procedures ... |
|`$firstLine$` |returns the first line of the variable content-type as used by <<.olink getvariable>> | |`$firstLine$` |returns the first line of the variable content-type as used by <<.olink getvariable>> |
|`$varType$` |returns `var`, `fn`, ` proc`, ` macro` or ` widget` which can be used with the <<.olink variables>> operator | |`$varType$` |returns `var`, `fn`, ` proc`, ` macro` or ` widget` which can be used with the <<.olink variables>> operator |
See: <<.mlink dumpvariables>>, <<.mlink search-variables>> or $:/AdvancedSearch

View File

@ -1,5 +1,5 @@
created: 20201020102735123 created: 20201020102735123
modified: 20230226135641976 modified: 20240501103205895
tags: [[Operator Examples]] [[format Operator]] tags: [[Operator Examples]] [[format Operator]]
title: format Operator (Examples) title: format Operator (Examples)
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -29,9 +29,12 @@ A JSON string formatted as JSON note how the JSON string is normalised to re
<<.tip "To create a string to save a [[title list|Title List]] into a list field, use `format:titlelist[]` with the [[join operator|join Operator]]">> <<.tip "To create a string to save a [[title list|Title List]] into a list field, use `format:titlelist[]` with the [[join operator|join Operator]]">>
<<.operator-example 8 """[tag[TableOfContents]format:titlelist[]join[ ]]""">> <<.operator-example 8 """[tag[TableOfContents]format:titlelist[]join[ ]]""">>
For example, to save titles tagged `TableOfContents` to the titles field of the tiddler [[format titlelist test]]:
A variable formatted as procedure definition. Also see: [[search-variables Macro]]
<<.operator-example 9 """[[.attr]format:variable[$type$ $name$($params$) $firstLine$]]""">>
For example, to save titles tagged `TableOfContents` to the titles field of the tiddler [[format titlelist test]]:
<$macrocall $name='wikitext-example-without-html' <$macrocall $name='wikitext-example-without-html'
src='<$button>Try it src='<$button>Try it
<$action-setfield $tiddler="format titlelist test" titles={{{ [tag[TableOfContents]format:titlelist[]join[ ]] }}}/> <$action-setfield $tiddler="format titlelist test" text={{{ [tag[TableOfContents]format:titlelist[]join[ ]] }}}/>
</$button>'/> </$button>'/>

View File

@ -1,6 +1,6 @@
caption: variables caption: variables
created: 20190330100101453 created: 20190330100101453
modified: 20240429134329720 modified: 20240501101748198
op-input: ignored op-input: ignored
op-output: the names of all the actively defined variables op-output: the names of all the actively defined variables
op-parameter: <<.from-version "5.3.4">> whitespace separated list of variable-types op-parameter: <<.from-version "5.3.4">> whitespace separated list of variable-types
@ -18,14 +18,14 @@ type: text/vnd.tiddlywiki
''Possible Suffixes: <<.place S>>:'' <<.from-version "5.3.4">> ''Possible Suffixes: <<.place S>>:'' <<.from-version "5.3.4">>
* ''sort'' (default): By default the returned list is alphabetically sorted * ''alphabetical'' (default): By default the returned list is alphabetically sorted
* ''raw'': The variable list will be returned as created. The variables "near" the filter run will show up first. So if variables are defined in the tiddler, where the <<.mlink dumpvariables>> or <<.mlink search-variables>> macros are executed, they will be listed first. * ''raw'': The variable list will be returned as created. The variables "near" the filter run will show up first. So if variables are defined in the tiddler, where the <<.mlink dumpvariables>> or <<.mlink search-variables>> macros are executed, they will be listed first.
''Parameters <<.place T>>:'' <<.from-version "5.3.4">> ''Parameters <<.place T>>:'' <<.from-version "5.3.4">>
The parameters <<.place T>> allow a "whitespace separated" list of variable codes that should be listed The parameters <<.place T>> allow a ''whitespace separated list'' of variable codes that should be listed
* Default is `all` - `fn, var, proc, macro, widget` * Default is `all` or `fn, var, proc, macro, widget`
* ''all'' ... If set it takes precedence and will show all variables * ''all'' ... If set it takes precedence and will show all variables
* ''fn'' ... Will only show variables defined as functions eg: `\function test-01()` * ''fn'' ... Will only show variables defined as functions eg: `\function test-01()`

View File

@ -1,6 +1,6 @@
caption: dumpvariables caption: dumpvariables
created: 20140908104107181 created: 20140908104107181
modified: 20240427121039507 modified: 20240501101941520
tags: Macros [[Core Macros]] tags: Macros [[Core Macros]]
title: dumpvariables Macro title: dumpvariables Macro
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -28,6 +28,6 @@ The following parameters are <<.from-version "5.3.4">>
; format ; format
: Format the output string using the VariableFormat. Defaults to `$type$ $name$($params$) $firstLine$`. : Format the output string using the VariableFormat. Defaults to `$type$ $name$($params$) $firstLine$`.
!!! <<.macro-examples "dumpvariables">>
Also see: [[search-variables Macro]] Also see: [[search-variables Macro]]
!!! <<.macro-examples "dumpvariables">>

View File

@ -1,6 +1,6 @@
caption: search-variables caption: search-variables
created: 20240427120451313 created: 20240427120451313
modified: 20240427123016441 modified: 20240501101929800
tags: Macros [[Core Macros]] tags: Macros [[Core Macros]]
title: search-variables Macro title: search-variables Macro
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -29,6 +29,6 @@ It is useful for debugging and exploring ~TiddlyWiki's internals.
; format ; format
: Format the output string using the VariableFormat. Defaults to `$type$ $name$($params$) $firstLine$`. : Format the output string using the VariableFormat. Defaults to `$type$ $name$($params$) $firstLine$`.
!!! <<.macro-examples "search-variables">>
Also see: [[dumpvariables Macro]] Also see: [[dumpvariables Macro]]
!!! <<.macro-examples "search-variables">>