kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Extend list filter operator to take a text reference
Instead of just a title. Means that we can apply the list operator to fields other than the list field.print-window-tiddler
rodzic
e6843aabff
commit
0b3efe179e
|
@ -17,7 +17,8 @@ Export our filter function
|
|||
*/
|
||||
exports.list = function(source,operator,options) {
|
||||
var results = [],
|
||||
list = options.wiki.getTiddlerList(operator.operand);
|
||||
tr = $tw.utils.parseTextReference(operator.operand),
|
||||
list = $tw.wiki.getTiddlerList(tr.title,tr.field,tr.index);
|
||||
function checkTiddler(title) {
|
||||
var match = list.indexOf(title) !== -1;
|
||||
if(operator.prefix === "!") {
|
||||
|
|
|
@ -611,10 +611,14 @@ exports.setTiddlerData = function(title,data) {
|
|||
/*
|
||||
Return the content of a tiddler as an array containing each line
|
||||
*/
|
||||
exports.getTiddlerList = function(title) {
|
||||
exports.getTiddlerList = function(title,field,index) {
|
||||
if(index) {
|
||||
return $tw.utils.parseStringArray(this.extractTiddlerDataItem(title,index,""));
|
||||
}
|
||||
field = field || "list";
|
||||
var tiddler = this.getTiddler(title);
|
||||
if(tiddler && $tw.utils.isArray(tiddler.fields.list)) {
|
||||
return tiddler.fields.list.slice(0);
|
||||
if(tiddler) {
|
||||
return ($tw.utils.parseStringArray(tiddler.fields[field]) || []).slice(0);
|
||||
}
|
||||
return [];
|
||||
};
|
||||
|
|
Ładowanie…
Reference in New Issue