From 97bbc6a90b496511e281f917a3033ad3a6e26875 Mon Sep 17 00:00:00 2001 From: Ryan Greenup Date: Mon, 14 Sep 2020 11:49:56 +1000 Subject: [PATCH] Fixed Exporting Files with Relative Directories --- bin/cadmus | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/cadmus b/bin/cadmus index e2c6fac..bd75e2c 100755 --- a/bin/cadmus +++ b/bin/cadmus @@ -531,8 +531,11 @@ pandocExport () { # $1 is extension; $2+ are options for pandoc echo pandoc -s "${FILE}" ${@:-} --extract-media="${OUTDIR}/media" -o "${OUTDIR}"/"${FILEOUT}" || exit 7 + cd "${OUTDIR}" + ## Run it a second time so extracted media is relative not absolute + pandoc -s "${FILEOUT}" ${@:-} --extract-media="media" -o "${FILEOUT}" || echo "" # This might fail for PDF's, don't exit xdg-open "${OUTDIR}"/"${FILEOUT}" - + cd - } # **** Help @@ -546,8 +549,7 @@ function ExportHelp () { echo -e " This does not work for multiple selections (yet) so avoid pressing" echo -e " TAB to try and export multiple files, it won't work" echo - echo -e " The links in exports are not relative, I don't know why," - echo -e " I need to fix this because it's really really inconvenient." + echo -e " The links in exports are made relative, by using a second call to pandoc" echo echo -e " \e[1;91m \e[1m Command \e[0m\e[0m \e[1;34m┊┊┊ \e[0m Description " echo -e " ...............\e[1;34m┊┊┊\e[0m........................................... " @@ -560,6 +562,7 @@ function ExportHelp () { echo -e " \e[1;32m html \e[0m \e[1;34m ┊┊┊\e[0m Make a self-contained MathML HTML (firefox/safari only)" echo -e " \e[1;32m html-dir \e[0m \e[1;34m ┊┊┊\e[0m Make a directory of HTML+images (for importing to Mediawiki)" echo -e " \e[1;32m md \e[0m \e[1;34m ┊┊┊\e[0m Export markdown and images to directory" + echo -e " \e[1;32m org \e[0m \e[1;34m ┊┊┊\e[0m Export as org-mode with images to directory" echo }