mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-05 18:26:56 +00:00
Add support for add-on language and theme plugins
This commit is contained in:
parent
752c5cfbda
commit
e01c428a17
@ -60,6 +60,12 @@ PluginSwitcher.prototype.switchPlugins = function() {
|
||||
}
|
||||
};
|
||||
accumulatePlugin(selectedPluginTitle);
|
||||
var selectedPluginTiddler = this.wiki.getTiddler(selectedPluginTitle);
|
||||
this.wiki.eachTiddlerPlusShadows(function(tiddler,title) {
|
||||
if(tiddler.isPlugin() && tiddler.fields["plugin-type"] === self.pluginType && tiddler.fields.name === selectedPluginTiddler.fields.name) {
|
||||
accumulatePlugin(title);
|
||||
}
|
||||
});
|
||||
// Read the plugin info for the incoming plugins
|
||||
var changedPluginInfo = this.wiki.readPluginInfo(plugins);
|
||||
// Collect the shadow tiddlers of any deleted plugins
|
||||
@ -86,7 +92,7 @@ PluginSwitcher.prototype.switchPlugins = function() {
|
||||
// Register any new theme/language tiddlers
|
||||
var registeredTiddlers = this.wiki.registerPluginTiddlers(this.pluginType,plugins);
|
||||
// Unpack the current theme/language tiddlers
|
||||
this.wiki.unpackPluginTiddlers(this.doDebug);
|
||||
this.wiki.unpackPluginTiddlers();
|
||||
// Queue change events for the changed shadow tiddlers
|
||||
$tw.utils.each(changedShadowTiddlers,function(status,title) {
|
||||
self.wiki.enqueueTiddlerEvent(title,changedShadowTiddlers[title], true);
|
||||
|
@ -0,0 +1,57 @@
|
||||
title: Plugins/LanguageAddonSubPlugin
|
||||
description: Loading of correct language subplugin at startup
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
{{First}}
|
||||
|
||||
{{Second}}
|
||||
+
|
||||
title: $:/language
|
||||
|
||||
$:/languages/fr-FR-subplugin
|
||||
+
|
||||
title: $:/languages/fr-FR-container
|
||||
list: readme
|
||||
name: fr-FR
|
||||
plugin-type: plugin
|
||||
type: application/json
|
||||
|
||||
{
|
||||
"tiddlers": {
|
||||
"$:/languages/fr-FR-container/readme": {
|
||||
"title": "$:/languages/fr-FR-container/readme",
|
||||
"text": "Readme from ~$:/languages/fr-FR-container\n\n"
|
||||
},
|
||||
"$:/languages/fr-FR-subplugin": {
|
||||
"title": "$:/languages/fr-FR-subplugin",
|
||||
"name": "fr-FR",
|
||||
"description": "fr-FR subplugin",
|
||||
"list": "readme",
|
||||
"stability": "STABILITY_1_EXPERIMENTAL",
|
||||
"version": "5.3.7-prerelease",
|
||||
"plugin-type": "language",
|
||||
"dependents": "",
|
||||
"type": "application/json",
|
||||
"text": "{\"tiddlers\":{\"First\":{\"title\":\"First\",\"text\":\"First from ~$:/languages/fr-FR-subplugin\"}}}"
|
||||
},
|
||||
"$:/languages/fr-FR-subplugin2": {
|
||||
"title": "$:/languages/fr-FR-subplugin2",
|
||||
"name": "fr-FR",
|
||||
"description": "fr-FR subplugin2",
|
||||
"list": "readme",
|
||||
"stability": "STABILITY_1_EXPERIMENTAL",
|
||||
"version": "5.3.7-prerelease",
|
||||
"plugin-type": "language",
|
||||
"dependents": "",
|
||||
"type": "application/json",
|
||||
"text": "{\"tiddlers\":{\"Second\":{\"title\":\"Second\",\"text\":\"Second from ~$:/languages/fr-FR-subplugin2\"}}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>First from $:/languages/fr-FR-subplugin</p><p>Second from $:/languages/fr-FR-subplugin2</p>
|
@ -0,0 +1,45 @@
|
||||
title: Plugins/LanguageSubPlugin
|
||||
description: Loading of correct language subplugin at startup
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
{{First}}
|
||||
|
||||
{{$:/languages/fr-FR-container/readme}}
|
||||
+
|
||||
title: $:/language
|
||||
|
||||
$:/languages/fr-FR-subplugin
|
||||
+
|
||||
title: $:/languages/fr-FR-container
|
||||
list: readme
|
||||
name: fr-FR
|
||||
plugin-type: plugin
|
||||
type: application/json
|
||||
|
||||
{
|
||||
"tiddlers": {
|
||||
"$:/languages/fr-FR-container/readme": {
|
||||
"title": "$:/languages/fr-FR-container/readme",
|
||||
"text": "Readme from ~$:/languages/fr-FR-container\n\n"
|
||||
},
|
||||
"$:/languages/fr-FR-subplugin": {
|
||||
"title": "$:/languages/fr-FR-subplugin",
|
||||
"name": "fr-FR",
|
||||
"description": "fr-FR subplugin",
|
||||
"list": "readme",
|
||||
"stability": "STABILITY_1_EXPERIMENTAL",
|
||||
"version": "5.3.7-prerelease",
|
||||
"plugin-type": "language",
|
||||
"dependents": "",
|
||||
"type": "application/json",
|
||||
"text": "{\"tiddlers\":{\"First\":{\"title\":\"First\",\"text\":\"First from ~$:/languages/fr-FR-subplugin\"}}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>First from $:/languages/fr-FR-subplugin</p><p>Readme from $:/languages/fr-FR-container</p>
|
Loading…
x
Reference in New Issue
Block a user