~jakob/ox-haunt

1c8c70e3173f98206768c15cb2e4de706559f151 — Jakob L. Kreuze 1 year, 3 months ago d32c4b1
Enable customization of where rendered documents are written to
1 files changed, 9 insertions(+), 1 deletions(-)

M ox-haunt.el
M ox-haunt.el => ox-haunt.el +9 -1
@@ 48,6 48,7 @@
  '((:tags "TAGS" nil nil)
    (:haunt-metadata "HAUNT_METADATA" nil nil)
    (:haunt-base-dir "HAUNT_BASE_DIR" nil ox-haunt-base-dir)
    (:haunt-posts-dir "HAUNT_POSTS_DIR" nil ox-haunt-posts-dir)
    (:haunt-images-dir "HAUNT_IMAGES_DIR" nil ox-haunt-images-dir)))

(defgroup org-export-haunt nil


@@ 65,6 66,11 @@ This can be specified on a per-file basis with the 'HAUNT_BASE_DIR' keyword."
  "A list of keywords to include in the Haunt metadata section."
  :type '(list symbol))

(defcustom ox-haunt-posts-dir "/posts/"
  "The default path to copy rendered posts to.
This can be specified on a per-file basis with the 'HAUNT_POSTS_DIR' keyword."
  :type 'string)

(defcustom ox-haunt-images-dir "/images/"
  "The default path to copy images to.
This can be specified on a per-file basis with the 'HAUNT_IMAGES_DIR' keyword."


@@ 244,6 250,7 @@ Return output file's name."
                (org-export--get-buffer-attributes)
                (org-export-get-environment 'haunt subtreep)))
         (dest-path (plist-get info :haunt-base-dir))
         (posts-path (plist-get info :haunt-posts-dir))
	     (images-path (plist-get info :haunt-images-dir))
	     (subtree-metadata (when subtreep
			                 (ox-haunt--get-valid-subtree-metadata))))


@@ 259,12 266,13 @@ Return output file's name."
					                      org-html-extension
					                      "html")))
               (file (org-export-output-file-name extension subtreep))
               (file (concat dest-path "/posts/" file))
               (file (concat dest-path posts-path file))
               (org-export-coding-system org-html-coding-system))
	      (org-export-to-file 'haunt file
            async subtreep visible-only body-only
            ;; Necessary to propagate a buffer-local value for `ox-haunt-base-dir'.
            (append `(:haunt-base-dir ,dest-path)
                    `(:haunt-posts-dir ,posts-path)
		            `(:haunt-images-dir ,images-path)
		            subtree-metadata ext-plist)))))))