Added some shortcut filters needed for cooking TiddlyWiki documents

print-window-tiddler
Jeremy Ruston 2012-05-05 14:16:05 +01:00
rodzic bf8100201d
commit 3520454a47
1 zmienionych plików z 24 dodań i 7 usunięć

Wyświetl plik

@ -31,30 +31,47 @@ exports.filters = {
}, },
is: function(results,match) { is: function(results,match) {
switch(match[3]) { switch(match[3]) {
case "pluginModule": case "shadowStyle":
this.forEachTiddler(function(title,tiddler) { this.shadows.forEachTiddler(function(title,tiddler) {
if(title.indexOf("$:/plugins/") === 0 && tiddler.fields.type === "application/javascript") { if(tiddler.fields.type === "text/css") {
if(results.indexOf(title) === -1) { if(results.indexOf(title) === -1) {
results.push(title); results.push(title);
} }
} }
}); });
break; break;
case "pluginTiddler": case "shadowModule":
this.forEachTiddler(function(title,tiddler) { this.shadows.forEachTiddler(function(title,tiddler) {
if(title.indexOf("$:/plugins/") === 0 && tiddler.fields.type !== "application/javascript") { if(tiddler.fields.type === "application/javascript" && tiddler.fields["module-type"]) {
if(results.indexOf(title) === -1) { if(results.indexOf(title) === -1) {
results.push(title); results.push(title);
} }
} }
}); });
break; break;
case "shadowPlain":
this.shadows.forEachTiddler(function(title,tiddler) {
if((tiddler.fields.type !== "application/javascript" || !tiddler.fields["module-type"]) &&
tiddler.fields.type !== "text/css") {
if(results.indexOf(title) === -1) {
results.push(title);
}
}
});
break;
case "tiddler":
this.forEachTiddler(function(title,tiddler) {
if(results.indexOf(title) === -1) {
results.push(title);
}
});
break;
} }
} }
}; };
// Return the tiddler titles from the store that match a filter expression // Return the tiddler titles from the store that match a filter expression
// filter - filter expression (eg "tidlertitle [[multi word tiddler title]] [tag[systemConfig]]") // filter - filter expression (eg "tiddlertitle [[multi word tiddler title]] [tag[systemConfig]]")
// Returns an array of tiddler titles that match the filter expression // Returns an array of tiddler titles that match the filter expression
exports.filterTiddlers = function(filter) { exports.filterTiddlers = function(filter) {
// text or [foo[bar]] or [[tiddler title]] // text or [foo[bar]] or [[tiddler title]]