emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Price <moptop99@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: access value of an export option
Date: Tue, 27 Jun 2017 21:39:21 -0400	[thread overview]
Message-ID: <CAN_Dec8zA2gk_Bpk6900uGCwZfiCmnYS2LcN0XgcYP=DytoNfw@mail.gmail.com> (raw)

[-- 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 --]

                 reply	other threads:[~2017-06-28  1:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN_Dec8zA2gk_Bpk6900uGCwZfiCmnYS2LcN0XgcYP=DytoNfw@mail.gmail.com' \
    --to=moptop99@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).