>From 990063c31f1f365667017b4780a347ff9dbdeb1c Mon Sep 17 00:00:00 2001 From: Bastien Guerry
Date: Wed, 9 Mar 2011 17:13:40 +0100 Subject: [PATCH] Rework org-export-html-preamble/postamble (again). * org-html.el (org-export-html-insert-plist-item): Remove. (org-export-html-preamble): Default to `t'. Accept functions. (org-export-html-postamble): Default to `auto'. Accept functions and distinguish between 'auto (no formatting string) and `t' (default formatting string). (org-export-as-html): Handle org-export-html-preamble and org-export-html-postamble new defaults/allowed values. --- lisp/org-html.el | 158 ++++++++++++++++++++++++++++++++---------------------- 1 files changed, 93 insertions(+), 65 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index c60c90d..d5ea1a3 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -343,13 +343,22 @@ CSS classes, then this prefix can be very useful." :group 'org-export-html :type 'string) -(defcustom org-export-html-preamble nil +(defcustom org-export-html-preamble t "Non-nil means insert a preamble in HTML export. -If this is a string, use it as a formatting string it instead of -`org-export-html-preamble-format'. Setting :html-preamble in -publishing projects will override this." +When `t', insert a string as defined by +`org-export-html-preamble-format'. When set to a string, this +string overrides `org-export-html-preamble-format'. When set to +a function, apply this function and insert the returned string. +The function takes the property list of export options as its +only argument. + +Setting :html-preamble in publishing projects will take +precedence over this variable." :group 'org-export-html - :type 'boolean) + :type '(choice (const :tag "No preamble" nil) + (const :tag "Default preamble" t) + (string :tag "Custom formatting string") + (function :tag "Function (must return a string)"))) (defcustom org-export-html-preamble-format '(("en" "<" email ">
\n")) - (when (plist-get opt-plist :creator-info) - (insert "" - (concat "Org version " org-version " with Emacs version " - (number-to-string emacs-major-version) "
\n"))) - (insert html-validation-link "\n<" email ">
\n")) + (when (plist-get opt-plist :creator-info) + (insert "" + (concat "Org version " org-version " with Emacs version " + (number-to-string emacs-major-version) "
\n"))) + (insert html-validation-link "\n