Hi Tony!
 Yes, I think I just focused on the cycle and no the whole snippets. I like
your approach.
I myself have the simple solution!

Thank you

--Mohammad



On Mon, Dec 14, 2020 at 10:39 AM TW Tones <[email protected]> wrote:

> Mohammad,
>
> 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]]
> ```
>
> Regards
> Tony
> On Sunday, 13 December 2020 at 17:34:52 UTC+11 Mohammad wrote:
>
>> *Feature in Tiddlywiki 5.1.23*
>>
>> TW 5.123 has a new filter operator called cycle
>>
>> https://tiddlywiki.com/prerelease/#cycle%20Operator
>>
>> Using this filter operator it is simple to build a button to cycle in
>> your color palettes!
>>
>> See the how to in new *Show and tell* page of GitHub Discussion board.
>>
>> https://github.com/Jermolene/TiddlyWiki5/discussions/5271
>>
>> --Mohammad
>>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/741947d1-9964-4be4-bdcf-311721a4b7aan%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/741947d1-9964-4be4-bdcf-311721a4b7aan%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMAw2WiNQaoxPAREepwgVvjsYruf9jU07ZPvJUfRtE2whA%40mail.gmail.com.

Reply via email to