1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-25 09:30:28 +00:00

Added some shortcut filters needed for cooking TiddlyWiki documents

This commit is contained in:
Jeremy Ruston 2012-05-05 14:16:05 +01:00
parent bf8100201d
commit 3520454a47

View File

@ -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]]