emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* access value of an export option
@ 2017-06-28  1:39 Matt Price
  0 siblings, 0 replies; only message in thread
From: Matt Price @ 2017-06-28  1:39 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 1687 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2535 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-28  1:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-28  1:39 access value of an export option Matt Price

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).