what1fool.info

1 exporting a subset of one document's org-mode subtrees into html

I write articles for this site using Emacs org-mode. Much of the routine operation of the site is also carried out using active code extensions to org-mode that are called org-babel.

Org-babel allows me to execute the following elisp form from the same buffer that I use to edit article text.

(shell-command "rm *.html")
(org-map-entries '(lambda () 
                    (if (org-entry-get nil "subtree-export") 
                        (progn (org-narrow-to-subtree) 
                               (org-export-to-file 'html (org-entry-get nil "subtree-export"))
                               (widen)))) nil 'file)

Author: Coffee Crayon

Created: 2019-08-13 Tue 10:40

Validate