Batch match tags of tiddlers

30 views
Skip to first unread message

tw-novice

unread,
Feb 18, 2021, 2:55:22 PM2/18/21
to TiddlyWiki
Hello! I would like to know how to match the tags of a bunch of tiddlers with the tags in whichever tiddler is referenced in a specific field in each of those tiddlers. By matching I mean adding and removing tags to match the referenced tiddler.

I am sure that makes no sense! So here is an example of what I mean:

Suppose I have a wiki where there are several tiddlers with the field 'category', the value of the field refers to another tiddler that does not have a 'category' field.

 Eg Suppose there are 3 tiddlers titled "dog","cat","mouse" with the value of the 'category' field as 'animal' in each of those 3 tiddlers. And there is also a tiddler named "animal" which does not have a 'category' field.

Suppose there are another 2 tiddlers named "carrot","potato" with the value of the 'category' field as 'vegetable' in both of these tiddlers. And there is also a tiddler named "vegetable" which does not have a 'category' field.

I would like to create a button which, when pressed, it goes through all tiddlers in the wiki that have a 'category' field, copies the tags that are on the corresponding tiddler listed in the category field, and applies those tags to the current tiddler, also removing any tags that are in the current tiddler but are not in the corresponding tiddler listed in the category field.


For example, let's say that the tiddler "animal" has the tag "biology", and the tiddler "vegetable" has the tag "food", and the tiddler "carrot" has the tag "red".

When I press the button, the following should happen:
- the "biology" tag is added to the tiddlers titled "dog","cat","mouse"
- the "food" tag is added to the tiddlers titled "carrot","potato"
- the "red" tag is removed from the tiddler titled "carrot"
Reply all
Reply to author
Forward
0 new messages