Skip to content

Commit

Permalink
fix: add in-tagtree-of for FileSystemPaths
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Apr 17, 2024
1 parent 462be81 commit 1f0149c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
16 changes: 16 additions & 0 deletions tiddlers/$__plugins_linonetwo_in-tagtree-of.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"author": "LinOnetwo",
"core-version": ">=5.1.22",
"dependents": "",
"description": "Finds out where a tiddler originates from, is it in a tag tree with xxx as root?",
"list": "readme",
"plugin-type": "plugin",
"text": "{\"tiddlers\":{\"$:/plugins/linonetwo/in-tagtree-of/readme\":{\"title\":\"$:/plugins/linonetwo/in-tagtree-of/readme\",\"creator\":\"LinOnetwo\",\"type\":\"text/vnd.tiddlywiki\",\"text\":\"A very fast version of `kin::to[xxx]`.\\n\\n> Finds out where a tiddler originates from, is it in a tag tree with xxx as root?\\n\\n!! Usage\\n\\nSee [[demo site|https://tiddly-gittly.github.io/in-tagtree-of/]] for interactive examples.\\n\\n!!! Normal usage\\n\\n`[[Ling]in-tagtree-of[Clancy]]` : check if `Ling` is ''in a tag tree'' with `Clancy` as root.\\n\\n`[all[tiddlers]!in-tagtree-of[Clancy]]` : with `!` prefix, get all tiddlers that are ''not'' in a tag tree with `Clancy` as root.\\n\\n!!! Advanced usage\\n\\n`[all[tiddlers]in-tagtree-of:inclusive[Clancy]]` : with `inclusive` suffix, get all tiddlers that are ''in a tag tree'' with `Clancy` as root, ''including `Clancy` himself''\\n\\n!!! With macro\\n\\n```tw5\\n<!-- for each child (in tagtree of current tiddler), remove out all that is not leaf, and get those is in new task state -->\\n\\\\define get-non-completed-leaf-tasks() [in-tagtree-of<currentTiddler>!filter<filter-is-not-leaf>filter<filter-is-new-task>]\\n\\n\\\\define caption() ToDos <$count filter=<<get-non-completed-leaf-tasks>> />\\n<$macrocall $name=aggregation caption=<<caption>> filter=<<get-non-completed-leaf-tasks>> defaultFields=\\\"title tags\\\" class=\\\"w-100\\\" state=\\\"ITKG-TaskDynamicTable-state\\\" />\\n```\\n\\n!! Difference from taggingtree\\n\\n[[taggingtree|https://talk.tiddlywiki.org/t/recursive-filter-operators-to-show-all-tiddlers-beneath-a-tag-and-all-tags-above-a-tiddler/3814]] is a [[Selection Constructors|https://tiddlywiki.com/#Selection%20Constructors]], thus can not be used in cascade or FileSystemPaths. See [[How to test filesystempath easily|https://talk.tiddlywiki.org/t/how-to-test-filesystempath-easily/6353]] for details.\"},\"$:/plugins/linonetwo/in-tagtree-of/index.js\":{\"creator\":\"LinOnetwo\",\"title\":\"$:/plugins/linonetwo/in-tagtree-of/index.js\",\"type\":\"application/javascript\",\"module-type\":\"filteroperator\",\"Modern.TiddlyDev#Origin\":\"index.ts\",\"text\":\"\\\"use strict\\\";function getTiddlersRecursively(e,i){const t=new Set($tw.wiki.getTiddlersWithTag(e));0<t.size&&(0<i.size&&(i.size<t.size?i.forEach(e=>{t.has(e)&&t[\\\"delete\\\"](e)}):t.forEach(e=>{i.has(e)&&t[\\\"delete\\\"](e)})),t.forEach(e=>i.add(e)),t.forEach(e=>{getTiddlersRecursively(e,i)}))}exports[\\\"in-tagtree-of\\\"]=function inTagTreeOfFilterOperator(e,i){var t;const r=i.operand;var s=\\\"inclusive\\\"===i.suffix,a=\\\"!\\\"===i.prefix;const l=new Set;let n;if(e((e,i)=>{l.add(i),void 0===n&&(n=e)}),1===l.size&&!a){var[d]=l;if(!0===(null==(t=null==(t=null==n?void 0:n.fields)?void 0:t.tags)?void 0:t.includes(r)))return[d];if(s&&d===r)return[d]}const o=$tw.wiki.getGlobalCache(\\\"in-tagtree-of-\\\"+r,()=>{var e=new Set;return getTiddlersRecursively(r,e),e});return s&&o.add(r),a?[...l].filter(e=>!o.has(e)):[...l].filter(e=>o.has(e))};\"}}}",
"title": "$:/plugins/linonetwo/in-tagtree-of",
"type": "application/json",
"version": "0.2.0",
"Modern.TiddlyDev#SHA256-Hashed": "2da9b66ac9b7fd8d4bfe5aa16a2ad40d7069e403027ccf090648584b467b183c",
"name": "in-tagtree-of"
}
]
3 changes: 0 additions & 3 deletions tiddlers/FileSystemPaths.tid

This file was deleted.

0 comments on commit 1f0149c

Please sign in to comment.