emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ox-html: Under html5-fancy, use <nav> for the ToC
@ 2013-06-01 21:50 Kodi Arfer
  2013-07-09 20:52 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Kodi Arfer @ 2013-06-01 21:50 UTC (permalink / raw)
  To: emacs-orgmode

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

While I admit I'm not totally sure, in general, when a given fancy HTML5 
element is appropriate, this case (an intra-page table of contents) 
seems right in line with the second code example here:

http://www.w3.org/html/wg/drafts/html/master/sections.html#the-nav-element

[-- Attachment #2: 0001-ox-html-Under-html5-fancy-use-nav-for-the-ToC.patch --]
[-- Type: text/x-patch, Size: 1576 bytes --]

From a1aa357f75cd37ef676f5ac4dbbe66ad66d76aa8 Mon Sep 17 00:00:00 2001
From: Kodi Arfer <git@arfer.net>
Date: Sat, 1 Jun 2013 17:41:38 -0400
Subject: [PATCH] ox-html: Under html5-fancy, use <nav> for the ToC

* lisp/ox-html.el (org-html-toc): Use <nav> instead of <div>
  for the root element when appropriate.

TINYCHANGE
---
 lisp/ox-html.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index facd84c..10891ce 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1912,9 +1912,13 @@ contents as a string, or nil if it is empty."
 	 (mapcar (lambda (headline)
 		   (cons (org-html--format-toc-headline headline info)
 			 (org-export-get-relative-level headline info)))
-		 (org-export-collect-headlines info depth))))
+		 (org-export-collect-headlines info depth)))
+	(outer-tag (if (and (org-html-html5-p info)
+			    (plist-get info :html-html5-fancy))
+		       "nav"
+		     "div")))
     (when toc-entries
-      (concat "<div id=\"table-of-contents\">\n"
+      (concat (format "<%s id=\"table-of-contents\">\n" outer-tag)
 	      (format "<h%d>%s</h%d>\n"
 		      org-html-toplevel-hlevel
 		      (org-html--translate "Table of Contents" info)
@@ -1922,7 +1926,7 @@ contents as a string, or nil if it is empty."
 	      "<div id=\"text-table-of-contents\">"
 	      (org-html--toc-text toc-entries)
 	      "</div>\n"
-	      "</div>\n"))))
+	      (format "</%s>\n" outer-tag)))))
 
 (defun org-html--toc-text (toc-entries)
   "Return innards of a table of contents, as a string.
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ox-html: Under html5-fancy, use <nav> for the ToC
  2013-06-01 21:50 [PATCH] ox-html: Under html5-fancy, use <nav> for the ToC Kodi Arfer
@ 2013-07-09 20:52 ` Nicolas Goaziou
  2013-07-10  3:26   ` Eric Abrahamsen
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2013-07-09 20:52 UTC (permalink / raw)
  To: Kodi Arfer; +Cc: emacs-orgmode

Hello,

Kodi Arfer <kodi@arfer.net> writes:

> While I admit I'm not totally sure, in general, when a given fancy
> HTML5 element is appropriate, this case (an intra-page table of
> contents) seems right in line with the second code example here:
>
> http://www.w3.org/html/wg/drafts/html/master/sections.html#the-nav-element
>
> From a1aa357f75cd37ef676f5ac4dbbe66ad66d76aa8 Mon Sep 17 00:00:00 2001
> From: Kodi Arfer <git@arfer.net>
> Date: Sat, 1 Jun 2013 17:41:38 -0400
> Subject: [PATCH] ox-html: Under html5-fancy, use <nav> for the ToC
>
> * lisp/ox-html.el (org-html-toc): Use <nav> instead of <div>
>   for the root element when appropriate.

Applied. Thank you.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ox-html: Under html5-fancy, use <nav> for the ToC
  2013-07-09 20:52 ` Nicolas Goaziou
@ 2013-07-10  3:26   ` Eric Abrahamsen
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Abrahamsen @ 2013-07-10  3:26 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> Kodi Arfer <kodi@arfer.net> writes:
>
>> While I admit I'm not totally sure, in general, when a given fancy
>> HTML5 element is appropriate, this case (an intra-page table of
>> contents) seems right in line with the second code example here:
>>
>> http://www.w3.org/html/wg/drafts/html/master/sections.html#the-nav-element
>>
>> From a1aa357f75cd37ef676f5ac4dbbe66ad66d76aa8 Mon Sep 17 00:00:00 2001
>> From: Kodi Arfer <git@arfer.net>
>> Date: Sat, 1 Jun 2013 17:41:38 -0400
>> Subject: [PATCH] ox-html: Under html5-fancy, use <nav> for the ToC
>>
>> * lisp/ox-html.el (org-html-toc): Use <nav> instead of <div>
>>   for the root element when appropriate.
>
> Applied. Thank you.

Back when we were putting together the html5 stuff, I think we agreed to
table the issue of deeper html5 tag use until we'd had a bit of think
about the current default behavior of org's html output. Not that I
don't think this patch should be accepted -- it's definitely the least
controversial of the html5 tags.

At the time I think I was thinking that the html org produces by default
seemed very much predicated on the creation of unix-y style
documentation pages: the prev/next/up links, the preamble and postamble,
etc. That seemed strange to me, as my assumption was that most people
are not going to be producing that kind of html page. In retrospect that
doesn't seem like such a big deal -- it's so easy to turn off, and
there's always the body-only switch.

So maybe it would just be enough to patch html5 further so that the
preamble and postamble use <header> and <footer> tags? The behavior of
`org-html-divs' would have to be reconsidered, but it shouldn't have to
be anything too momentous...

Eric

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-10  3:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-01 21:50 [PATCH] ox-html: Under html5-fancy, use <nav> for the ToC Kodi Arfer
2013-07-09 20:52 ` Nicolas Goaziou
2013-07-10  3:26   ` Eric Abrahamsen

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).