mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-14 05:44:50 +00:00
Fix crash with render command when filename filter returns empty result
This commit is contained in:
parent
ac286dac82
commit
d9ac4a823f
@ -45,7 +45,9 @@ Render individual tiddlers and save the results to the specified files
|
|||||||
variableList = variableList.slice(2);
|
variableList = variableList.slice(2);
|
||||||
}
|
}
|
||||||
$tw.utils.each(tiddlers,function(title) {
|
$tw.utils.each(tiddlers,function(title) {
|
||||||
var filepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);
|
var filenameResults = wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]));
|
||||||
|
if(filenameResults.length > 0) {
|
||||||
|
var filepath = path.resolve(self.commander.outputPath,filenameResults[0]);
|
||||||
if(self.commander.verbose) {
|
if(self.commander.verbose) {
|
||||||
console.log("Rendering \"" + title + "\" to \"" + filepath + "\"");
|
console.log("Rendering \"" + title + "\" to \"" + filepath + "\"");
|
||||||
}
|
}
|
||||||
@ -56,6 +58,9 @@ Render individual tiddlers and save the results to the specified files
|
|||||||
var text = type === "text/html" ? container.innerHTML : container.textContent;
|
var text = type === "text/html" ? container.innerHTML : container.textContent;
|
||||||
$tw.utils.createFileDirectories(filepath);
|
$tw.utils.createFileDirectories(filepath);
|
||||||
fs.writeFileSync(filepath,text,"utf8");
|
fs.writeFileSync(filepath,text,"utf8");
|
||||||
|
} else {
|
||||||
|
console.log("Not rendering \"" + title + "\" because the filename filter returned an empty result");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user