.
+
+Headlines cannot appear within special blocks. To wrap a headline and its
+contents in e.g.
or tags, set the @code{HTML_CONTAINER}
+property on the headline itself.
@node HTML preamble and postamble, Quoting HTML tags, HTML doctypes, HTML export
@subsection HTML preamble and postamble
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 8223a18..e7cae1a 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -116,6 +116,7 @@
(:html-link-org-as-html nil nil org-html-link-org-files-as-html)
(:html-doctype "HTML_DOCTYPE" nil org-html-doctype)
(:html-container "HTML_CONTAINER" nil org-html-container-element)
+ (:html-html5-fancy "HTML_HTML5_FANCY" nil org-html-html5-fancy)
(:html-link-home "HTML_LINK_HOME" nil org-html-link-home)
(:html-link-up "HTML_LINK_UP" nil org-html-link-up)
(:html-mathjax "HTML_MATHJAX" nil "" space)
@@ -164,6 +165,17 @@
("xhtml5" . ""))
"An alist mapping (x)html flavors to specific doctypes.")
+(defconst org-html-html5-elements
+ '("article" "aside" "audio" "canvas" "details" "figcaption"
+ "figure" "footer" "header" "menu" "meter" "nav" "output"
+ "progress" "section" "video")
+ "New elements in html5.
+
+ is not included because it's currently impossible to
+wrap special blocks around multiple headlines. For other blocks
+that should contain headlines, use the HTML_CONTAINER property on
+the headline itself.")
+
(defconst org-html-special-string-regexps
'(("\\\\-" . "") ; shy
("---\\([^-]\\)" . "—\\1") ; mdash
@@ -906,6 +918,21 @@ publishing, with :html-doctype."
:package-version '(Org . "8.0")
:type 'string)
+(defcustom org-html-html5-fancy nil
+ "When exporting to HTML5, set this to t to use new HTML5
+ elements. This variable is ignored for anything other than
+ HTML5.
+
+For compatibility with Internet Explorer, it's probably a good
+idea to download some form of the html5shiv (for instance
+https://code.google.com/p/html5shiv/) and add it to your
+HTML_HEAD_EXTRA, so that your pages don't break for users of IE
+versions 8 and below."
+ :group 'org-export-html
+ :version "24.4"
+ :package-version '(Org . "8.0")
+ :type 'boolean)
+
(defcustom org-html-container-element "div"
"HTML element to use for wrapping top level sections.
Can be set with the in-buffer HTML_CONTAINER property or for
@@ -1308,14 +1335,20 @@ When STANDALONE-P is t, wrap the into a ...
."
(org-find-text-property-in-string
'org-latex-src src))))
(t (format " alt=\"%s\""
- (file-name-nondirectory src)))))))
+ (file-name-nondirectory src))))))
+ (html5-fancy (and (org-html-html5-p info)
+ (plist-get info :html-html5-fancy))))
(cond
(standalone-p
(let ((img (org-html-close-tag "img" attr info)))
- (format "\n%s%s\n
"
+ (format (if html5-fancy
+ "\n%s%s\n "
+ "\n%s%s\n
")
id (format "\n%s
" img)
(if (and caption (not (string= caption "")))
- (format "\n%s
" caption) ""))))
+ (format (if html5-fancy
+ "\n%s "
+ "\n%s
") caption) ""))))
(t (org-html-close-tag "img" (concat attr id) info)))))
(defun org-html--textarea-block (element)
@@ -2927,9 +2960,25 @@ contextual information."
"Transcode a SPECIAL-BLOCK element from Org to HTML.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
- (format "\n%s\n
"
- (downcase (org-element-property :type special-block))
- contents))
+ (let* ((block-type (downcase
+ (org-element-property :type special-block)))
+ (contents (or contents ""))
+ (html5-fancy (and (org-html-html5-p info)
+ (plist-get info :html-html5-fancy)
+ (member block-type org-html-html5-elements)))
+ (attributes (org-export-read-attribute :attr_html special-block)))
+ (unless html5-fancy
+ (let ((class (plist-get attributes :class)))
+ (setq attributes (plist-put attributes :class
+ (if class (concat class " " block-type)
+ block-type)))))
+ (setq attributes (org-html--make-attribute-string attributes))
+ (when (not (equal attributes ""))
+ (setq attributes (concat " " attributes)))
+ (if html5-fancy
+ (format "<%s%s>\n%s%s>" block-type attributes
+ contents block-type)
+ (format "\n%s\n
" attributes contents))))
;;;; Src Block
--
1.8.2.2