2017-12-08 22:59:42 -05:00
|
|
|
;;; lang/org/+export.el -*- lexical-binding: t; -*-
|
2017-07-05 02:33:41 +02:00
|
|
|
|
|
|
|
;; I don't have any beef with org's built-in export system, but I do wish it
|
|
|
|
;; would export to a central directory, rather than `default-directory'. This is
|
|
|
|
;; because all my org files are usually in one place, and I want to be able to
|
|
|
|
;; refer back to old exports if needed.
|
|
|
|
|
|
|
|
(def-package! ox-pandoc
|
2017-12-08 22:59:42 -05:00
|
|
|
:defer t
|
2017-07-05 02:33:41 +02:00
|
|
|
:config
|
2017-12-16 12:50:04 -05:00
|
|
|
(if (executable-find "pandoc")
|
|
|
|
(push 'pandoc org-export-backends)
|
2017-07-05 02:33:41 +02:00
|
|
|
(warn "org-export: couldn't find pandoc, disabling pandoc export"))
|
|
|
|
(setq org-pandoc-options
|
|
|
|
'((standalone . t)
|
|
|
|
(mathjax . t)
|
|
|
|
(parse-raw . t))))
|
|
|
|
|
|
|
|
;;
|
2017-12-09 14:42:42 -05:00
|
|
|
(after! org
|
2017-12-16 12:50:04 -05:00
|
|
|
(add-transient-hook! #'org-export-dispatch (require 'ox-pandoc))
|
|
|
|
|
2017-07-05 02:33:41 +02:00
|
|
|
(setq org-export-directory (expand-file-name ".export" +org-dir)
|
2017-12-16 12:50:04 -05:00
|
|
|
org-export-backends '(ascii html latex md)
|
2017-07-05 02:33:41 +02:00
|
|
|
org-export-with-toc t
|
|
|
|
org-export-with-author t)
|
|
|
|
|
|
|
|
;; Always export to a central location
|
|
|
|
(unless (file-directory-p org-export-directory)
|
|
|
|
(make-directory org-export-directory t))
|
|
|
|
(defun +org*export-output-file-name (args)
|
|
|
|
"Return a centralized export location."
|
|
|
|
(unless (nth 2 args)
|
|
|
|
(setq args (append args (list org-export-directory))))
|
|
|
|
args)
|
|
|
|
(advice-add #'org-export-output-file-name
|
|
|
|
:filter-args #'+org*export-output-file-name))
|