Browse Source

HTML export: Make xml declaration configurable

Carsten Dominik 16 years ago
parent
commit
f5fc821214
5 changed files with 24 additions and 5 deletions
  1. 4 0
      doc/ChangeLog
  2. 1 0
      doc/org.texi
  3. 7 0
      lisp/ChangeLog
  4. 1 0
      lisp/org-exp.el
  5. 11 5
      lisp/org-html.el

+ 4 - 0
doc/ChangeLog

@@ -1,3 +1,7 @@
+2009-05-20  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.texi (Publishing options): Document :xml-declaration.
+
 2009-05-19  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.texi (Tracking TODO state changes): Document the

+ 1 - 0
doc/org.texi

@@ -9397,6 +9397,7 @@ respective variable for details.
 @item @code{:convert-org-links}     @tab @code{org-export-html-link-org-files-as-html}
 @item @code{:inline-images}         @tab @code{org-export-html-inline-images}
 @item @code{:html-extension}        @tab @code{org-export-html-extension}
+@item @code{:xml-declaration}       @tab @code{org-export-html-xml-declaration}
 @item @code{:html-table-tag}        @tab @code{org-export-html-table-tag}
 @item @code{:expand-quoted-html}    @tab @code{org-export-html-expand}
 @item @code{:timestamp}             @tab @code{org-export-html-with-timestamp}

+ 7 - 0
lisp/ChangeLog

@@ -1,3 +1,10 @@
+2009-05-20  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-exp.el (org-export-plist-vars): Add :xml-declaration.
+
+	* org-html.el (org-export-html-xml-declaration): New option.
+	(org-export-as-html): Use `org-export-html-xml-declaration'.
+
 2009-05-19  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-publish.el (org-publish): Make this function behave

+ 1 - 0
lisp/org-exp.el

@@ -566,6 +566,7 @@ much faster."
     (:convert-org-links	      nil	  org-export-html-link-org-files-as-html)
     (:inline-images	      nil	  org-export-html-inline-images)
     (:html-extension	      nil	  org-export-html-extension)
+    (:xml-declaration         nil	  org-export-html-xml-declaration)
     (:html-table-tag	      nil	  org-export-html-table-tag)
     (:expand-quoted-html      "@"	  org-export-html-expand)
     (:timestamp		      nil	  org-export-html-with-timestamp)

+ 11 - 5
lisp/org-html.el

@@ -59,6 +59,13 @@ by the footnotes themselves."
   :group 'org-export-html
   :type 'string)
 
+(defcustom org-export-html-xml-declaration
+  "<?xml version=\"1.0\" encoding=\"%s\"?>"
+  "The extension for exported HTML files.
+%s will be replaced with the charset of the exported file."
+  :group 'org-export-html
+  :type 'string)
+
 (defcustom org-export-html-style-include-scripts t
   "Non-nil means, include the javascript snippets in exported HTML files.
 The actual script is defined in `org-export-html-scripts' and should
@@ -669,7 +676,8 @@ PUB-DIR is set, use this as the publishing directory."
       (unless body-only
 	;; File header
 	(insert (format
-		 "%s<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
+		 "%s
+<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
                \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
 <html xmlns=\"http://www.w3.org/1999/xhtml\"
 lang=\"%s\" xml:lang=\"%s\">
@@ -686,10 +694,8 @@ lang=\"%s\" xml:lang=\"%s\">
 <body>
 <div id=\"content\">
 "
-		 (if (equal html-extension "php")
-		     "" ; protect php files from short tag problem  FIXME
-		   (format "<?xml version=\"1.0\" encoding=\"%s\"?>\n"
-			   (or charset "iso-8859-1")))
+		 (format org-export-html-xml-declaration
+			 (or charset "iso-8859-1")))
 		 language language (org-html-expand title)
 		 (or charset "iso-8859-1")
 		 date author description keywords