Thats interesting;
I have recently observed the key difference between macros which can be used in wikitext, setting variables and in filters and widgets, is as a rule a widget is at the end of the process, that is it results are displayed and you can do no more with it, although it may show buttons etc… which do perform functions you just can’t use a widget as a variable, a macro you can.
However the above works nicely and there is not much value to setting its output to a variable (perhaps I will make a macro for this?)
However in keeping with the widget perspective I was already onto one that makes use of the ability to pass arbitrary Parmeter names with all sorts of ways to determine the value, when using widgets. So any thing you can turn into a parameter value you can view the result.
- Note this widget has a default condition that only displays if $:/config/design-mode=yes.
\widget $show.params()
<$parameters condition="[{$:/config/design-mode}match[yes]]" list-all="yes" $params="@params">
<$setmultiplevariables $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]">
<$list filter=<<condition>> variable=~>
<$list filter="[<list-all>match[yes]]" variable=~>
<$list filter="[<@params>jsonindexes[]] -[[condition]] -[[list-all]]" variable=parameter>
<$text text=<<parameter>>/> = <$text text={{{ [<parameter>getvariable[]] }}}/>,
</$list>
</$list>
<$slot $name="ts-raw"/>
</$list>
</$setmultiplevariables>
</$parameters>
<!--
notes: The parameter can be any name that helps explain the value of the parameter.
Using filtered transclusions `{{{ filter }}}` or Substituted Attribute Values (using backticks) only return the first value by default.
Use `+[join[]]` or `+[format:title[cases[]join[ ]]` as needed
The condition defaults to `[{$:/config/design-mode}match[yes]]`
The content of the widget can contain wikitext and tiddlytwiki script that makes use of the variables generated from the parameter names.
If the list-all parameter is not yes (default), then the parameter/values will not be listed.
-->
\end $show.params
for example
;show.params
# <$show.params system-object={{!!system-object}}/>
# <$show.params system-object={{!!system-object}} condition="true"/>
# <$show.params tag-table-of-contrents=`${ [tag[TableOfContents]join[, ]] }$`/>
<hr>
<$show.params system-object={{!!system-object}} test="CodaCoder" >
Hi, <$text text=<<test>>/> system-object=<<system-object>>
</$show.params>
- note any number of parameter values can be used