{"tiddlers": {
"$:/plugins/yaisog/tagstree-filter/history": {
    "created": "20230202183828340",
    "text": "| ''0.9.0'' | 2023-01-25 |initial release as a plugin |\n",
    "title": "$:/plugins/yaisog/tagstree-filter/history",
    "modified": "20230202184117344",
    "tags": "",
    "type": "text/vnd.tiddlywiki"
},

"$:/plugins/yaisog/tagstree-filter/license": {
    "created": "20230202183828341",
    "text": "Distributed under an MIT license.\n\nCopyright (c) 2022 [[Yaisog Bonegnasher|https://github.com/yaisog]]\n\n<<<\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n<<<",
    "title": "$:/plugins/yaisog/tagstree-filter/license",
    "modified": "20230202184111327",
    "tags": "",
    "type": "text/vnd.tiddlywiki"
},

"$:/plugins/yaisog/tagstree-filter/readme": {
    "created": "20230202183828342",
    "text": "|!purpose |select all ancestors of the input tiddlers recursively |\n|!input |a selection of titles |\n|!parameter |ignored |\n|!output |all ancestors of the input tiddlers, recursively |\n\n\nThe `tagstree` filter operator is used to select all ancestors of the input tiddlers. Ancestors are all tiddlers that are tags of the input tiddlers (i.e. their //parents//), all tiddlers that are tags of the //parents// (i.e. their //grandparents//), and so forth.\n\nIt would be equivalent to using an infinite subfilter like\n\n```\n[tags[]] [tags[]tags[]] [tags[]tags[]tags[]] ...\n```\nThe first run will return all parents, the second run all grandparents, the third run all great-grandparents, ...<br>\nInfinite (or recursive) filters cannot be defined in ~TiddlyWiki, however.\n\nThe `tagstree` operator contains a filter to avoid infinite loops.\n\nIts companion filter, `taggingtree`, selects all //descendants// of the input titles.\n\n!! Examples\n!!! Filtering search results\nTogether with the [[taggingtree|$:/plugins/yaisog/taggingtree-filter]] operator, `tagstree` can be used to filter search results by tag, where only the tags that are actual ancestors of the search result tiddlers are presented for selection, instead of //all// tags in the wiki. The search result is then intersected with the list of descendants of the selected filter tag in order to only show results that are also descendants of that tag.\n\n```\n<$set name=\"searchResults\" filter=<some filtering operation> >\n\t<$select tiddler=\"$:/temp/search-select\" default=\"all tags\">\n\t\t<option value=\"all tags\">all tags</option>\n\t\t<$list filter=\"[enlist<searchResults>tagstree[]]\">\n\t\t\t<option value=<<currentTiddler>>><<currentTiddler>></option>\n\t\t</$list>\n\t</$select>\n\n\t<$set name=\"tagFilter\" filter=\"[{$:/temp/search-select}match[all tags]]\" value=\"[all[]]\" emptyValue=\"[all[]] :intersection[{$:/temp/search-select}taggingtree[]]\">\n\t\t<$list filter=\"[enlist<searchResults>subfilter<tagFilter>]\" template=\"$:/core/ui/ListItemTemplate\" />\n\t</$set> <!-- tagFilter -->\n</$set> <!-- searchResults -->\n```\n",
    "title": "$:/plugins/yaisog/tagstree-filter/readme",
    "modified": "20230202184615066",
    "tags": "",
    "type": "text/vnd.tiddlywiki"
},

"$:/plugins/yaisog/modules/filters/tagstree.js": {
    "created": "20230202142105961",
    "text": "/*\\\ntitle: $:/plugins/yaisog/modules/filters/tagstree.js\ntype: application/javascript\nmodule-type: filteroperator\n\nAdds a filter to select all ancestors of the input tiddlers.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\ncode adapted from $:/core/modules/filters/tags.js\n*/\nexports.tagstree = function(source,operator,options) {\n\tvar tags = {};\n\tsource(function(tiddler,title) {\n\t\t// start the recursion for this title\n\t\tgetTagsRecursively(tiddler,tags);\n\t});\n\treturn Object.keys(tags);\n};\n\t\nfunction getTagsRecursively(tiddler,tags) {\n\tvar intermediate = [],\n\t\t\tt, length;\n\t// get the tags\n\tif(tiddler && tiddler.fields.tags) {\n\t\t$tw.utils.pushTop(intermediate, tiddler.fields.tags);\n\t}\n\t// remove any that are already in the tags object to avoid loops\n\tif(intermediate.length !== 0) {\n\t\tif(Object.keys(tags).length !== 0) {\n\t\t\tfor(t=intermediate.length-1; t>=0; t--) {\n\t\t\t\tif(tags[intermediate[t]] === true) {\n\t\t\t\t\tintermediate.splice(t,1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// add to result object\n\t\tfor(t=0, length=intermediate.length; t<length; t++) {\n\t\t\ttags[intermediate[t]] = true;\n\t\t}\n\t\t// recurse\n\t\tintermediate.forEach(function(title) {\n\t\t\tgetTagsRecursively($tw.wiki.getTiddler(title),tags);\n\t\t});\n\t}\n\treturn;\n}\n\n})();",
    "tags": "",
    "title": "$:/plugins/yaisog/modules/filters/tagstree.js",
    "modified": "20230202142341142",
    "type": "application/javascript",
    "module-type": "filteroperator"
}}
}