mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-03 12:49:09 +00:00
Constituent tiddlers prefixed with title of plugin tiddler
This commit is contained in:
parent
88e7a4fb67
commit
bb972888b9
@ -377,12 +377,13 @@ $tw.Wiki.prototype.installPlugins = function() {
|
|||||||
// Save the plugin information
|
// Save the plugin information
|
||||||
var pluginInfo = this.plugins[title] = JSON.parse(tiddler.fields.text);
|
var pluginInfo = this.plugins[title] = JSON.parse(tiddler.fields.text);
|
||||||
// Extract the constituent tiddlers
|
// Extract the constituent tiddlers
|
||||||
for(var t=0; t<pluginInfo.tiddlers.length; t++) {
|
for(var t in pluginInfo.tiddlers) {
|
||||||
var constituentTiddler = pluginInfo.tiddlers[t];
|
var constituentTiddler = pluginInfo.tiddlers[t],
|
||||||
|
constituentTitle = pluginInfo.title + "/" + t;
|
||||||
// Don't overwrite tiddlers that already exist
|
// Don't overwrite tiddlers that already exist
|
||||||
if(!(constituentTiddler.title in this.pluginTiddlers)) {
|
if(!(constituentTitle in this.pluginTiddlers)) {
|
||||||
// Save the tiddler object
|
// Save the tiddler object
|
||||||
this.pluginTiddlers[constituentTiddler.title] = new $tw.Tiddler(constituentTiddler);
|
this.pluginTiddlers[constituentTitle] = new $tw.Tiddler(constituentTiddler,{title: constituentTitle});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,15 @@ type: application/json
|
|||||||
plugin: yes
|
plugin: yes
|
||||||
|
|
||||||
{
|
{
|
||||||
"tiddlers": [
|
"title": "$:/plugins/tiddlywiki/test",
|
||||||
{"title": "Test1", "text": "Some text"},
|
"description": "An exemplary plugin for demonstration purposes",
|
||||||
{"title": "Test2", "text": "Some more text"},
|
"author": "JeremyRuston",
|
||||||
{"title": "Test3", "text": "console.log(require('Test4').string);", "type": "application/javascript", "module-type": "custom"},
|
"version": "0.0.0-alpha0",
|
||||||
{"title": "Test4", "text": "exports.string = 'Plugin I am in You!';", "type": "application/javascript", "module-type": "custom"}
|
"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"}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,14 +17,12 @@ The JSON structure for plugin tiddlers is as follows:
|
|||||||
|
|
||||||
{{{
|
{{{
|
||||||
{
|
{
|
||||||
"metadata": {
|
|
||||||
"title": "$:/plugins/publisher/name",
|
"title": "$:/plugins/publisher/name",
|
||||||
"description": "An exemplary plugin for demonstration purposes",
|
"description": "An exemplary plugin for demonstration purposes",
|
||||||
"author": "JeremyRuston",
|
"author": "JeremyRuston",
|
||||||
"version": "1.2.3-alpha3",
|
"version": "1.2.3-alpha3",
|
||||||
"coreVersion": ">=5.0.0",
|
"coreVersion": ">=5.0.0",
|
||||||
"source": "http://tiddlywiki.com/MyPlugin"
|
"source": "http://tiddlywiki.com/MyPlugin",
|
||||||
},
|
|
||||||
"tiddlers": {
|
"tiddlers": {
|
||||||
"title1": {"type": "image/png", "text": "<base64>"},
|
"title1": {"type": "image/png", "text": "<base64>"},
|
||||||
"title2": {"text": "Text"}
|
"title2": {"text": "Text"}
|
||||||
|
Loading…
Reference in New Issue
Block a user