1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-24 07:56:52 +00:00

Constituent tiddlers prefixed with title of plugin tiddler

This commit is contained in:
Jeremy Ruston 2012-08-31 14:19:13 +01:00
parent 88e7a4fb67
commit bb972888b9
3 changed files with 22 additions and 18 deletions

View File

@ -377,12 +377,13 @@ $tw.Wiki.prototype.installPlugins = function() {
// Save the plugin information
var pluginInfo = this.plugins[title] = JSON.parse(tiddler.fields.text);
// Extract the constituent tiddlers
for(var t=0; t<pluginInfo.tiddlers.length; t++) {
var constituentTiddler = pluginInfo.tiddlers[t];
for(var t in pluginInfo.tiddlers) {
var constituentTiddler = pluginInfo.tiddlers[t],
constituentTitle = pluginInfo.title + "/" + t;
// Don't overwrite tiddlers that already exist
if(!(constituentTiddler.title in this.pluginTiddlers)) {
if(!(constituentTitle in this.pluginTiddlers)) {
// Save the tiddler object
this.pluginTiddlers[constituentTiddler.title] = new $tw.Tiddler(constituentTiddler);
this.pluginTiddlers[constituentTitle] = new $tw.Tiddler(constituentTiddler,{title: constituentTitle});
}
}
}

View File

@ -3,10 +3,15 @@ type: application/json
plugin: yes
{
"tiddlers": [
{"title": "Test1", "text": "Some text"},
{"title": "Test2", "text": "Some more text"},
{"title": "Test3", "text": "console.log(require('Test4').string);", "type": "application/javascript", "module-type": "custom"},
{"title": "Test4", "text": "exports.string = 'Plugin I am in You!';", "type": "application/javascript", "module-type": "custom"}
]
"title": "$:/plugins/tiddlywiki/test",
"description": "An exemplary plugin for demonstration purposes",
"author": "JeremyRuston",
"version": "0.0.0-alpha0",
"coreVersion": ">=5.0.0",
"tiddlers": {
"Test1": {"text": "Some text"},
"Test2": {"text": "Some more text"},
"Test3": {"text": "console.log(require('$:/plugins/tiddlywiki/test/Test4').string);", "type": "application/javascript", "module-type": "custom"},
"Test4": {"text": "exports.string = 'Plugin I am in You!';", "type": "application/javascript", "module-type": "custom"}
}
}

View File

@ -17,14 +17,12 @@ The JSON structure for plugin tiddlers is as follows:
{{{
{
"metadata": {
"title": "$:/plugins/publisher/name",
"description": "An exemplary plugin for demonstration purposes",
"author": "JeremyRuston",
"version": "1.2.3-alpha3",
"coreVersion": ">=5.0.0",
"source": "http://tiddlywiki.com/MyPlugin"
},
"source": "http://tiddlywiki.com/MyPlugin",
"tiddlers": {
"title1": {"type": "image/png", "text": "<base64>"},
"title2": {"text": "Text"}