浏览代码

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
Kodi Arfer 12 年之前
父节点
当前提交
535bf4a1f2
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 7 3
      lisp/ox-html.el

+ 7 - 3
lisp/ox-html.el

@@ -1928,9 +1928,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)
@@ -1938,7 +1942,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.