1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 12:07:19 +00:00

Merge pull request #1352 from welford/rendertiddlers

add "noclean" parameter to rendertiddlers
This commit is contained in:
Jeremy Ruston 2015-01-11 19:58:05 +00:00
commit d624066e73
2 changed files with 6 additions and 3 deletions

View File

@ -4,7 +4,7 @@ description: Render tiddlers matching a filter to a specified ContentType
Render a set of tiddlers matching a filter to separate files of a specified ContentType (defaults to `text/html`) and extension (defaults to `.html`).
```
--rendertiddlers <filter> <template> <pathname> [<type>] [<extension>]
--rendertiddlers <filter> <template> <pathname> [<type>] [<extension>] ["noclean"]
```
For example:
@ -15,4 +15,4 @@ For example:
By default, the pathname is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.
Any files in the target directory are deleted. The target directory is recursively created if it is missing.
Any files in the target directory are deleted unless the "noclean" parameter is specified. The target directory is recursively created if it is missing.

View File

@ -38,8 +38,11 @@ Command.prototype.execute = function() {
pathname = path.resolve(this.commander.outputPath,this.params[2]),
type = this.params[3] || "text/html",
extension = this.params[4] || ".html",
deleteDirectory = (this.params[5] || "") != "noclean",
tiddlers = wiki.filterTiddlers(filter);
$tw.utils.deleteDirectory(pathname);
if(deleteDirectory){
$tw.utils.deleteDirectory(pathname);
}
$tw.utils.createDirectory(pathname);
$tw.utils.each(tiddlers,function(title) {
var parser = wiki.parseTiddler(template),