mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-15 12:40:28 +00:00
d5f72cb282
* Add action-setmultiplefields and setmultiplevariables, and extend action-sendmessage * Add getfield operator * Remove getfield operator See discussion at https://github.com/Jermolene/TiddlyWiki5/pull/6130#issuecomment-949911439 * Add docs * Adjust whitespace * Add support for assigning multiple indexes to action-setmultiplefields
34 lines
1.2 KiB
Plaintext
34 lines
1.2 KiB
Plaintext
caption: setmultiplevariables
|
|
created: 20211023162409163
|
|
modified: 20211023162409163
|
|
tags: Widgets
|
|
title: SetMultipleVariablesWidget
|
|
type: text/vnd.tiddlywiki
|
|
|
|
! Introduction
|
|
|
|
The setmultiplevariables widget assigns values to multiple [[variables|Variables]] where the names and values of the variables are specified as separate filter.
|
|
|
|
! Content and Attributes
|
|
|
|
The content of the `<$setmultiplevariables>` widget is the scope for the value assigned to the variable.
|
|
|
|
|!Attribute |!Description |
|
|
|$names |Filter evaluating to the names of a list of variables to assign |
|
|
|$values |Filter evaluating to the values corresponding to the list of names specified in `$names` |
|
|
|
|
! Examples
|
|
|
|
Here is an example of a convoluted way to display the values of the fields of the tiddler "HelloThere":
|
|
|
|
<$macrocall $name='wikitext-example-without-html'
|
|
src="""<$setmultiplevariables $names="[[HelloThere]fields[]addprefix[demo-]]" $values="[[HelloThere]fields[]] :map[[HelloThere]get<currentTiddler>]">
|
|
<ol>
|
|
<$list filter="[variables[]prefix[demo-]sort[]]">
|
|
<li>
|
|
''<$text text={{{ [<currentTiddler>removeprefix[demo-]] }}}/>'': <$text text={{{ [<currentTiddler>getvariable[]] }}}/>
|
|
</li>
|
|
</$list>
|
|
</ol>
|
|
</$setmultiplevariables>"""/>
|