Fix #1750: errors while exporting markdown

Now runs the exporters directly, rather than through shells. Also fixes
"This document format requires a nonempty..." errors with pandoc
exporter.
This commit is contained in:
Henrik Lissner 2019-09-05 14:05:27 -04:00
parent 7e36c5c2b3
commit 778c7c4244
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -36,10 +36,7 @@ otherwise throws an error."
Returns its exit code." Returns its exit code."
(when (executable-find "marked") (when (executable-find "marked")
(apply #'call-process-region (apply #'call-process-region
beg end beg end "marked" nil output-buffer nil
shell-file-name nil output-buffer nil
shell-command-switch
"marked"
(when (eq major-mode 'gfm-mode) (when (eq major-mode 'gfm-mode)
(list "--gfm" "--tables" "--breaks"))))) (list "--gfm" "--tables" "--breaks")))))
@ -48,21 +45,18 @@ Returns its exit code."
"Compiles markdown with the pandoc program, if available. "Compiles markdown with the pandoc program, if available.
Returns its exit code." Returns its exit code."
(when (executable-find "pandoc") (when (executable-find "pandoc")
(call-process-region beg end (call-process-region beg end "pandoc" nil output-buffer nil
shell-file-name nil output-buffer nil "-f" "markdown"
shell-command-switch "-t" "html"
"pandoc" "-f" "markdown" "-t" "html" "--mathjax"
"--standalone" "--mathjax" "--highlight-style=pygments"))) "--highlight-style=pygments")))
;;;###autoload ;;;###autoload
(defun +markdown-compile-multimarkdown (beg end output-buffer) (defun +markdown-compile-multimarkdown (beg end output-buffer)
"Compiles markdown with the multimarkdown program, if available. Returns its "Compiles markdown with the multimarkdown program, if available. Returns its
exit code." exit code."
(when (executable-find "multimarkdown") (when (executable-find "multimarkdown")
(call-process-region beg end (call-process-region beg end "multimarkdown" nil output-buffer)))
shell-file-name nil output-buffer nil
shell-command-switch
"multimarkdown")))
;;;###autoload ;;;###autoload
(defun +markdown-compile-markdown (beg end output-buffer) (defun +markdown-compile-markdown (beg end output-buffer)
@ -70,10 +64,7 @@ exit code."
available. Returns its exit code." available. Returns its exit code."
(when-let (exe (or (executable-find "Markdown.pl") (when-let (exe (or (executable-find "Markdown.pl")
(executable-find "markdown"))) (executable-find "markdown")))
(call-process-region beg end (call-process-region beg end exe nil output-buffer nil)))
shell-file-name nil output-buffer nil
shell-command-switch
exe)))
;; ;;
;;; Commands ;;; Commands