Make shadowTiddlers, pluginTiddlers and pluginInfo be private to the Wiki object constructor

This commit is contained in:
Jermolene
2014-03-17 10:50:18 +00:00
parent 279626a3e3
commit 9de17aa206
6 changed files with 193 additions and 163 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ exports.shadow = function(source,prefix,options) {
});
} else {
if(prefix !== "!") {
$tw.utils.each(options.wiki.shadowTiddlers,function(tiddler,title) {
options.wiki.eachShadow(function(tiddler,title) {
results.push(title);
});
} else {
+3 -3
View File
@@ -18,9 +18,9 @@ Export our filter function
exports.shadowsource = function(source,operator,options) {
var results = [],
pushShadowSource = function(title) {
var shadowInfo = options.wiki.shadowTiddlers[title];
if(shadowInfo) {
$tw.utils.pushTop(results,shadowInfo.source);
var source = options.wiki.getShadowSource(title);
if(source) {
$tw.utils.pushTop(results,source);
}
};
// Iterate through the source tiddlers
+6 -4
View File
@@ -62,8 +62,9 @@ PluginSwitcher.prototype.switchPlugins = function() {
var unregisteredTiddlers = $tw.wiki.unregisterPluginTiddlers(this.pluginType);
// Accumulate the titles of shadow tiddlers that have changed as a result of this switch
var changedTiddlers = {};
$tw.utils.each(this.wiki.shadowTiddlers,function(shadowInfo,title) {
if(unregisteredTiddlers.indexOf(shadowInfo.source) !== -1) {
this.wiki.eachShadow(function(tiddler,title) {
var source = self.wiki.getShadowSource(title);
if(unregisteredTiddlers.indexOf(source) !== -1) {
changedTiddlers[title] = true; // isDeleted?
}
});
@@ -72,8 +73,9 @@ PluginSwitcher.prototype.switchPlugins = function() {
// Unpack the current theme tiddlers
$tw.wiki.unpackPluginTiddlers();
// Accumulate the affected shadow tiddlers
$tw.utils.each(this.wiki.shadowTiddlers,function(shadowInfo,title) {
if(registeredTiddlers.indexOf(shadowInfo.source) !== -1) {
this.wiki.eachShadow(function(tiddler,title) {
var source = self.wiki.getShadowSource(title);
if(registeredTiddlers.indexOf(source) !== -1) {
changedTiddlers[title] = false; // isDeleted?
}
});
+3 -10
View File
@@ -178,13 +178,6 @@ exports.isTemporaryTiddler = function(title) {
return title.indexOf("$:/temp/") === 0;
};
/*
Determines if a tiddler is a shadow tiddler, regardless of whether it has been overridden by a real tiddler
*/
exports.isShadowTiddler = function(title) {
return $tw.utils.hop(this.shadowTiddlers,title);
};
exports.isImageTiddler = function(title) {
var tiddler = this.getTiddler(title);
if(tiddler) {
@@ -453,12 +446,12 @@ exports.getTagMap = function() {
},
title, tiddler;
// Collect up all the tags
for(title in self.shadowTiddlers) {
self.eachShadow(function(tiddler,title) {
if(!self.tiddlerExists(title)) {
tiddler = self.shadowTiddlers[title].tiddler;
tiddler = self.getTiddler(title);
storeTags(tiddler.fields.tags,title);
}
}
});
self.each(function(tiddler,title) {
storeTags(tiddler.fields.tags,title);
});