mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-02 20:29:10 +00:00
Add support for parameter substitutions to the savetiddler command
This commit is contained in:
parent
175d7c67fd
commit
1db72ea931
@ -32,8 +32,14 @@ Command.prototype.execute = function() {
|
|||||||
path = require("path"),
|
path = require("path"),
|
||||||
title = this.params[0],
|
title = this.params[0],
|
||||||
filename = this.params[1],
|
filename = this.params[1],
|
||||||
type = this.params[2] || "text/html";
|
type = this.params[2] || "text/html",
|
||||||
fs.writeFile(filename,this.commander.wiki.renderTiddler(type,title),"utf8",function(err) {
|
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);
|
self.callback(err);
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
|
@ -4,5 +4,7 @@ tags: docs command
|
|||||||
Save an individual tiddler as a specified ContentType, defaults to `text/html`
|
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.
|
||||||
|
Loading…
Reference in New Issue
Block a user