From 88b836651c15d82f4441c2ff8422b09017b524f2 Mon Sep 17 00:00:00 2001 From: Ryan Greenup Date: Thu, 16 Jul 2020 23:33:45 +1000 Subject: [PATCH] Added More PDF Export and Fixed HELP --- README.md | 5 +++++ bin/cadmus | 31 +++++++++++++++++++++---------- todo.org | 15 ++++++++++++++- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 3b2991b..9d362a9 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,11 @@ It is assumed that: - [MarkText](https://github.com/marktext/marktext) - [bat](https://github.com/sharkdp/bat) +### Recommended for all Features + +- [WeasyPrint](https://aur.archlinux.org/packages/python-weasyprint/) +- [tectonic](https://tectonic-typesetting.github.io/en-US/) + ### Interesting or Helpful packages not required - [readability-cli](https://gitlab.com/gardenappl/readability-cli) diff --git a/bin/cadmus b/bin/cadmus index f7072e7..26cf499 100755 --- a/bin/cadmus +++ b/bin/cadmus @@ -259,8 +259,16 @@ CadmusExport () { ;; pdf) shift; pandocExport pdf --pdf-engine=xelatex && exit 0 ;; + tex) shift; pandocExport tex && exit 0 + ;; + tectonic) shift; pandocExport pdf --pdf-engine=tectonic && exit 0 + ;; + weasyprint) shift; pandocExport pdf --pdf-engine=weasyprint && exit 0 + ;; html) shift; pandocExport html --mathml --self-contained -c "${script_dir}"'/resources/pandoc.css' && exit 0 ;; + html-dir) shift; pandocExport html --katex -c "${script_dir}"'/resources/pandoc.css' && exit 0 + ;; page-import) shift; xclip -o -selection clipboard | xargs curl | pandoc -f html -t markdown_github+tex_math_dollars --atx-headers | xclip -selection clipboard && exit 0 ;; --*) >&2 echo "bad option $1" @@ -309,18 +317,21 @@ function ExportHelp () { echo -e " \e[3m\e[1m Cadmus Export\e[0m; Tools for Editing Notes " echo -e " \e[1;31m -------------------------\e[0m " 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........................................... " - echo -e " \e[1;93m odt \e[0m \e[1;34m ┊┊┊ \e[0m✀ Export a Note to ODT" - echo -e " \e[1;93m pdflatex \e[0m \e[1;34m ┊┊┊\e[0m [#A] TODO" - echo -e " \e[1;93m HTML2PDF \e[0m \e[1;34m ┊┊┊\e[0m [#A] TODO" - echo -e " \e[1;93m LaTeX?\e[0m \e[1;34m ┊┊┊\e[0m [#B] TODO" - echo -e " \e[1;93m HTML \e[0m \e[1;34m ┊┊┊\e[0m [#A] TODO Should I use pandoc or something else like mkdocs?" - echo -e " \e[1;32m page-import \e[0m \e[1;34m ┊┊┊ 🎆 \e[0m Transform Clipboard from URL to corresponding Markdown" + 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........................................... " + echo -e " \e[1;32m odt \e[0m \e[1;34m ┊┊┊ \e[0mExport a Note to ODT (no syntax highlighting)" + echo -e " \e[1;32m docx \e[0m \e[1;34m ┊┊┊ \e[0mExport a Note to .docx" + echo -e " \e[1;32m pdf \e[0m \e[1;34m ┊┊┊\e[0m Export a Note to PDF with LaTeX" + echo -e " \e[1;32m tex \e[0m \e[1;34m ┊┊┊\e[0m Export a Note to LaTeX" + echo -e " \e[1;32m tectonic \e[0m \e[1;34m ┊┊┊\e[0m Export with Tectonic (Slow)" + echo -e " \e[1;32m weasyprint \e[0m \e[1;34m ┊┊┊\e[0m Make a PDF that looks like HTML" + echo -e " \e[1;32m HTML \e[0m \e[1;34m ┊┊┊\e[0m Make a self-contained MathML HTML" + 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 echo -e " \e[3m\e[1m• Notes\e[0m " - echo -e " This doesn't currently work for images, I think I should have two menus for export " - echo -e " One for Transforming the Clipboard, the other for choosing a file for export." + 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 } diff --git a/todo.org b/todo.org index d3ddabb..b89fd7c 100644 --- a/todo.org +++ b/todo.org @@ -90,9 +90,22 @@ print to STDOUT, this will promote modularity. If a notename that you point to (like choose from fzf) has the same name as a folder (think julia.md) then the link you get back is a fucking mess. ** TODO page-import This doesn't work for $$, fix that. +** TODO Have tool to open random note * TODO [#A] export -** TODO Export should also work for images +** TODO Should Be able to handle multiple markded selection +** DONE Should Exit on empty selection +Fixed this by changing this +#+begin_src bash +FILE="$(basename ${FILEPATH})" +#+end_src +to this +#+begin_src bash +[[ -f "${FILEPATH}" ]] && FILE="$(basename ${FILEPATH})" || exit 0 +#+end_src +** TODO Exported Paths should be relative not absolute + +** TODO Help Needs to reflect how it works * TODO [#A] convert * TODO [#A] misc * TODO [#A] publish