unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23297: [PATCH] Add HTML5 tags to HTML mode
@ 2016-04-15 15:43 Simen Heggestøyl
  2016-04-15 19:30 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Simen Heggestøyl @ 2016-04-15 15:43 UTC (permalink / raw)
  To: 23297; +Cc: Stefan Monnier


[-- Attachment #1.1: Type: text/plain, Size: 280 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 368 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-HTML5-tags-to-HTML-mode.patch --]
[-- Type: text/x-patch, Size: 8268 bytes --]

From 2030bca157d51df4ddc3e5c3e4d14f30d9061f5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= <simenheg@gmail.com>
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


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

* bug#23297: [PATCH] Add HTML5 tags to HTML mode
  2016-04-15 15:43 bug#23297: [PATCH] Add HTML5 tags to HTML mode Simen Heggestøyl
@ 2016-04-15 19:30 ` Stefan Monnier
  2016-04-17 17:40   ` Simen Heggestøyl
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2016-04-15 19:30 UTC (permalink / raw)
  To: Simen Heggestøyl; +Cc: 23297

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

Looks fine to me.

It'd be great to extract that from the relaxng compact schema, tho
(i.e. use nxml).


        Stefan





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

* bug#23297: [PATCH] Add HTML5 tags to HTML mode
  2016-04-15 19:30 ` Stefan Monnier
@ 2016-04-17 17:40   ` Simen Heggestøyl
  2016-04-18  0:10     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Simen Heggestøyl @ 2016-04-17 17:40 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 23297-done

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

On Fri, Apr 15, 2016 at 9:30 PM, Stefan Monnier 
<monnier@iro.umontreal.ca> wrote:
> Looks fine to me.

Thanks, installed in master.

> It'd be great to extract that from the relaxng compact schema, tho
> (i.e. use nxml).

I don't understand what that means. Could you elaborate?

-- Simen

[-- Attachment #2: Type: text/html, Size: 559 bytes --]

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

* bug#23297: [PATCH] Add HTML5 tags to HTML mode
  2016-04-17 17:40   ` Simen Heggestøyl
@ 2016-04-18  0:10     ` Stefan Monnier
  2016-04-20 17:52       ` Simen Heggestøyl
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2016-04-18  0:10 UTC (permalink / raw)
  To: Simen Heggestøyl; +Cc: 23297-done

>> It'd be great to extract that from the relaxng compact schema, tho
>> (i.e. use nxml).
> I don't understand what that means. Could you elaborate?

The nxml mode knows how to read a relaxng schema which describes the
valid grammar of a given kind of XML document.  E.g. it can use it to
give you things like context-aware completion of xml elements
and attributes.

Emacs comes with the relaxng schema for HTML4 and there's a relaxng
schema for HTML5 in GNU ELPA.

So nxml can provide in an automated way most of what's in
html-tag-alist.


        Stefan





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

* bug#23297: [PATCH] Add HTML5 tags to HTML mode
  2016-04-18  0:10     ` Stefan Monnier
@ 2016-04-20 17:52       ` Simen Heggestøyl
  0 siblings, 0 replies; 5+ messages in thread
From: Simen Heggestøyl @ 2016-04-20 17:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 23297-done

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

On Mon, Apr 18, 2016 at 2:10 AM, Stefan Monnier 
<monnier@iro.umontreal.ca> wrote:
> The nxml mode knows how to read a relaxng schema which describes the
> valid grammar of a given kind of XML document.  E.g. it can use it to
> give you things like context-aware completion of xml elements
> and attributes.
> 
> Emacs comes with the relaxng schema for HTML4 and there's a relaxng
> schema for HTML5 in GNU ELPA.
> 
> So nxml can provide in an automated way most of what's in
> html-tag-alist.
> 
> 
>         Stefan

I see, thanks for the explanation. It sounds like a good idea.

-- Simen

[-- Attachment #2: Type: text/html, Size: 717 bytes --]

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

end of thread, other threads:[~2016-04-20 17:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-15 15:43 bug#23297: [PATCH] Add HTML5 tags to HTML mode Simen Heggestøyl
2016-04-15 19:30 ` Stefan Monnier
2016-04-17 17:40   ` Simen Heggestøyl
2016-04-18  0:10     ` Stefan Monnier
2016-04-20 17:52       ` Simen Heggestøyl

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).