Browse Source

Make sure :html-pre/postamble can insert the output of a custom function.

This function must have no argument and must output a string to be inserted
in the HTML export.

Thanks to Sander Boer for pointing at this.
Bastien Guerry 13 years ago
parent
commit
3482284bbd
2 changed files with 9 additions and 5 deletions
  1. 7 3
      doc/org.texi
  2. 2 2
      lisp/org-html.el

+ 7 - 3
doc/org.texi

@@ -9766,10 +9766,14 @@ The HTML exporter lets you define a preamble and a postamble.
 
 The default value for @code{org-export-html-preamble} is @code{t}, which
 means that the preamble is inserted depending on the relevant formatting
-string in @code{org-export-html-preamble-format}.  Setting
-@code{org-export-html-preamble} to a string will override the default
+string in @code{org-export-html-preamble-format}.
+
+Setting @code{org-export-html-preamble} to a string will override the default
 formatting string.  Setting it to a function, will insert the output of the
-function.  Setting to @code{nil} will not insert any preamble.
+function, which must be a string; such a function takes no argument but you
+can check against the value of @code{opt-plist}, which contains the list of
+publishing properties for the current file.  Setting to @code{nil} will not
+insert any preamble.
 
 The default value for @code{org-export-html-postamble} is @code{'auto}, which
 means that the HTML exporter will look for the value of

+ 2 - 2
lisp/org-html.el

@@ -1335,7 +1335,7 @@ lang=\"%s\" xml:lang=\"%s\">
 		    (format-spec html-pre `((?t . ,title) (?a . ,author)
 					    (?d . ,date) (?e . ,email)))))
 		  ((functionp html-pre)
-		   (funcall html-pre opt-plist))
+		   (funcall html-pre))
 		  (t
 		   (insert
 		    (format-spec
@@ -1768,7 +1768,7 @@ lang=\"%s\" xml:lang=\"%s\">
 					  (?v . ,html-validation-link))))
 		   (insert "</div>"))
 		  ((functionp html-post)
-		   (funcall html-post opt-plist))
+		   (funcall html-post))
 		  ((eq html-post 'auto)
 		   ;; fall back on default postamble
 		   (insert "<div id=\"postamble\">\n")