Subject: [PATCH] Add HTML5 tags to HTML mode
From: Simen Heggestøyl <[email-masked]>
To: [email-masked]
Cc: Stefan Monnier <[email-masked]>
Date: Fri, 15 Apr 2016 17:43:27 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

The attached patch adds a bunch of HTML5 tags to `html-tag-alist' and
descriptions of those to `html-tag-help'.

This will benefit CSS mode in the future, since I'm planning to let it
use `html-tag-alist' to provide completion candidates for HTML tags in
CSS selectors.

-- Simen
From 2030bca157d51df4ddc3e5c3e4d14f30d9061f5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= <[email-masked]>
Date: Fri, 15 Apr 2016 17:36:10 +0200
Subject: [PATCH] Add HTML5 tags to HTML mode

* lisp/textmodes/sgml-mode.el (html-tag-alist): Add HTML5 tags.
(html-tag-help): Add short descriptions of those tags.
---
 lisp/textmodes/sgml-mode.el | 51 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 0937c00..990c09b 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -1818,6 +1818,8 @@ html-tag-alist
       ("col" t ,@cellhalign ,@cellvalign ("span") ("width"))
       ("colgroup" \n ,@cellhalign ,@cellvalign ("span") ("width"))
       ("dir" ,@list)
+      ("figcaption")
+      ("figure" \n)
       ("font" nil "size" ("-1") ("+1") ("-2") ("+2") ,@1-7)
       ("form" (\n _ \n "<input type=\"submit\" value=\"\""
 	       (if sgml-xml-mode " />" ">"))
@@ -1872,7 +1874,13 @@ html-tag-alist
       ("article" \n)
       ("aside" \n)
       ("au")
+      ("audio" \n
+       ("src") ("crossorigin" ("anonymous") ("use-credentials"))
+       ("preload" ("none") ("metadata") ("auto"))
+       ("autoplay" "autoplay") ("mediagroup") ("loop" "loop")
+       ("muted" "muted") ("controls" "controls"))
       ("b")
+      ("bdi")
       ("bdo" nil ("lang") ("dir" ("ltr") ("rtl")))
       ("big")
       ("blink")
@@ -1885,10 +1893,12 @@ html-tag-alist
        ("type" ("submit") ("reset") ("button"))
        ("disabled" "disabled")
        ("tabindex") ("accesskey") ("onfocus") ("onblur"))
+      ("canvas" \n ("width") ("height"))
       ("caption" ("valign" ("top") ("bottom")))
       ("center" \n)
       ("cite")
       ("code" \n)
+      ("datalist" \n)
       ("dd" ,(not sgml-xml-mode))
       ("del" nil ("cite") ("datetime"))
       ("dfn")
@@ -1900,6 +1910,7 @@ html-tag-alist
       ("dt" (t _ (if sgml-xml-mode "</dt>")
              "<dd>" (if sgml-xml-mode "</dd>") \n))
       ("em")
+      ("embed" t ("src") ("type") ("width") ("height"))
       ("fieldset" \n)
       ("fn" "id" "fn")  ;; Footnotes were deprecated in HTML 3.2
       ("footer" \n)
@@ -1928,9 +1939,13 @@ html-tag-alist
       ("lang")
       ("legend" nil ("accesskey"))
       ("li" ,(not sgml-xml-mode))
+      ("main" \n)
       ("map" \n ("name"))
+      ("mark")
       ("math" \n)
       ("meta" t ("http-equiv") ("name") ("content") ("scheme"))
+      ("meter" nil ("value") ("min") ("max") ("low") ("high")
+       ("optimum"))
       ("nav" \n)
       ("nobr")
       ("noframes" \n)
@@ -1942,18 +1957,24 @@ html-tag-alist
        ("disabled" "disabled") ("tabindex") ("onfocus") ("onblur")
        ("onchange"))
       ("option" t ("value") ("label") ("selected" t))
+      ("output" nil ("for") ("form") ("name"))
       ("over" t)
       ("param" t ("name") ("value")
        ("valuetype" ("data") ("ref") ("object")) ("type"))
       ("person") ;; Tag for person's name tag deprecated in HTML 3.2
       ("pre" \n)
+      ("progress" nil ("value") ("max"))
       ("q" nil ("cite"))
       ("rev")
+      ("rp" t)
+      ("rt" t)
+      ("ruby")
       ("s")
       ("samp")
       ("script" nil ("charset") ("type") ("src") ("defer" "defer"))
       ("section" \n)
       ("small")
+      ("source" t ("src") ("type") ("media"))
       ("span" nil
 	("class"
 	 ("builtin")
@@ -1968,12 +1989,23 @@ html-tag-alist
       ("strong")
       ("style" \n ("type") ("media") ("title"))
       ("sub")
+      ("summary")
       ("sup")
+      ("time" nil ("datetime"))
       ("title")
       ("tr" t)
+      ("track" t
+       ("kind" ("subtitles") ("captions") ("descriptions")
+        ("chapters") ("metadata"))
+       ("src") ("srclang") ("label") ("default"))
       ("tt")
       ("u")
       ("var")
+      ("video" \n
+       ("src") ("crossorigin" ("anonymous") ("use-credentials"))
+       ("poster") ("preload" ("none") ("metadata") ("auto"))
+       ("autoplay" "autoplay") ("mediagroup") ("loop" "loop")
+       ("muted" "muted") ("controls" "controls") ("width") ("height"))
       ("wbr" t)))
   "Value of `sgml-tag-alist' for HTML mode.")
 
@@ -1988,8 +2020,10 @@ html-tag-help
     ("article" . "An independent part of document or site")
     ("aside" . "Secondary content related to surrounding content (e.g. page or article)")
     ("au" . "Author")
+    ("audio" . "Sound or audio stream")
     ("b" . "Bold face")
     ("base" . "Base address for URLs")
+    ("bdi" . "Text isolated for bidirectional formatting")
     ("bdo" . "Override text directionality")
     ("big" . "Font size")
     ("blink" . "Blinking text")
@@ -1998,6 +2032,7 @@ html-tag-help
     ("box" . "Math fraction")
     ("br" . "Line break")
     ("button" . "Clickable button")
+    ("canvas" . "Script generated graphics canvas")
     ("caption" . "Table caption")
     ("center" . "Centered text")
     ("changed" . "Change bars")
@@ -2005,6 +2040,7 @@ html-tag-help
     ("code" . "Formatted source code")
     ("col" . "Group of attribute specifications for table columns")
     ("colgroup" . "Group of columns")
+    ("datalist" . "A set of predefined options")
     ("dd" . "Definition of term")
     ("del" . "Deleted text")
     ("dfn" . "Defining instance of a term")
@@ -2017,8 +2053,10 @@ html-tag-help
     ("fieldset" . "Group of related controls and labels")
     ("fig" . "Figure")
     ("figa" . "Figure anchor")
+    ("figcaption" . "Caption for a figure")
     ("figd" . "Figure description")
     ("figt" . "Figure text")
+    ("figure" . "Self-contained content, often with a caption")
     ("fn" . "Footnote")  ;; No one supports special footnote rendering.
     ("font" . "Font size")
     ("footer" . "Footer of a section")
@@ -2049,10 +2087,13 @@ html-tag-help
     ("legend" . "Caption for a fieldset")
     ("li" . "List item")
     ("link" . "Link relationship")
+    ("main" . "Main content of the document body")
     ("map" . "Image map (a clickable link area")
+    ("mark" . "Highlighted text")
     ("math" . "Math formula")
     ("menu" . "List of commands")
     ("meta" . "Document properties")
+    ("meter" . "Scalar measurement within a known range")
     ("mh" . "Form mail header")
     ("nav" . "Group of navigational links")
     ("nextid" . "Allocate new id")
@@ -2063,25 +2104,32 @@ html-tag-help
     ("ol" . "Ordered list")
     ("optgroup" . "Group of options")
     ("option" . "Selection list item")
+    ("output" . "Result of a calculation or user action")
     ("over" . "Math fraction rule")
     ("p" . "Paragraph start")
     ("panel" . "Floating panel")
     ("param" . "Parameters for an object")
     ("person" . "Person's name")
     ("pre" . "Preformatted fixed width text")
+    ("progress" . "Completion progress of a task")
     ("q" . "Quotation")
     ("rev" . "Reverse video")
+    ("rp" . "Fallback text for when ruby annotations aren't supported")
+    ("rt" . "Ruby text component of a ruby annotation")
+    ("ruby" . "Ruby annotation")
     ("s" . "Strikeout")
     ("samp" . "Sample text")
     ("script" . "Executable script within a document")
     ("section" . "Section of a document")
     ("select" . "Selection list")
     ("small" . "Font size")
+    ("source" . "Media resource for media elements")
     ("sp" . "Nobreak space")
     ("span" . "Generic inline container")
     ("strong" . "Standout text")
     ("style" . "Style information")
     ("sub" . "Subscript")
+    ("summary" . "Summary, caption, or legend")
     ("sup" . "Superscript")
     ("table" . "Table with rows and columns")
     ("tb" . "Table vertical break")
@@ -2091,12 +2139,15 @@ html-tag-help
     ("tfoot" . "Table foot")
     ("th" . "Table header cell")
     ("thead" . "Table head")
+    ("time" . "Content with optional machine-readable timestamp")
     ("title" . "Document title")
     ("tr" . "Table row separator")
+    ("track" . "Timed text track for media elements")
     ("tt" . "Typewriter face")
     ("u" . "Underlined text")
     ("ul" . "Unordered list")
     ("var" . "Math variable face")
+    ("video" . "Video or movie")
     ("wbr" . "Enable <br> within <nobr>"))
   "Value of variable `sgml-tag-help' for HTML mode.")
 
-- 
2.8.0.rc3