1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-10-27 13:47:40 +00:00

Lots of improvements to the plugin library

* Moved “add new plugin” into a modal wizard
* Adopt big friendly buttons
* Add plugin icons and readmes to “add new plugin” modal
* Use tabs for splitting plugins/themes/languages
* Consistent styling between the “add new plugin” modal and the
“installed plugins” control panel tab
* Behind the scenes, moved from addressing the library as
`recipes/defaults/tiddlers/<etc>` to `recipes/library/tiddlers<etc>`
This commit is contained in:
Jermolene
2015-03-18 11:46:28 +00:00
parent 421ac16389
commit 24435a46be
17 changed files with 227 additions and 222 deletions

View File

@@ -39,20 +39,44 @@ Command.prototype.execute = function() {
fs = require("fs"),
path = require("path"),
containerTitle = this.params[0],
basepath = this.params[1],
skinnyListTitle = this.params[2];
filter = this.params[1],
basepath = this.params[2],
skinnyListTitle = this.params[3];
// Get the container tiddler as data
var containerData = self.commander.wiki.getTiddlerData(containerTitle,undefined);
if(!containerData) {
return "'" + containerTitle + "' is not a tiddler bundle";
}
// Save each JSON file and collect the skinny data
var skinnyList = [];
// Filter the list of plugins
var pluginList = [];
$tw.utils.each(containerData.tiddlers,function(tiddler,title) {
pluginList.push(title);
});
var filteredPluginList;
if(filter) {
filteredPluginList = self.commander.wiki.filterTiddlers(filter,null,self.commander.wiki.makeTiddlerIterator(pluginList));
} else {
filteredPluginList = pluginList;
}
// Iterate through the plugins
var skinnyList = [];
$tw.utils.each(filteredPluginList,function(title) {
var tiddler = containerData.tiddlers[title];
// Save each JSON file and collect the skinny data
var pathname = path.resolve(self.commander.outputPath,basepath + encodeURIComponent(title) + ".json");
$tw.utils.createFileDirectories(pathname);
fs.writeFileSync(pathname,JSON.stringify(tiddler,null,$tw.config.preferences.jsonSpaces),"utf8");
skinnyList.push($tw.utils.extend({},tiddler,{text: undefined}));
// Collect the skinny list data
var pluginTiddlers = JSON.parse(tiddler.text),
readmeContent = (pluginTiddlers.tiddlers[title + "/readme"] || {}).text,
iconTiddler = pluginTiddlers.tiddlers[title + "/icon"] || {},
iconType = iconTiddler.type,
iconText = iconTiddler.text,
iconContent;
if(iconType && iconText) {
iconContent = $tw.utils.makeDataUri(iconText,iconType);
}
skinnyList.push($tw.utils.extend({},tiddler,{text: undefined, readme: readmeContent, icon: iconContent}));
});
// Save the catalogue tiddler
if(skinnyListTitle) {