From a3dc3b4b98f424d12019550df52639224100316f Mon Sep 17 00:00:00 2001 From: Jermolene Date: Mon, 28 Nov 2016 19:04:04 +0000 Subject: [PATCH] Add new [all[tags]] filter operator --- core/modules/filters/all/tags.js | 22 ++++++++++++++++++++++ editions/tw5.com/tiddlers/filters/all.tid | 13 +++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 core/modules/filters/all/tags.js diff --git a/core/modules/filters/all/tags.js b/core/modules/filters/all/tags.js new file mode 100644 index 000000000..2aaa9dec2 --- /dev/null +++ b/core/modules/filters/all/tags.js @@ -0,0 +1,22 @@ +/*\ +title: $:/core/modules/filters/all/tags.js +type: application/javascript +module-type: allfilteroperator + +Filter function for [all[tags]] + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +/* +Export our filter function +*/ +exports.tags = function(source,prefix,options) { + return Object.keys(options.wiki.getTagMap()); +}; + +})(); diff --git a/editions/tw5.com/tiddlers/filters/all.tid b/editions/tw5.com/tiddlers/filters/all.tid index f74f7f1f1..980ebb2ea 100644 --- a/editions/tw5.com/tiddlers/filters/all.tid +++ b/editions/tw5.com/tiddlers/filters/all.tid @@ -1,13 +1,13 @@ +caption: all created: 20140410103123179 -modified: 20150220160957000 +modified: 20161128185445034 +op-input: ignored, unless the parameter is empty +op-output: the titles that belong to all the specified categories +op-parameter: zero or more categories +op-purpose: find all titles of a fundamental category tags: [[Filter Operators]] [[Common Operators]] [[Selection Constructors]] title: all Operator type: text/vnd.tiddlywiki -caption: all -op-purpose: find all titles of a fundamental category -op-input: ignored, unless the parameter is empty -op-parameter: zero or more categories -op-output: the titles that belong to all the specified categories The parameter specifies zero or more fundamental categories using the following syntax: @@ -21,6 +21,7 @@ The parameter specifies zero or more fundamental categories using the following |^`orphans` |all tiddlers to which there are <<.em no>> hard links |^by title | |^`shadows` |all the [[shadow tiddlers|ShadowTiddlers]] that exist, including any that have been overridden with non-shadow tiddlers |^no | |^`tiddlers` |all the non-shadow tiddlers that exist |no | +|^`tags` |all the tags in use on non-shadow tiddlers |no | If the parameter specifies more than one category, they are processed from left to right. The overall output is initially empty, and each category's output is [[dominantly appended|Dominant Append]] to it in turn. Unrecognised categories contribute nothing to the output.