Created
October 6, 2016 08:14
-
-
Save Jermolene/85d245a8d3aec60f660fc06920ad892e to your computer and use it in GitHub Desktop.
Experimental 'getlist' filter operator for TiddlyWiki5 - see https://github.com/Jermolene/TiddlyWiki5/issues/2598
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*\ | |
title: $:/core/modules/filters/getlist.js | |
type: application/javascript | |
module-type: filteroperator | |
Filter operator returning the tiddlers whose titles are listed in the specified list fields of the selected tiddlers | |
\*/ | |
(function(){ | |
/*jslint node: true, browser: true */ | |
/*global $tw: false */ | |
"use strict"; | |
/* | |
Export our filter function | |
*/ | |
exports.getlist = function(source,operator,options) { | |
var result = [], | |
fieldName = operator.suffix || "list"; | |
source(function(tiddler,title) { | |
$tw.utils.pushTop(result,$tw.utils.parseStringArray(tiddler.getFieldString(fieldName) || "")); | |
}); | |
return result; | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment