Whoops. Wrong key. Patch actually attached to this email...
rick
From d95a365f547fdc681c530c9088f775b30a37d9aa Mon Sep 17 00:00:00 2001
From: Rick Frankel <r...@rickster.com>
Date: Tue, 30 Apr 2013 10:35:14 -0400
Subject: [PATCH] Modify processing of xhtml declaration.

* lisp/ox-html.el (org-html-template): If `org-html-xml-declaration'
  is nil or an empty string, don't output a blank line at the head of
  the document. Also, don't ouput the declaration if the document type
  is xhtml5.
---
 lisp/ox-html.el | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index e7cae1a..05b99bf 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1692,19 +1692,21 @@ holding export options."
 CONTENTS is the transcoded contents string.  INFO is a plist
 holding export options."
   (concat
-   (when (org-html-xhtml-p info)
-     (format "%s\n"
-	     (format (or (and (stringp org-html-xml-declaration)
+   (when (and (not (org-html-html5-p info)) (org-html-xhtml-p info))
+     (let ((decl (or (and (stringp org-html-xml-declaration)
 			      org-html-xml-declaration)
 			 (cdr (assoc (plist-get info :html-extension)
 				     org-html-xml-declaration))
 			 (cdr (assoc "html" org-html-xml-declaration))
 
-			 "")
-		     (or (and org-html-coding-system
-			      (fboundp 'coding-system-get)
-			      (coding-system-get org-html-coding-system 'mime-charset))
-			 "iso-8859-1"))))
+			 "")))
+       (when (not (or (eq nil decl) (string= "" decl)))
+	 (format "%s\n"
+		 (format decl
+		  (or (and org-html-coding-system
+			   (fboundp 'coding-system-get)
+			   (coding-system-get org-html-coding-system 'mime-charset))
+		      "iso-8859-1"))))))
    (let* ((dt (plist-get info :html-doctype))
 	  (dt-cons (assoc dt org-html-doctype-alist)))
      (if dt-cons
-- 
1.8.0

Reply via email to