From 4b28fb265a96f69e02af91a8fe7b20cff3cccc6a Mon Sep 17 00:00:00 2001 From: FeralFlora <33608083+FeralFlora@users.noreply.github.com> Date: Tue, 14 May 2024 02:15:02 +0200 Subject: [PATCH] Fix attachmentFolderPath and remove unncessary command template arguments (#174) * Make attachmentFolderPath an absolute path * Remove unnessesary standalone arguments * Fix mistake so -s is removed from the PDF command, not the textbundle command --- src/export_templates.ts | 8 ++++---- src/exporto0o.ts | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/export_templates.ts b/src/export_templates.ts index 7a6e852..5c740cf 100644 --- a/src/export_templates.ts +++ b/src/export_templates.ts @@ -58,7 +58,7 @@ export default { name: 'PDF', type: 'pandoc', arguments: - '-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/pdf.lua" ${ options.textemplate ? `--resource-path="${pluginDir}/textemplate" --template="${options.textemplate}"` : ` ` } -s -o "${outputPath}" -t pdf', + '-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/pdf.lua" ${ options.textemplate ? `--resource-path="${pluginDir}/textemplate" --template="${options.textemplate}"` : ` ` } -o "${outputPath}" -t pdf', customArguments: '--pdf-engine=pdflatex', optionsMeta: { 'textemplate': 'preset:textemplate', // reference from `PresetOptionsMeta` in `src/settings.ts` @@ -68,13 +68,13 @@ export default { 'Word (.docx)': { name: 'Word (.docx)', type: 'pandoc', - arguments: '-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -s -o "${outputPath}" -t docx', + arguments: '-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -o "${outputPath}" -t docx', extension: '.docx', }, 'OpenOffice': { name: 'OpenOffice', type: 'pandoc', - arguments: '-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -s -o "${outputPath}" -t odt', + arguments: '-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -o "${outputPath}" -t odt', extension: '.odt', }, 'RTF': { @@ -86,7 +86,7 @@ export default { 'Epub': { name: 'Epub', type: 'pandoc', - arguments: '-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -s -o "${outputPath}" -t epub', + arguments: '-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -o "${outputPath}" -t epub', extension: '.epub', }, 'Latex': { diff --git a/src/exporto0o.ts b/src/exporto0o.ts index 55e09f0..ab043c1 100644 --- a/src/exporto0o.ts +++ b/src/exporto0o.ts @@ -74,6 +74,8 @@ export async function exportToOo( attachmentFolderPath = vaultDir; } else if (attachmentFolderPath.startsWith('.')) { attachmentFolderPath = path.join(currentDir, attachmentFolderPath.substring(1)); + } else { + attachmentFolderPath = path.join(vaultDir, attachmentFolderPath); } let frontMatter: unknown = null;