1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 20:10:03 +00:00

Merge pull request #1517 from welford/static_export_macro

bug fix
This commit is contained in:
Jeremy Ruston 2015-02-20 22:11:38 +00:00
commit 7eeb286551

View File

@ -44,7 +44,6 @@ Command.prototype.execute = function() {
if(deleteDirectory){ if(deleteDirectory){
$tw.utils.deleteDirectory(pathname); $tw.utils.deleteDirectory(pathname);
} }
$tw.utils.createDirectory(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}});
@ -53,7 +52,10 @@ Command.prototype.execute = function() {
var text = type === "text/html" ? container.innerHTML : container.textContent; var text = type === "text/html" ? container.innerHTML : container.textContent;
var export_path = null; var export_path = null;
if($tw.utils.hop($tw.macros,"tv-get-export-path")) { if($tw.utils.hop($tw.macros,"tv-get-export-path")) {
export_path = path.resolve(outputPath,$tw.macros["tv-get-export-path"].run.apply(self,[title]) + extension); var macroPath = $tw.macros["tv-get-export-path"].run.apply(self,[title]);
if(macroPath){
export_path = path.resolve( outputPath, macroPath + extension);
}
} }
var final_path = export_path || path.resolve(pathname,encodeURIComponent(title) + extension); var final_path = export_path || path.resolve(pathname,encodeURIComponent(title) + extension);
$tw.utils.createFileDirectories(final_path); $tw.utils.createFileDirectories(final_path);