I was looking at the filter you used and notice a shorter form for [[$:/palette]get[text] is {$:/palette}
<$button actions=<<cycle-palettes>> >
<$text text={{{ [{$:/palette}removeprefix[$:/palettes/]] }}}/>
</$button>
However this made me ask do we have the ability to have replaceable parameters in filters for common actions?
- This is off topic from your post but I had an interesting thought.
So consider this
\define cycle-palettes()
<$set name=pals filter="[all[tiddlers+shadows]tag[$:/tags/Palette]]">
<$action-listops $tiddler="$:/palette" $field="text" $subfilter="+[cycle<pals>]"/>
</$set>
\end
\define act(palette-name:"{{{ [{$:/palette}removeprefix[$:/palettes/]] }}}")
<$button actions=<<cycle-palettes>> >
<$text text=$palette-name$/>
</$button>
\end
<<act>>
Explanation
- Above here I simplify the button title by defining it with a parameter, unfortunately there is no short form to insist it be text
- ultimately this is not shorter because of the overhead, but if
$palette-name$ could be defined once and used in many places it would be useful
- but that is not how parameters are
- Using templates however we can make this simpler, see below, but it would be nice if we could have "global" $substitutions$ or similar?
\define cycle-palettes()
<$set name=pals filter={{palettes⒡}}>
<$action-listops $tiddler="$:/palette" $field="text" $subfilter="+[cycle<pals>]"/>
</$set>
\end
<$button actions=<<cycle-palettes>> >
{{<palette-name>}}
</$button>
;Now the tiddler "<palette-name>" contains the following
```
<$text text={{{ [{$:/palette}removeprefix[$:/palettes/]] }}}/>
```
;Now the tiddler "palettes⒡" contains the following
:yes I am using a special unicode character here
```
[all[tiddlers+shadows]tag[$:/tags/Palette]]
```