[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] getting access to a self-invented option?
From: |
Berry, Charles |
Subject: |
Re: [O] getting access to a self-invented option? |
Date: |
Wed, 7 Aug 2019 16:58:41 +0000 |
Matt,
See inline.
> On Aug 7, 2019, at 8:36 AM, Matt Price <address@hidden> wrote
>
>
> On Sat, Aug 3, 2019 at 1:42 PM Berry, Charles <address@hidden> wrote:
> Matt,
>
> This seems like a good use case for a `derived-backend'.
>
> You can use `org-export-define-derived-backend' with 'hugo as the parent,
> define a :menu-entry to add an export action for your custom export to the
> hugo menu using '?m' (say) as the key.
>
> Then
>
> C-c C-e H m
>
> will export using your custom variant of hugo.
>
> :-) I'm trying to use the variable to determine whether I export with hugo or
> with my hugo-reveal franken-backend:
> https://github.com/titaniumbones/ox-huveal . So my preference is to evaluate
> the variable BEFORE export begins.
But `org-export-as' doesn't execute until the dispatcher has run and the choice
of hugo or hugo-reveal has been made.
However, if this determination is permanently set for a particular file (you
only export in one manner according to the variable and never alter the
variable), then see below.
>
> I guess another option is to just set a buffer-local variable in the file, or
> use #+FILETAGS: and hack htings that way. I'm not sure what the most
> sustainable & org-like method relaly is...
>
The obvious choice for a local file setting is an OPTION. Since your 'huveal
backend already has an :options-alist, you can just add another option for
`:mwp-export-type' there. If you want access to the value before
`org-export-as' runs, try something like
(plist-get (org-export-get-environment) :mwp-export-type)
HTH,
Chuck