How to create a single button to sequentially remove and add a tag to a certain tidlder

If we can assume that, intially, either tiddler1 or tiddler2 (but not both) is already tagged with tagA, then the following button will switch the tags between the two tiddlers:

<$button> toggle tags
   <$action-listops $tiddler="tiddler1" $tags="+[toggle[tagA]]"/>
   <$action-listops $tiddler="tiddler2" $tags="+[toggle[tagA]]"/>
</$button>
  • If tiddler1 or tiddler2 does not yet exist, then clicking the button will create the tiddler and tag it with tagA.
  • If both tiddlers exist, but neither tiddler has tagA, then clicking the button will add tagA to both tiddlers.
  • Similarly, if both tiddlers already have tagA, then clicking the button will remove tagA from both tiddlers.