1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-23 07:26:54 +00:00

Added wiki.getTiddlersWithTag()

We should probably use the filter mechanism for this...
This commit is contained in:
Jeremy Ruston 2012-06-13 09:10:03 +01:00
parent ab33d730bb
commit 84a352b804

View File

@ -225,6 +225,20 @@ exports.getShadowTitles = function() {
return titles;
};
/*
Retrieves a list of the tiddler titles that are tagged with a given tag
*/
exports.getTiddlersWithTag = function(tag) {
var titles = [];
for(var title in this.tiddlers) {
var tiddler = this.tiddlers[title];
if(tiddler.fields.tags && tiddler.fields.tags.indexOf(tag) !== -1) {
titles.push(title);
}
}
return titles;
};
// Return the named cache object for a tiddler. If the cache doesn't exist then the initializer function is invoked to create it
exports.getCacheForTiddler = function(title,cacheName,initializer) {
this.caches = this.caches || {};