All
The listViaContains macro shown in an previous post does not identify exact matches.
The xMatchTags macro listed below does return exact matches. It uses the "contain and
"count" macros from Tobias Beer.
My thanks to Tobias and the folks that kindly responded to my question.
Steve Wharton
```
\define xMatchTags(inputTiddler)
<!-- Create a comma separated list of tiddlers whose tags
are an EXACT match of the the tags for the inputTiddler.
Features:
* list all of the tag combinations and the list of tidders per
combination without having to enumerate each combination
in advance;
* tag matches are exact.
A tidder is an exact match if:
1. it has all of the tags that the refTiddler has; and
2. it has the same number of tags that the refTiddler
Note: the second check is necessary to eliminate tiddlers that
have a SUPERSET of the reference tags. For example refTags
(music, genre) would match Blues (tagged: music, genre) and
aboutBlues (tagged: music, genre, description).
Example:
* <<xMatchTags "blues">>
* list all of the tiddlers that have the same tags (e.g., music, genre) as "blues"
* Returns: afroPop, altCountry, alternative, bluegrass, blues, ... singerSongwriter,
------------------------------------------------------------------------------------
Many thanks to Tobias Beer who developed the "contains" and
"count" macros used below. See
http://tobibeer.github.io/tw5-plugins/ ------------------------------------------------------------------------------------
-->
<!-- Make a "copy" of the input tiddler, its tags and its number of tags.
-->
<$set name="refTiddler" value="""$inputTiddler$""">
<$set name="refTagList" filter="[<refTiddler>tags[]sort[]]">
<$set name="refTagCount" filter="[<refTiddler>tags[]count[]]">
<!-- First Filter: Find tiddlers that contain ALL of the tags in refTagList.
Second Filter: Find tiddlers that have the refTagCount number of tags.
-->
<$list filter="[contains:tags $all<refTagList>] +[sort[title]]" variable="nextMatchingTiddler">
<$list filter="[<nextMatchingTiddler>tags[]count<refTagCount>]">
<$link to=<<nextMatchingTiddler>> ><<nextMatchingTiddler>></$link>,
</$list>
</$list>
</$set></$set></$set>
\end
```