From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: access value of an export option Date: Tue, 27 Jun 2017 21:39:21 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="f40304353038e24ab70552fb40d7" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQ1x0-0005Ml-2Z for emacs-orgmode@gnu.org; Tue, 27 Jun 2017 21:39:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQ1wy-0001Tf-RL for emacs-orgmode@gnu.org; Tue, 27 Jun 2017 21:39:26 -0400 Received: from mail-qt0-x22c.google.com ([2607:f8b0:400d:c0d::22c]:33053) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dQ1wy-0001Sq-L5 for emacs-orgmode@gnu.org; Tue, 27 Jun 2017 21:39:24 -0400 Received: by mail-qt0-x22c.google.com with SMTP id r30so39030726qtc.0 for ; Tue, 27 Jun 2017 18:39:23 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Org Mode --f40304353038e24ab70552fb40d7 Content-Type: text/plain; charset="UTF-8" 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 --f40304353038e24ab70552fb40d7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I'm modifying https://git= hub.com/helloyi/ox-hugo/edit/master/ox-hugo.el to make a few things a l= ittle easier. In particular, I'd like to be able to set the hugo conten= t directory and hugo section paths as export options.=C2=A0 to this end I h= ave defined some new export options:

:options-alis= t '((
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (:hugo-content-dir=C2=A0 &= quot;HUGO_CONTENT_DIR" nil nil)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= (:hugo-section=C2=A0=C2=A0=C2=A0=C2=A0 "HUGO_SECTION" "post= s" nil)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (:hugo-static-images &q= uot;HUGO_STATIC_IMAGES" "image" nil)))

<= div>So now I can set these with

#+HUGO_CONTEN= T_DIR: /home/matt/hugo/content

or
<= br>
:PROPERTIES:
:HUGO_CONTENT_DIR: /home/matt/hugo/con= tent
: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-expor= t-to-md (&optional async subtreep visible-only)
=C2=A0 "Export = current buffer to a Hugo Flavored Markdown file.
=C2=A0[ snip= ]
Return output file's name."
=C2=A0 (interactiv= e)
=C2=A0 (let* ((pub-dir
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (concat (file-name-as-directory=C2= =A0=C2=A0=C2=A0
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 UM_I_WANT_TO_WRITE_HUGO_CONTENT_DIR= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 HUGO_SECTION_D= IR)))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (outfile (org-exp= ort-output-file-name ".md" subtreep)))
=C2=A0=C2=A0=C2=A0 (org= -export-to-file 'hugo outfile async subtreep visible-only)))
<= div>
--------------------------

But I= 9;m not sure what to use to access the settings at this stage, since I don&= #39;t have the "info" channel available yet. It seems a little si= lly to call =3Dorg-export--get-export-attributes=3D here, since it will als= o be called by =3Dorg-export-to-file=3D. Is that, in fact, the best thing t= o do?

As always, thank you!

Matt


--f40304353038e24ab70552fb40d7--