emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] access value of an export option


From: Matt Price
Subject: [O] access value of an export option
Date: Tue, 27 Jun 2017 21:39:21 -0400

Hi,

I'm modifying https://github.com/helloyi/ox-hugo/edit/master/ox-hugo.el to make a few things a little easier. In particular, I'd like to be able to set the hugo content directory and hugo section paths as export options.  to this end I have defined some new export options:

:options-alist '((
                   (:hugo-content-dir  "HUGO_CONTENT_DIR" nil nil)
                   (:hugo-section     "HUGO_SECTION" "posts" nil)
                   (:hugo-static-images "HUGO_STATIC_IMAGES" "image" nil)))

So now I can set these with

#+HUGO_CONTENT_DIR: /home/matt/hugo/content

or

:PROPERTIES:
:HUGO_CONTENT_DIR: /home/matt/hugo/content
:END:

But because these are paths I want to write to, I'd like to be able to access these settings *before* calling org-export-to-file in a function like:

----------------------------------------
(defun org-hugo-export-to-md (&optional async subtreep visible-only)
  "Export current buffer to a Hugo Flavored Markdown file.
 [ snip ]
Return output file's name."
  (interactive)
  (let* ((pub-dir
                         (concat (file-name-as-directory   
                           UM_I_WANT_TO_WRITE_HUGO_CONTENT_DIR     
                            HUGO_SECTION_DIR)))
         (outfile (org-export-output-file-name ".md" subtreep)))
    (org-export-to-file 'hugo outfile async subtreep visible-only)))
--------------------------

But I'm not sure what to use to access the settings at this stage, since I don't have the "info" channel available yet. It seems a little silly to call =org-export--get-export-attributes= here, since it will also be called by =org-export-to-file=. Is that, in fact, the best thing to do?

As always, thank you!

Matt



reply via email to

[Prev in Thread] Current Thread [Next in Thread]