The simple and short solution to change tags

56 views
Skip to first unread message

Mohammad

unread,
Jul 29, 2018, 3:28:26 PM7/29/18
to TiddlyWiki
Assume you have 10 tiddlers like
tid-A
tid
-B
tid
-C
...
...



all tagged with mytag. Now assume only one of them can have the second tag theme. To apply the second tag, assume a select widget can be used!
What is the simple and short solution to apply the second tag?

Note that each time you select a tiddler to be tagged with second tag e.g. theme


Mohammad

Mark S.

unread,
Jul 29, 2018, 4:34:38 PM7/29/18
to TiddlyWiki
Simple and short solutions usually depend on a cheat. My cheat here is that I assume that these tiddlers will never have any tag value other than "theme" and "mytag". This way I don't have to get out the field mangler and delete tags -- I just reset to either "mytag" or "mytag theme".

\define act_change()
<$list filter="[tag[mytag]tag[theme]]">
<$action-setfield tags="[[mytag]]" />
</$list>
<$action-setfield $tiddler={{changeme}} tags="mytag theme"/
>
\end
<$select tiddler="changeme" actions=<<act_change>>>
<$list filter="[tag[mytag]]">
<option value=<<currentTiddler>>><$view field="title"/></option>
</$list>
</
$select>

I imagine now someone is going to show up and demonstrate how to do this in one line ;-)

-- Mark

Mohammad

unread,
Jul 29, 2018, 4:38:07 PM7/29/18
to TiddlyWiki
Brilliant.
Thank you Mark.
Reply all
Reply to author
Forward
0 new messages