From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: Re: getting access to a self-invented option? Date: Wed, 7 Aug 2019 11:36:11 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000023e59a058f88b4b8" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:56295) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvNzJ-0003zp-Mx for emacs-orgmode@gnu.org; Wed, 07 Aug 2019 11:36:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hvNzI-0008MT-7G for emacs-orgmode@gnu.org; Wed, 07 Aug 2019 11:36:29 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:39041) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hvNzG-0008Jr-8Q for emacs-orgmode@gnu.org; Wed, 07 Aug 2019 11:36:28 -0400 Received: by mail-pl1-x62c.google.com with SMTP id b7so41428295pls.6 for ; Wed, 07 Aug 2019 08:36:25 -0700 (PDT) In-Reply-To: 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: "Berry, Charles" Cc: Org Mode --00000000000023e59a058f88b4b8 Content-Type: text/plain; charset="UTF-8" On Sat, Aug 3, 2019 at 1:42 PM Berry, Charles 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. 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... > > HTH, > > Chuck > > > > On Aug 2, 2019, at 9:10 AM, Matt Price wrote: > > > > I'm trying to streamline some veyr ad-hoc workflows I have. One thing I > do a lot during the school year is make some changes to an org source file, > and then export to hugo markdown with ox-hugo, and finally commit to git > (after that I have a git hook that generates the website & uploads the > changed pages to the appropriate location, usually a github-pages branch or > separate repo). > > > > So I have this code: > > > > (defun mwp-hugo-export-and-release () > > "Make it faster and easier to put my lectures up on the website." > > (interactive) > > > > (let* ((modfile (org-hugo-export-wim-to-md)) > > (basedir (plist-get (org-export-get-environment 'hugo) > ':hugo-base-dir )) > > (default-directory (expand-file-name basedir))) > > (magit-stage-file modfile) > > ;; (magit-status) > > (magit-commit-create) > > ) ) > > > > It works great, I'm very happy. HOWEVER: in my websites I have two kinds > of outputs: > > > > - regular pages -- these get exported to .md files and turned into html > by hugo > > - lecture notes -- these get exported to reveal.js HTML pages by > org-re-reveal and my hugo theme treats them differently . > > > > I would really like to set a switch somewhere in the file, something > like: > > > > #+MWP_EXPORT_TYPE: slides > > > > And then something like > > > > let* ((modfile (if (eq :mwp-export-type "slides") > (mwp-hugo-reveal-custom-export-function) > > (org-hugo-export-wim-to-md))) > > ....etc) > > do stuff) > > > > > > But I'm not sure how to get access to a totally non-standard option like > the kind I just invented in that last bit of pseudo-code. Anyone have a > good suggestion? > > > > Thank you as always! > > > > Matt > > > --00000000000023e59a058f88b4b8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Sat, Aug 3, 2019 at 1:42 PM Berry,= Charles <ccberry@ucsd.edu> w= rote:
Matt,

This seems like a good use case for a `derived-backend'.

You can use=C2=A0 `org-export-define-derived-backend' with 'hugo as= the parent, define a :menu-entry to add an export action for your custom e= xport to the hugo menu using '?m' (say) as the key.

Then

=C2=A0 =C2=A0 =C2=A0 =C2=A0 C-c C-e H m

will export using your custom variant of hugo.

:-) I'm trying to use the variable to determine w= hether I export with hugo or with my hugo-reveal franken-backend: https://github.com/titanium= bones/ox-huveal . So my preference is to evaluate the variable BEFORE e= xport begins.

I guess another option is to ju= st set a buffer-local variable in the file, or use #+FILETAGS: and hack hti= ngs that way. I'm not sure what the most sustainable & org-like met= hod relaly is...

=C2=A0

HTH,

Chuck


> On Aug 2, 2019, at 9:10 AM, Matt Price <moptop99@gmail.com> wrote:
>
> I'm trying to streamline some veyr ad-hoc workflows I have. One th= ing I do a lot during the school year is make some changes to an org source= file, and then export to hugo markdown with ox-hugo, and finally commit to= git (after that I have a git hook that generates the website & uploads= the changed pages to the appropriate location, usually a github-pages bran= ch or separate repo).
>
> So I have this code:
>
> (defun mwp-hugo-export-and-release ()
>=C2=A0 =C2=A0"Make it faster and easier to put my lectures up on t= he website."
>=C2=A0 =C2=A0(interactive)
>=C2=A0 =C2=A0
>=C2=A0 =C2=A0(let* ((modfile (org-hugo-export-wim-to-md))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (basedir (plist-get=C2=A0 (org-expor= t-get-environment 'hugo) ':hugo-base-dir ))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (default-directory (expand-file-name= basedir)))
>=C2=A0 =C2=A0 =C2=A0(magit-stage-file modfile)
>=C2=A0 =C2=A0 =C2=A0;; (magit-status)
>=C2=A0 =C2=A0 =C2=A0(magit-commit-create)
>=C2=A0 =C2=A0 =C2=A0)=C2=A0 )
>
> It works great, I'm very happy. HOWEVER: in my websites I have two= kinds of outputs:
>
> - regular pages -- these get exported to .md files and turned into htm= l by hugo
> - lecture notes -- these get exported to reveal.js HTML pages by org-r= e-reveal and my hugo theme treats them differently .
>
> I would really like to set a switch somewhere in the file, something l= ike:
>
> #+MWP_EXPORT_TYPE: slides
>
> And then something like
>
> let* ((modfile (if (eq :mwp-export-type "slides") (mwp-hugo-= reveal-custom-export-function)
>=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 (org-hugo-export-wim-to-md)))
>=C2=A0 =C2=A0 =C2=A0 ....etc)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0do stuff)
>
>
> But I'm not sure how to get access to a totally non-standard optio= n like the kind I just invented in that last bit of pseudo-code. Anyone hav= e a good suggestion?
>
> Thank you as always!
>
> Matt


--00000000000023e59a058f88b4b8--