1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-29 00:33:15 +00:00

Add support for parameter substitutions to the savetiddler command

This commit is contained in:
Jeremy Ruston 2012-08-25 12:07:15 +01:00
parent 175d7c67fd
commit 1db72ea931
2 changed files with 11 additions and 3 deletions

View File

@ -32,8 +32,14 @@ Command.prototype.execute = function() {
path = require("path"),
title = this.params[0],
filename = this.params[1],
type = this.params[2] || "text/html";
fs.writeFile(filename,this.commander.wiki.renderTiddler(type,title),"utf8",function(err) {
type = this.params[2] || "text/html",
options = {},
t;
for(var t=3; t<this.params.length; t++) {
options["with"] = options["with"] || [];
options["with"][t-2] = this.params[t];
}
fs.writeFile(filename,this.commander.wiki.renderTiddler(type,title,options),"utf8",function(err) {
self.callback(err);
});
return null;

View File

@ -4,5 +4,7 @@ tags: docs command
Save an individual tiddler as a specified ContentType, defaults to `text/html`
{{{
--savetiddler <title> <filename> [<type>]
--savetiddler <title> <filename> [<type>] [<withparam> <withparam>...]
}}}
The optional `<withparams>` are substituted for `$1`, `$2` etc before parsing.