Skip to content

Instantly share code, notes, and snippets.

@andreareina
Created August 9, 2018 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreareina/37c634f102f819db8e49828f34934542 to your computer and use it in GitHub Desktop.
Save andreareina/37c634f102f819db8e49828f34934542 to your computer and use it in GitHub Desktop.
(add-hook 'after-save-hook
(lambda ()
(org-map-entries
(lambda ()
(let ((name (nth 4 (org-heading-components))))
(when (and
;; export only top-level entries
(= 1 (nth 0 (org-heading-components)))
;; subtree export, body only
(org-html-export-as-html nil t nil t))
(goto-char (point-min))
(insert (format "<h1>%s</h1>\n" name))
(write-file (format "../web/templates/manual/%s.html"
(downcase name)))
(kill-buffer)
)))))
;; just on this file
nil t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment