diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 95b9ad8..239d387 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -3266,6 +3266,18 @@ in a window. A non-interactive call will only return the buffer." (defvar html-table-tag nil) ; dynamically scoped into this. (defvar org-par-open nil) +(defun org-exp-custom-html-function (which &optional before) + "If before is non nil, we're about to start which. which is one of: + - 'head' + - 'body' + - 'title' + - 'toc' + - 'contents' + - 'lot' + - 'postamble' +While 'head' and 'body' are called directly after the the starttags and directly before the endtags +are added, all the others wrap the element/block they are called for." + "") ;;;###autoload (defun org-export-as-html (arg &optional hidden ext-plist to-buffer body-only pub-dir) @@ -3311,6 +3323,8 @@ PUB-DIR is set, use this as the publishing directory." "\n" org-export-html-scripts)) (html-extension (plist-get opt-plist :html-extension)) (link-validate (plist-get opt-plist :link-validation-function)) + (html-extension (plist-get opt-plist :html-extension)) + (custom-html-function (or (plist-get opt-plist :custom-html-function) 'org-exp-custom-html-function)) valid thetoc have-headings first-heading-pos (odd org-odd-levels-only) (region-p (org-region-active-p)) @@ -3494,12 +3508,14 @@ lang=\"%s\" xml:lang=\"%s\"> " language language (org-html-expand title) (or charset "iso-8859-1") date author style)) - + (insert (funcall custom-html-function "body" t)) (insert (or (plist-get opt-plist :preamble) "")) (when (plist-get opt-plist :auto-preamble) - (if title (insert (format org-export-html-title-format - (org-html-expand title)))))) + (if title (insert (concat + (funcall custom-html-function "title" t) + (format org-export-html-title-format (org-html-expand title)) + (funcall custom-html-function "title")))))) (if (and org-export-with-toc (not body-only)) (progn @@ -4047,6 +4063,7 @@ lang=\"%s\" xml:lang=\"%s\"> "\n")) (unless body-only (when (plist-get opt-plist :auto-postamble) + (insert (funcall custom-html-function "postamble" t)) (insert "
") (when (and org-export-author-info author) (insert "

" @@ -4067,11 +4084,13 @@ lang=\"%s\" xml:lang=\"%s\"> (when org-export-creator-info (insert (format "

HTML generated by org-mode %s in emacs %s

\n" org-version emacs-major-version))) - (insert "
")) + (insert "") + (insert (funcall custom-html-function "postamble"))) (if org-export-html-with-timestamp (insert org-export-html-html-helper-timestamp)) (insert (or (plist-get opt-plist :postamble) "")) + (insert (funcall custom-html-function "body")) (insert "\n\n")) (unless (plist-get opt-plist :buffer-will-be-killed) @@ -4092,9 +4111,11 @@ lang=\"%s\" xml:lang=\"%s\"> (when (looking-at "\\s-*

") (goto-char (match-end 0)) (insert "\n"))) + (insert (funcall custom-html-function "toc" t)) (insert "
\n") (mapc 'insert thetoc) (insert "
\n")) + (insert (funcall custom-html-function "toc")) ;; remove empty paragraphs and lists (goto-char (point-min)) (while (re-search-forward "

[ \r\n\t]*

" nil t)