mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-25 01:20:30 +00:00
Coding style updates
@welford there were some minor tweaks with whitespace, coalescing consecutive var statements, camelcase rather than underscores in variable names.
This commit is contained in:
parent
7eeb286551
commit
bba4794c0a
@ -41,25 +41,25 @@ Command.prototype.execute = function() {
|
|||||||
extension = this.params[4] || ".html",
|
extension = this.params[4] || ".html",
|
||||||
deleteDirectory = (this.params[5] || "") != "noclean",
|
deleteDirectory = (this.params[5] || "") != "noclean",
|
||||||
tiddlers = wiki.filterTiddlers(filter);
|
tiddlers = wiki.filterTiddlers(filter);
|
||||||
if(deleteDirectory){
|
if(deleteDirectory) {
|
||||||
$tw.utils.deleteDirectory(pathname);
|
$tw.utils.deleteDirectory(pathname);
|
||||||
}
|
}
|
||||||
$tw.utils.each(tiddlers,function(title) {
|
$tw.utils.each(tiddlers,function(title) {
|
||||||
var parser = wiki.parseTiddler(template),
|
var parser = wiki.parseTiddler(template),
|
||||||
widgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}});
|
widgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}}),
|
||||||
var container = $tw.fakeDocument.createElement("div");
|
container = $tw.fakeDocument.createElement("div");
|
||||||
widgetNode.render(container,null);
|
widgetNode.render(container,null);
|
||||||
var text = type === "text/html" ? container.innerHTML : container.textContent;
|
var text = type === "text/html" ? container.innerHTML : container.textContent,
|
||||||
var export_path = null;
|
exportPath = null;
|
||||||
if($tw.utils.hop($tw.macros,"tv-get-export-path")) {
|
if($tw.utils.hop($tw.macros,"tv-get-export-path")) {
|
||||||
var macroPath = $tw.macros["tv-get-export-path"].run.apply(self,[title]);
|
var macroPath = $tw.macros["tv-get-export-path"].run.apply(self,[title]);
|
||||||
if(macroPath){
|
if(macroPath) {
|
||||||
export_path = path.resolve( outputPath, macroPath + extension);
|
exportPath = path.resolve(outputPath,macroPath + extension);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var final_path = export_path || path.resolve(pathname,encodeURIComponent(title) + extension);
|
var finalPath = exportPath || path.resolve(pathname,encodeURIComponent(title) + extension);
|
||||||
$tw.utils.createFileDirectories(final_path);
|
$tw.utils.createFileDirectories(finalPath);
|
||||||
fs.writeFileSync(final_path,text,"utf8");
|
fs.writeFileSync(finalPath,text,"utf8");
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user