Skip to content

Commit 8fbd8e4

Browse files
committed
Transform to plugin, add missing image, update readme
Previously a pull request was opened to merge this filter to the core, but eventually it became a separate plugin, so I had to reorganize directory structure. NOTE: Examples not work because the tiddlers missing. TiddlyWiki/TiddlyWiki5#3511
1 parent 46214b4 commit 8fbd8e4

17 files changed

+140
-67
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.idea
2+
/*.iml
3+
**/$__StoryList.tid

README.adoc

+10-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
For details, see the link:{demo-page}[demo page].
77

8+
* https://gitlab.com/bimlas/tw5-kin-filter (official repository)
9+
* https://github.com/bimlas/tw5-kin-filter (mirror, please give a star if you like it)
10+
811
== How to install?
912

1013
=== Drag-n-drop
@@ -18,20 +21,22 @@ For details, see the link:{demo-page}[demo page].
1821
loaded)
1922
- Drag-n-drop the file in to your wiki
2023

21-
== How to use in Node version of TiddlyWiki
22-
23-
=== TiddlyWiki installed via NPM
24+
=== Copy to directory based (Node.js) wiki
2425

2526
- Clone or download this repository
26-
- Run `tiddlywiki --listen` in the root of this repository
27-
- Open `localhost:8080` in your browser
27+
- Copy the `plugins` directory to the root directory of your wiki
2828

2929
== Development
3030

3131
=== Running tests
3232

3333
----
3434
$ cd ROOT_OF_THIS_REPO
35+
36+
# Unix-like system
3537
$ export TIDDLYWIKI_PLUGIN_PATH=./plugins
38+
# Windows
39+
$ set TIDDLYWIKI_PLUGIN_PATH=./plugins
40+
3641
$ tiddlywiki test
3742
----

editions/test/tiddlers/HelloThere.tid

-5
This file was deleted.

editions/tw5.com/tiddlers/filters/kin.tid

-40
This file was deleted.

plugins/kin-filter/README/concept.svg

+1
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tags: picture
2+
title: $:/plugins/bimlas/kin-filter/README/concept.svg
3+
type: image/svg+xml

editions/tw5.com/tiddlers/filters/examples/kin.tid plugins/kin-filter/README/examples.tid

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
created: 20181026114434874
2-
modified: 20181108070317997
3-
tags: [[Operator Examples]] [[kin Operator]]
4-
title: kin Operator (Examples)
1+
title: $:/plugins/bimlas/kin-filter/README/examples
52
type: text/vnd.tiddlywiki
63

74
\define item-class(highlightfilter) <$list filter="""[$highlightfilter$is[current]first[]]""">highlighted-toc-item</$list>

plugins/kin-filter/README/syntax.tid

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
title: $:/plugins/bimlas/kin-filter/README/syntax
2+
type: text/vnd.tiddlywiki
3+
4+
! Kin filter operator
5+
6+
* https://gitlab.com/bimlas/kin-filter (official repository)
7+
* https://github.com/bimlas/kin-filter (mirror, please give a star if you like it)
8+
9+
The purpose of the ''kin'' operator with examples:
10+
11+
* Finds out where base tiddler originates and what other elements originate from it
12+
* Finds the ancestors and successors of a family member
13+
* Finds the "leaves" of the branch of the base tiddler in a tree-like structure (where the base tiddler is a leaf)
14+
* Finds the super- and subsets / groups of a mathematical set (where the base tiddler is a set)
15+
16+
[img[$:/plugins/bimlas/kin-filter/README/concept.svg]]
17+
18+
|''input''|a [[selection of titles|https://tiddlywiki.com/#Title%20Selection]]|
19+
|''suffix''|the ''kin'' operator uses a rich suffix, see below for details|
20+
|''parameter''|''B'' base tiddler title or nothing|
21+
|''output''|''with parameter B''<br>&raquo; those input titles which are ''kin with B'' <br>''without B''<br>&raquo; ''all'' tiddler titles which are ''kin with input titles'' (treat input titles as base tiddlers)|
22+
|''`!` output''|''with parameter B''<br>&raquo; those input titles which are ''//NOT// kin with B''<br>''without parameter B''<br>&raquo; ignored|
23+
24+
The ''kin'' operator uses an extended syntax that permits multiple fields and flags to be passed:
25+
26+
```
27+
[kin:<field>:<direction>:<depth>[<operand>]]
28+
```
29+
30+
* ''field'': name of the [[field|https://tiddlywiki.com/#TiddlerFields]] which connecting tiddlers (assumed to be a [[title list|https://tiddlywiki.com/#Title%20List]], defaulting to `tags`)
31+
* ''direction'': collect the tiddler titles in this direction relative to the base tiddler
32+
** ''from'': collect kins of base tiddler pointing from it (including the base tiddler title itself)
33+
** ''to'': collect kins of base tiddler pointing to it (including the base tiddler title itself)
34+
** ''with'': (the default) union of the aboves
35+
* ''depth'': maximum depth of the collected labels in the tree structure relative to the base tiddler (a positive number, not limited by default)
36+
* ''operand'': filter operand, the base tiddler
37+
38+
''kin'' is a [[modifier|https://tiddlywiki.com/#Selection%20Constructors]], but without ''B'' parameter is a [[constructor|https://tiddlywiki.com/#Selection%20Constructors]].

core/modules/filters/kin.js plugins/kin-filter/kin.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*\
2-
title: $:/core/modules/filters/kin.js
2+
title: $:/plugins/bimlas/kin-filter/kin.js
33
type: application/javascript
44
module-type: filteroperator
55
@@ -12,17 +12,6 @@ Finds out where a tiddler originates from and what other tiddlers originate from
1212
/*global $tw: true */
1313
"use strict";
1414

15-
function getObjectKeysByExpression(object,callback) {
16-
var key,
17-
results = [];
18-
for (key in object) {
19-
if (object.hasOwnProperty(key) && callback(object[key])) {
20-
results.push(key);
21-
}
22-
}
23-
return results;
24-
};
25-
2615
function collectTitlesRecursively(baseTiddler,baseTitle,options) {
2716
var cacheName = "kin-filter-" + baseTitle + "-" + options.fieldName + "-",
2817
titlesPointingFromBase = {},
@@ -58,6 +47,17 @@ Finds out where a tiddler originates from and what other tiddlers originate from
5847
}
5948
}
6049

50+
function getObjectKeysByExpression(object,callback) {
51+
var key,
52+
results = [];
53+
for (key in object) {
54+
if (object.hasOwnProperty(key) && callback(object[key])) {
55+
results.push(key);
56+
}
57+
}
58+
return results;
59+
}
60+
6161
function getResultsInGivenDepth(cachedData) {
6262
if(options.depth) {
6363
return getObjectKeysByExpression(cachedData,function(value) {

plugins/kin-filter/plugin.info

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"title": "$:/plugins/bimlas/kin-filter",
3+
"description": "Kin filter: Recursively looking for kinship between tiddler titles",
4+
"author": "bimlas",
5+
"version": "1.0.0",
6+
"core-version": ">=5.1.18",
7+
"source": "https://gitlab.com/bimlas/tw5-kin-filter",
8+
"plugin-type": "plugin",
9+
"list": "README/syntax README/examples"
10+
}
File renamed without changes.

test/tiddlers/HelloThere.tid

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
title: HelloThere
2+
3+
This is the plugin's browser-based test runner (running on TiddlyWiki <<version>>). See the bottom of this page for the test results.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
title: $:/SiteTitle
22

3-
TiddlyWiki5
3+
Plugin test
File renamed without changes.

tiddlywiki.info

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"description": "Basic client-server edition",
3+
"plugins": [
4+
"tiddlywiki/tiddlyweb",
5+
"tiddlywiki/filesystem",
6+
"tiddlywiki/highlight"
7+
],
8+
"themes": [
9+
"tiddlywiki/vanilla",
10+
"tiddlywiki/snowwhite"
11+
],
12+
"build": {
13+
"index": [
14+
"--rendertiddler",
15+
"$:/plugins/tiddlywiki/tiddlyweb/save/offline",
16+
"index.html",
17+
"text/plain"
18+
],
19+
"externalimages": [
20+
"--savetiddlers",
21+
"[is[image]]",
22+
"images",
23+
"--setfield",
24+
"[is[image]]",
25+
"_canonical_uri",
26+
"$:/core/templates/canonical-uri-external-image",
27+
"text/plain",
28+
"--setfield",
29+
"[is[image]]",
30+
"text",
31+
"",
32+
"text/plain",
33+
"--rendertiddler",
34+
"$:/plugins/tiddlywiki/tiddlyweb/save/offline",
35+
"externalimages.html",
36+
"text/plain"
37+
],
38+
"static": [
39+
"--rendertiddler",
40+
"$:/core/templates/static.template.html",
41+
"static.html",
42+
"text/plain",
43+
"--rendertiddler",
44+
"$:/core/templates/alltiddlers.template.html",
45+
"alltiddlers.html",
46+
"text/plain",
47+
"--rendertiddlers",
48+
"[!is[system]]",
49+
"$:/core/templates/static.tiddler.html",
50+
"static",
51+
"text/plain",
52+
"--rendertiddler",
53+
"$:/core/templates/static.template.css",
54+
"static/static.css",
55+
"text/plain"
56+
]
57+
}
58+
}

0 commit comments

Comments
 (0)