mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-02 20:29:10 +00:00
Added wiki.getTiddlersWithTag()
We should probably use the filter mechanism for this...
This commit is contained in:
parent
ab33d730bb
commit
84a352b804
@ -225,6 +225,20 @@ exports.getShadowTitles = function() {
|
|||||||
return titles;
|
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
|
// 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) {
|
exports.getCacheForTiddler = function(title,cacheName,initializer) {
|
||||||
this.caches = this.caches || {};
|
this.caches = this.caches || {};
|
||||||
|
Loading…
Reference in New Issue
Block a user