From 3520454a4704d6f2070a090e76c1aeaa4b7ab720 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sat, 5 May 2012 14:16:05 +0100 Subject: [PATCH] Added some shortcut filters needed for cooking TiddlyWiki documents --- rabbithole/core/modules/wiki.filters.js | 31 +++++++++++++++++++------ 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/rabbithole/core/modules/wiki.filters.js b/rabbithole/core/modules/wiki.filters.js index 4baa79324..177f212c4 100644 --- a/rabbithole/core/modules/wiki.filters.js +++ b/rabbithole/core/modules/wiki.filters.js @@ -31,30 +31,47 @@ exports.filters = { }, is: function(results,match) { switch(match[3]) { - case "pluginModule": - this.forEachTiddler(function(title,tiddler) { - if(title.indexOf("$:/plugins/") === 0 && tiddler.fields.type === "application/javascript") { + case "shadowStyle": + this.shadows.forEachTiddler(function(title,tiddler) { + if(tiddler.fields.type === "text/css") { if(results.indexOf(title) === -1) { results.push(title); } } }); break; - case "pluginTiddler": - this.forEachTiddler(function(title,tiddler) { - if(title.indexOf("$:/plugins/") === 0 && tiddler.fields.type !== "application/javascript") { + case "shadowModule": + this.shadows.forEachTiddler(function(title,tiddler) { + if(tiddler.fields.type === "application/javascript" && tiddler.fields["module-type"]) { if(results.indexOf(title) === -1) { results.push(title); } } }); 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 -// 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 exports.filterTiddlers = function(filter) { // text or [foo[bar]] or [[tiddler title]]