1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-24 22:33:16 +00:00

Extend the enlist operator to optionally not de-duplicate

This commit is contained in:
Jeremy Ruston 2019-06-10 17:54:46 +01:00
parent 37bb75f0cf
commit 18fe112da7
3 changed files with 17 additions and 4 deletions

View File

@ -16,7 +16,16 @@ Filter operator returning its operand parsed as a list
Export our filter function
*/
exports.enlist = function(source,operator,options) {
var list = $tw.utils.parseStringArray(operator.operand);
var allowDuplicates = false;
switch(operator.suffix) {
case "raw":
allowDuplicates = true;
break;
case "dedupe":
allowDuplicates = false;
break;
}
var list = $tw.utils.parseStringArray(operator.operand,allowDuplicates);
if(operator.prefix === "!") {
var results = [];
source(function(tiddler,title) {

View File

@ -1,6 +1,6 @@
caption: enlist
created: 20170221144241063
modified: 20170221151340420
modified: 20190610165246154
op-input: ignored
op-neg-input: a [[selection of titles|Title Selection]]
op-neg-output: those input titles that are <<.em not>> listed in <<.place L>>
@ -8,6 +8,8 @@ op-output: the titles stored as a [[title list|Title List]] at <<.place L>>
op-parameter: a [[title list|Title List]]
op-parameter-name: L
op-purpose: select titles from the operand interpreted as a [[title list|Title List]]
op-suffix: <<.from-version "5.1.20">> `dedupe` (the default) to remove duplicates, `raw` to leave duplicates untouched
op-suffix-name: D
tags: [[Filter Operators]] [[Field Operators]] [[Selection Constructors]] [[Negatable Operators]]
title: enlist Operator
type: text/vnd.tiddlywiki

View File

@ -1,8 +1,10 @@
created: 20170221144328467
modified: 20170221151620898
modified: 20190610165309565
tags: [[enlist Operator]] [[Operator Examples]]
title: enlist Operator (Examples)
type: text/vnd.tiddlywiki
<<.operator-example 1 "[enlist[one two three]addsuffix[!]]">>
<<.operator-example 2 "[enlist{$:/StoryList!!list}]">>
<<.operator-example 2 "[enlist[one one one]]">>
<<.operator-example 3 "[enlist:raw[one one one]]">>
<<.operator-example 4 "[enlist{$:/StoryList!!list}]">>