mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-26 19:47:20 +00:00
Relaxed restrictions on the names of constituent tiddlers within plugins
Thus allowing us to give a more sensible title to the core plugin
This commit is contained in:
parent
cd36f594c5
commit
63fd149ea9
14
boot/boot.js
14
boot/boot.js
@ -554,15 +554,13 @@ $tw.Wiki.prototype.unpackPluginTiddlers = function() {
|
|||||||
// Save the plugin information
|
// Save the plugin information
|
||||||
var pluginInfo = self.plugins[title] = JSON.parse(tiddler.fields.text);
|
var pluginInfo = self.plugins[title] = JSON.parse(tiddler.fields.text);
|
||||||
// Extract the constituent tiddlers
|
// Extract the constituent tiddlers
|
||||||
for(var t in pluginInfo.tiddlers) {
|
$tw.utils.each(pluginInfo.tiddlers,function(constituentTiddler,constituentTitle) {
|
||||||
var constituentTiddler = pluginInfo.tiddlers[t],
|
|
||||||
constituentTitle = pluginInfo.title + "/" + t;
|
|
||||||
// Don't overwrite tiddlers that already exist
|
// Don't overwrite tiddlers that already exist
|
||||||
if(!$tw.utils.hop(self.shadowTiddlers,constituentTitle)) {
|
if(!$tw.utils.hop(self.shadowTiddlers,constituentTitle)) {
|
||||||
// Save the tiddler object
|
// Save the tiddler object
|
||||||
self.shadowTiddlers[constituentTitle] = new $tw.Tiddler(constituentTiddler,{title: constituentTitle});
|
self.shadowTiddlers[constituentTitle] = new $tw.Tiddler(constituentTiddler,{title: constituentTitle});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -986,14 +984,8 @@ $tw.loadPluginFolder = function(filepath,excludeRegExp) {
|
|||||||
}
|
}
|
||||||
// Save the plugin tiddlers into the plugin info
|
// Save the plugin tiddlers into the plugin info
|
||||||
pluginInfo.tiddlers = pluginInfo.tiddlers || {};
|
pluginInfo.tiddlers = pluginInfo.tiddlers || {};
|
||||||
titlePrefix = pluginInfo.title + "/";
|
|
||||||
for(t=0; t<pluginTiddlers.length; t++) {
|
for(t=0; t<pluginTiddlers.length; t++) {
|
||||||
// Check that the constituent tiddler has the plugin title as a prefix
|
pluginInfo.tiddlers[pluginTiddlers[t].title] = pluginTiddlers[t];
|
||||||
if(pluginTiddlers[t].title.indexOf(titlePrefix) === 0 && pluginTiddlers[t].title.length > titlePrefix.length) {
|
|
||||||
pluginInfo.tiddlers[pluginTiddlers[t].title.substr(titlePrefix.length)] = pluginTiddlers[t];
|
|
||||||
} else {
|
|
||||||
console.log("Error extracting plugin: The plugin '" + pluginInfo.title + "' cannot contain a tiddler titled '" + pluginTiddlers[t].title + "'");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"title": "$:",
|
"title": "$:/core",
|
||||||
"description": "TiddlyWiki5 core plugin",
|
"description": "TiddlyWiki5 core plugin",
|
||||||
"author": "JeremyRuston",
|
"author": "JeremyRuston",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user