mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 12:07:19 +00:00
initial commit
Is `wiki.parseTextReference()` the appropriate way?
This commit is contained in:
parent
2db6cbed2d
commit
8b771555a5
32
core/modules/filters/getIndex.js
Normal file
32
core/modules/filters/getIndex.js
Normal file
@ -0,0 +1,32 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/getIndex.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
returns the value at a given index of datatiddlers
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.getIndex = function(source,operator,options) {
|
||||
var data,title,results = [];
|
||||
if(operator.operand){
|
||||
source(function(tiddler,title) {
|
||||
title = tiddler ? tiddler.fields.title : title;
|
||||
data = options.wiki.parseTextReference(title,"",operator.operand,{});
|
||||
if(data) {
|
||||
results.push(data.source);
|
||||
}
|
||||
});
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
Loading…
Reference in New Issue
Block a user