Added wiki.getTiddlersWithTag()

We should probably use the filter mechanism for this...
print-window-tiddler
Jeremy Ruston 2012-06-13 09:10:03 +01:00
rodzic ab33d730bb
commit 84a352b804
1 zmienionych plików z 14 dodań i 0 usunięć

Wyświetl plik

@ -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 || {};