Last active
July 7, 2017 14:58
-
-
Save raulrpearson/43f19505e1995564248d6869ad67b7a9 to your computer and use it in GitHub Desktop.
Org-mode subtree to HTML for Modelica documentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun myelisp-subtree-to-html () | |
"Create buffer with HTML export from org subtree at point." | |
(interactive) | |
;; Setup | |
(split-window-right) | |
(org-html-export-as-html nil 1 nil 1) | |
(html-mode) | |
;; Substitutions | |
(replace-regexp | |
"[\.]+/Resources" | |
"modelica://PVSystems/Resources" | |
nil (point-min) (point-max)) | |
(replace-string "\"" "\\\"" nil (point-min) (point-max)) | |
(replace-string "<i>" "<em>" nil (point-min) (point-max)) | |
(replace-string "</i>" "</em>" nil (point-min) (point-max)) | |
(replace-string "<b>" "<strong>" nil (point-min) (point-max)) | |
(replace-string "</b>" "</strong>" nil (point-min) (point-max)) | |
(goto-char (point-min)) | |
(insert "<html>\n") | |
(goto-char (point-max)) | |
(insert "</html>") | |
;; Formatting | |
(set-fill-column 60) | |
;; (setq fill-prefix " ") | |
(indent-region (point-min) (point-max)) | |
(fill-region (point-min) (point-max)) | |
(indent-region (point-min) (point-max)) | |
(fill-region (point-min) (point-max)) | |
(kill-new (buffer-string))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment