emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Only use HTML5 fancy elements in HTML5
Date: Mon, 17 Aug 2015 23:50:35 +0800	[thread overview]
Message-ID: <877fot6his.fsf@ericabrahamsen.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Only-use-HTML5-fancy-elements-in-HTML5.patch --]
[-- Type: text/x-diff, Size: 1224 bytes --]

From 921081b428445d42f2ee82b9be9135a95db9e084 Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@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	other threads:[~2015-08-17 15:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17 15:50 Eric Abrahamsen [this message]
2015-08-17 16:51 ` [PATCH] Only use HTML5 fancy elements in HTML5 Rasmus
2015-08-18  0:49   ` Eric Abrahamsen
2015-08-18 16:00     ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877fot6his.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).