emacs-orgmode
[Top][All Lists]
Advanced

[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: Sat, 3 Aug 2019 17:42:49 +0000

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.


HTH,

Chuck


> On Aug 2, 2019, at 9:10 AM, Matt Price <address@hidden> 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]