Currently, if the global variable `org-html-html5-fancy' is t, some
elements of HTML export will use fancy elements even when not exporting
to HTML5 at all.

Specifically, the TITLE of a document will be wrapped in <header> tags,
even when exporting to XHTML4. I ran into this while making some epub
files and the syntax checker barked at me.

This patch fills out the check. There's growing redundancy in this file
now -- if it seems desirable to have a `org-html-html5-fancy-p' function
that encapsulates the paired checks, I'd be happy to provide that.

E

>From 921081b428445d42f2ee82b9be9135a95db9e084 Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <e...@ericabrahamsen.net>
Date: Mon, 17 Aug 2015 23:41:19 +0800
Subject: [PATCH] Only use HTML5 fancy elements in HTML5

* lisp/ox-html.el (org-html-template): The check for HTML5 fancy
  elements should only apply when exporting to HTML5.
---
 lisp/ox-html.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index bdcdeee..4f94090 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1932,13 +1932,15 @@ holding export options."
 	   (subtitle (plist-get info :subtitle)))
        (when title
 	 (format
-	  (if (plist-get info :html-html5-fancy)
+	  (if (and (org-html-html5-p info)
+		   (plist-get info :html-html5-fancy))
 	      "<header>\n<h1 class=\"title\">%s</h1>\n%s</header>"
 	    "<h1 class=\"title\">%s%s</h1>\n")
 	  (org-export-data title info)
 	  (if subtitle
 	      (format
-	       (if (plist-get info :html-html5-fancy)
+	       (if (and (org-html-html5-p info)
+			(plist-get info :html-html5-fancy))
 		   "<p class=\"subtitle\">%s</p>\n"
 		 "\n<br>\n<span class=\"subtitle\">%s</span>\n")
 	       (org-export-data subtitle info))
-- 
2.5.0

Reply via email to