mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-09-29 23:40:45 +00:00
Add unpackplugin command
Needed for the translators edition
This commit is contained in:
parent
f0df09c027
commit
17a594a97a
8
core/language/en-GB/Help/unpackplugin.tid
Normal file
8
core/language/en-GB/Help/unpackplugin.tid
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
title: $:/language/Help/unpackplugin
|
||||||
|
description: Unpack the payload tiddlers from a plugin
|
||||||
|
|
||||||
|
Extract the payload tiddlers from a plugin, creating them as ordinary tiddlers:
|
||||||
|
|
||||||
|
```
|
||||||
|
--unpackplugin <title>
|
||||||
|
```
|
44
core/modules/commands/unpackplugin.js
Normal file
44
core/modules/commands/unpackplugin.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/commands/unpackplugin.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: command
|
||||||
|
|
||||||
|
Command to extract the shadow tiddlers from within a plugin
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.info = {
|
||||||
|
name: "unpackplugin",
|
||||||
|
synchronous: true
|
||||||
|
};
|
||||||
|
|
||||||
|
var Command = function(params,commander,callback) {
|
||||||
|
this.params = params;
|
||||||
|
this.commander = commander;
|
||||||
|
this.callback = callback;
|
||||||
|
};
|
||||||
|
|
||||||
|
Command.prototype.execute = function() {
|
||||||
|
if(this.params.length < 1) {
|
||||||
|
return "Missing plugin name";
|
||||||
|
}
|
||||||
|
var self = this,
|
||||||
|
title = this.params[0],
|
||||||
|
pluginData = this.commander.wiki.getTiddlerData(title);
|
||||||
|
if(!pluginData) {
|
||||||
|
return "Plugin '" + title + "' not found";
|
||||||
|
}
|
||||||
|
$tw.utils.each(pluginData.tiddlers,function(tiddler) {
|
||||||
|
self.commander.wiki.addTiddler(new $tw.Tiddler(tiddler));
|
||||||
|
});
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.Command = Command;
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,8 @@
|
|||||||
|
created: 20141029114305697
|
||||||
|
modified: 20141029114305697
|
||||||
|
tags: Commands
|
||||||
|
title: UnpackPluginsCommand
|
||||||
|
type: text/vnd.tiddlywiki
|
||||||
|
caption: output
|
||||||
|
|
||||||
|
{{$:/language/Help/unpackplugins}}
|
Loading…
Reference in New Issue
Block a user