-;;; sgml-mode.el --- SGML- and HTML-editing modes -*- coding: utf-8 -*-
+;;; sgml-mode.el --- SGML- and HTML-editing modes -*- lexical-binding:t -*-
-;; Copyright (C) 1992, 1995-1996, 1998, 2001-2015 Free Software
+;; Copyright (C) 1992, 1995-1996, 1998, 2001-2016 Free Software
;; Foundation, Inc.
;; Author: James Clark <jjc@jclark.com>
:type 'integer
:group 'sgml)
+(defcustom sgml-attribute-offset 0
+ "Specifies a delta for attribute indentation in `sgml-indent-line'.
+
+When 0, attribute indentation looks like this:
+
+ <element
+ attribute=\"value\">
+ </element>
+
+When 2, attribute indentation looks like this:
+
+ <element
+ attribute=\"value\">
+ </element>"
+ :version "25.1"
+ :type 'integer
+ :safe 'integerp
+ :group 'sgml)
+
(defcustom sgml-xml-mode nil
"When non-nil, tag insertion functions will be XML-compliant.
It is set to be buffer-local when the file has
The supported characters and potential disadvantages are:
?\\\" Makes \" in text start a string.
- ?' Makes ' in text start a string.
+ ?\\=' Makes \\=' in text start a string.
?- Makes -- in text start a comment.
-When only one of ?\\\" or ?' are included, \"'\" or '\"', as can be found in
+When only one of ?\\\" or ?\\=' are included, \"\\='\" or \\='\"\\=', as can be found in
DTDs, start a string. To partially avoid this problem this also makes these
self insert as named entities depending on `sgml-quick-keys'.
(comment-style 'plain))
(comment-indent-new-line soft)))
-(defun sgml-mode-facemenu-add-face-function (face end)
+(defun sgml-mode-facemenu-add-face-function (face _end)
(let ((tag-face (cdr (assq face sgml-face-tag-alist))))
(cond (tag-face
(setq tag-face (funcall skeleton-transformation-function tag-face))
(define-derived-mode sgml-mode text-mode '(sgml-xml-mode "XML" "SGML")
"Major mode for editing SGML documents.
Makes > match <.
-Keys <, &, SPC within <>, \", / and ' can be electric depending on
+Keys <, &, SPC within <>, \", / and \\=' can be electric depending on
`sgml-quick-keys'.
An argument of N to a tag-inserting command means to wrap it around
the next N words. In Transient Mark mode, when the mark is active,
N defaults to -1, which means to wrap it around the current region.
-If you like upcased tags, put (setq sgml-transformation-function 'upcase)
+If you like upcased tags, put (setq sgml-transformation-function \\='upcase)
in your init file.
Use \\[sgml-validate] to validate your document with an SGML parser.
;; This is desirable because SGML discards a newline that appears
;; immediately after a start tag or immediately before an end tag.
(setq-local paragraph-start (concat "[ \t]*$\\|\
-\[ \t]*</?\\(" sgml-name-re sgml-attrs-re "\\)?>"))
+[ \t]*</?\\(" sgml-name-re sgml-attrs-re "\\)?>"))
(setq-local paragraph-separate (concat paragraph-start "$"))
(setq-local adaptive-fill-regexp "[ \t]*")
(add-hook 'fill-nobreak-predicate 'sgml-fill-nobreak nil t)
"Prompt for a tag and insert it, optionally with attributes.
Completion and configuration are done according to `sgml-tag-alist'.
If you like tags and attributes in uppercase, customize
-`sgml-transformation-function' to 'upcase."
+`sgml-transformation-function' to `upcase'."
(funcall (or skeleton-transformation-function 'identity)
(setq sgml-tag-last
(completing-read
(insert ?\s)
(insert (funcall skeleton-transformation-function
(setq attribute
- (skeleton-read '(completing-read
- "Attribute: "
- alist)))))
+ (skeleton-read (lambda ()
+ (completing-read
+ "Attribute: "
+ alist))))))
(if (string= "" attribute)
(setq i 0)
(sgml-value (assoc (downcase attribute) alist))
(setq arg (1- arg)))
return))
+(defun sgml-forward-sexp (n)
+ ;; This function is needed in major-modes such as nxml-mode where
+ ;; forward-sexp-function is used to give a more dwimish behavior to
+ ;; the `forward-sexp' command.
+ ;; Without it, we can end up with backtraces like:
+ ;; "get-text-property" (0xffffc0f0)
+ ;; "nxml-token-after" (0xffffc2ac)
+ ;; "nxml-forward-single-balanced-item" (0xffffc46c)
+ ;; "nxml-forward-balanced-item" (0xffffc61c)
+ ;; "forward-sexp" (0xffffc7f8)
+ ;; "sgml-parse-tag-backward" (0xffffc9c8)
+ ;; "sgml-lexical-context" (0xffffcba8)
+ ;; "sgml-mode-flyspell-verify" (0xffffcd74)
+ ;; "flyspell-word" (0xffffcf3c)
+ ;; "flyspell-post-command-hook" (0xffffd108)
+ ;; FIXME: should we also set the sgml-tag-syntax-table?
+ (let ((forward-sexp-function nil))
+ (forward-sexp n)))
+
(defvar sgml-electric-tag-pair-overlays nil)
(defvar sgml-electric-tag-pair-timer nil)
-(defun sgml-electric-tag-pair-before-change-function (beg end)
+(defun sgml-electric-tag-pair-before-change-function (_beg end)
(condition-case err
(save-excursion
(goto-char end)
(if endp
(when (sgml-skip-tag-backward 1) (forward-char 1) t)
(with-syntax-table sgml-tag-syntax-table
- (up-list -1)
- (when (sgml-skip-tag-forward 1)
- (backward-sexp 1)
- (forward-char 2)
- t))))
+ (let ((forward-sexp-function nil))
+ (up-list -1)
+ (when (sgml-skip-tag-forward 1)
+ (backward-sexp 1)
+ (forward-char 2)
+ t)))))
(clones (get-char-property (point) 'text-clones)))
(when (and match
(/= cl-end cl-start)
(or (get 'sgml-tag 'invisible)
(setplist 'sgml-tag
(append '(invisible t
- point-entered sgml-point-entered
+ cursor-sensor-functions (sgml-cursor-sensor)
rear-nonsticky t
read-only t)
(symbol-plist 'sgml-tag))))
(defun sgml-tags-invisible (arg)
"Toggle visibility of existing tags."
(interactive "P")
- (let ((modified (buffer-modified-p))
- (inhibit-read-only t)
- (inhibit-modification-hooks t)
- ;; Avoid spurious the `file-locked' checks.
- (buffer-file-name nil)
- ;; This is needed in case font lock gets called,
- ;; since it moves point and might call sgml-point-entered.
- ;; How could it get called? -stef
- (inhibit-point-motion-hooks t)
+ (let ((inhibit-read-only t)
string)
- (unwind-protect
- (save-excursion
- (goto-char (point-min))
- (if (setq-local sgml-tags-invisible
- (if arg
- (>= (prefix-numeric-value arg) 0)
- (not sgml-tags-invisible)))
- (while (re-search-forward sgml-tag-name-re nil t)
- (setq string
- (cdr (assq (intern-soft (downcase (match-string 1)))
- sgml-display-text)))
- (goto-char (match-beginning 0))
- (and (stringp string)
- (not (overlays-at (point)))
- (let ((ol (make-overlay (point) (match-beginning 1))))
- (overlay-put ol 'before-string string)
- (overlay-put ol 'sgml-tag t)))
- (put-text-property (point)
- (progn (forward-list) (point))
- 'category 'sgml-tag))
- (let ((pos (point-min)))
- (while (< (setq pos (next-overlay-change pos)) (point-max))
- (dolist (ol (overlays-at pos))
- (if (overlay-get ol 'sgml-tag)
- (delete-overlay ol)))))
- (remove-text-properties (point-min) (point-max) '(category nil))))
- (restore-buffer-modified-p modified))
+ (with-silent-modifications
+ (save-excursion
+ (goto-char (point-min))
+ (if (setq-local sgml-tags-invisible
+ (if arg
+ (>= (prefix-numeric-value arg) 0)
+ (not sgml-tags-invisible)))
+ (while (re-search-forward sgml-tag-name-re nil t)
+ (setq string
+ (cdr (assq (intern-soft (downcase (match-string 1)))
+ sgml-display-text)))
+ (goto-char (match-beginning 0))
+ (and (stringp string)
+ (not (overlays-at (point)))
+ (let ((ol (make-overlay (point) (match-beginning 1))))
+ (overlay-put ol 'before-string string)
+ (overlay-put ol 'sgml-tag t)))
+ (put-text-property (point)
+ (progn (forward-list) (point))
+ 'category 'sgml-tag))
+ (let ((pos (point-min)))
+ (while (< (setq pos (next-overlay-change pos)) (point-max))
+ (dolist (ol (overlays-at pos))
+ (if (overlay-get ol 'sgml-tag)
+ (delete-overlay ol)))))
+ (remove-text-properties (point-min) (point-max) '(category nil)))))
+ (cursor-sensor-mode (if sgml-tags-invisible 1 -1))
(run-hooks 'sgml-tags-invisible-hook)
(message "")))
-(defun sgml-point-entered (x y)
- ;; Show preceding or following hidden tag, depending of cursor direction.
- (let ((inhibit-point-motion-hooks t))
- (save-excursion
- (condition-case nil
- (message "Invisible tag: %s"
- ;; Strip properties, otherwise, the text is invisible.
- (buffer-substring-no-properties
- (point)
- (if (or (and (> x y)
- (not (eq (following-char) ?<)))
- (and (< x y)
- (eq (preceding-char) ?>)))
- (backward-list)
- (forward-list))))
- (error nil)))))
-
+(defun sgml-cursor-sensor (window x dir)
+ ;; Show preceding or following hidden tag, depending of cursor direction (and
+ ;; `dir' is not the direction in this sense).
+ (when (eq dir 'entered)
+ (ignore-errors
+ (let* ((y (window-point window))
+ (otherend
+ (save-excursion
+ (goto-char y)
+ (cond
+ ((and (eq (char-before) ?>)
+ (or (not (eq (char-after) ?<))
+ (> x y)))
+ (sgml-forward-sexp -1))
+ ((eq (char-after y) ?<)
+ (sgml-forward-sexp 1)))
+ (point))))
+ (message "Invisible tag: %s"
+ ;; Strip properties, otherwise, the text is invisible.
+ (buffer-substring-no-properties
+ y otherend))))))
\f
(defun sgml-validate (command)
((and state (> (nth 0 state) 0)) (cons 'tag (nth 1 state)))
(t (cons 'text text-start))))))
-(defun sgml-beginning-of-tag (&optional top-level)
+(defun sgml-beginning-of-tag (&optional only-immediate)
"Skip to beginning of tag and return its name.
If this can't be done, return nil."
(let ((context (sgml-lexical-context)))
(goto-char (cdr context))
(when (looking-at sgml-tag-name-re)
(match-string-no-properties 1)))
- (if top-level nil
+ (if only-immediate nil
(when (not (eq (car context) 'text))
(goto-char (cdr context))
(sgml-beginning-of-tag t))))))
(if (and (eq (car alist) t) (not sgml-xml-mode))
(when (cdr alist)
(insert "=\"")
- (setq alist (skeleton-read '(completing-read "Value: " (cdr alist))))
+ (setq alist (skeleton-read (lambda ()
+ (completing-read
+ "Value: " (cdr alist)))))
(if (string< "" alist)
(insert alist ?\")
(delete-char -2)))
(insert "=\"")
(if (cdr alist)
- (insert (skeleton-read '(completing-read "Value: " alist)))
+ (insert (skeleton-read (lambda ()
+ (completing-read "Value: " alist))))
(when (null alist)
(insert (skeleton-read '(read-string "Value: ")))))
(insert ?\"))))
(unless (or ;;(looking-at "</")
(progn (skip-chars-backward " \t") (bolp)))
(reindent-then-newline-and-indent))
- (forward-sexp 1)))
+ (sgml-forward-sexp 1)))
;; (indent-region beg end)
))
(let ((pos (point)))
(condition-case nil
;; FIXME: This does not correctly skip over PI an CDATA tags.
- (forward-sexp)
+ (sgml-forward-sexp 1)
(scan-error
;; This < seems to be just a spurious one, let's ignore it.
(goto-char pos)
(with-syntax-table sgml-tag-syntax-table
(goto-char tag-end)
(condition-case nil
- (backward-sexp)
+ (sgml-forward-sexp -1)
(scan-error
;; This > isn't really the end of a tag. Skip it.
(goto-char (1- tag-end))
(`pi nil)
(`tag
- (goto-char (1+ (cdr lcon)))
+ (goto-char (+ (cdr lcon) sgml-attribute-offset))
(skip-chars-forward "^ \t\n") ;Skip tag name.
(skip-chars-forward " \t")
(if (not (eolp))
(current-column)
;; This is the first attribute: indent.
- (goto-char (1+ (cdr lcon)))
+ (goto-char (+ (cdr lcon) sgml-attribute-offset))
(+ (current-column) sgml-basic-offset)))
(`text
(while (looking-at "</")
- (forward-sexp 1)
+ (sgml-forward-sexp 1)
(skip-chars-forward " \t"))
(let* ((here (point))
(unclosed (and ;; (not sgml-xml-mode)
(skip-chars-forward " \t\n")
(< (point) here) (sgml-at-indentation-p))
(current-column))
+ ;; ;; If the parsing failed, try to recover.
+ ;; ((and (null context) (bobp)
+ ;; (not (eq (char-after here) ?<)))
+ ;; (goto-char here)
+ ;; (if (and (looking-at "--[ \t\n]*>")
+ ;; (re-search-backward "<!--" nil t))
+ ;; ;; No wonder parsing failed: we're in a comment.
+ ;; (sgml-calculate-indent (prog2 (goto-char (match-end 0))
+ ;; (sgml-lexical-context)
+ ;; (goto-char here)))
+ ;; ;; We have no clue what's going on, let's be honest about it.
+ ;; nil))
+ ;; Otherwise, just follow the rules.
(t
(goto-char there)
(+ (current-column)
"Value of `sgml-display-text' for HTML mode.")
\f
-;; should code exactly HTML 3 here when that is finished
(defvar html-tag-alist
(let* ((1-7 '(("1") ("2") ("3") ("4") ("5") ("6") ("7")))
(1-9 `(,@1-7 ("8") ("9")))
(align '(("align" ("left") ("center") ("right"))))
+ (ialign '(("align" ("top") ("middle") ("bottom") ("left")
+ ("right"))))
(valign '(("top") ("middle") ("bottom") ("baseline")))
(rel '(("next") ("previous") ("parent") ("subdocument") ("made")))
(href '("href" ("ftp:") ("file:") ("finger:") ("gopher:") ("http:")
("title")))
(list '((nil \n ("List item: " "<li>" str
(if sgml-xml-mode "</li>") \n))))
+ (shape '(("shape" ("rect") ("circle") ("poly") ("default"))))
(cell `(t
,@align
("valign" ,@valign)
("colspan" ,@1-9)
("rowspan" ,@1-9)
- ("nowrap" t))))
+ ("nowrap" t)))
+ (cellhalign '(("align" ("left") ("center") ("right")
+ ("justify") ("char"))
+ ("char") ("charoff")))
+ (cellvalign '(("valign" ("top") ("middle") ("bottom")
+ ("baseline")))))
;; put ,-expressions first, else byte-compile chokes (as of V19.29)
;; and like this it's more efficient anyway
`(("a" ,name ,@link)
+ ("area" t ,@shape ("coords") ("href") ("nohref" "nohref") ("alt")
+ ("tabindex") ("accesskey") ("onfocus") ("onblur"))
("base" t ,@href)
+ ("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 " />" ">"))
("h5" ,@align)
("h6" ,@align)
("hr" t ("size" ,@1-9) ("width") ("noshade" t) ,@align)
+ ("iframe" \n ,@ialign ("longdesc") ("name") ("src")
+ ("frameborder" ("1") ("0")) ("marginwidth") ("marginheight")
+ ("scrolling" ("yes") ("no") ("auto")) ("height") ("width"))
("img" t ("align" ,@valign ("texttop") ("absmiddle") ("absbottom"))
("src") ("alt") ("width" "1") ("height" "1")
("border" "1") ("vspace" "1") ("hspace" "1") ("ismap" t))
"<tr><" str ?> _
(if sgml-xml-mode (concat "<" str "></tr>")) \n))
("border" t ,@1-9) ("width" "10") ("cellpadding"))
+ ("tbody" \n ,@cellhalign ,@cellvalign)
("td" ,@cell)
("textarea" ,name ("rows" ,@1-9) ("cols" ,@1-9))
+ ("tfoot" \n ,@cellhalign ,@cellvalign)
("th" ,@cell)
+ ("thead" \n ,@cellhalign ,@cellvalign)
("ul" ,@list ("type" ("disc") ("circle") ("square")))
,@sgml-tag-alist
- ("abbrev")
+ ("abbr")
("acronym")
("address")
("array" (nil \n
("Item: " "<item>" str (if sgml-xml-mode "</item>") \n))
"align")
+ ("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")
- ("blockquote" \n)
+ ("blockquote" \n ("cite"))
("body" \n ("background" ".gif") ("bgcolor" "#") ("text" "#")
("link" "#") ("alink" "#") ("vlink" "#"))
("box" (nil _ "<over>" _ (if sgml-xml-mode "</over>")))
("br" t ("clear" ("left") ("right")))
+ ("button" nil ("name") ("value")
+ ("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")
+ ("del" nil ("cite") ("datetime"))
("dfn")
("div")
("dl" (nil \n
("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)
+ ("frame" t ("longdesc") ("name") ("src")
+ ("frameborder" ("1") ("0")) ("marginwidth") ("marginheight")
+ ("noresize" "noresize") ("scrolling" ("yes") ("no") ("auto")))
+ ("frameset" \n ("rows") ("cols") ("onload") ("onunload"))
("head" \n)
+ ("header" \n)
+ ("hgroup" \n)
("html" (\n
"<head>\n"
"<title>" (setq str (read-input "Title: ")) "</title>\n"
"</body>"
))
("i")
- ("ins")
+ ("ins" nil ("cite") ("datetime"))
("isindex" t ("action") ("prompt"))
("kbd")
+ ("label" nil ("for") ("accesskey") ("onfocus") ("onblur"))
("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)
+ ("noscript" \n)
+ ("object" \n ("declare" "declare") ("classid") ("codebase")
+ ("data") ("type") ("codetype") ("archive") ("standby")
+ ("height") ("width") ("usemap") ("name") ("tabindex"))
+ ("optgroup" \n ("name") ("size") ("multiple" "multiple")
+ ("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)
- ("q")
+ ("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")
("variable-name")
("warning")))
("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.")
(defvar html-tag-help
`(,@sgml-tag-help
("a" . "Anchor of point or link elsewhere")
- ("abbrev" . "Abbreviation")
+ ("abbr" . "Abbreviation")
("acronym" . "Acronym")
("address" . "Formatted mail address")
+ ("area" . "Region of an image map")
("array" . "Math array")
+ ("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")
("blockquote" . "Indented quotation")
("body" . "Document body")
("box" . "Math fraction")
("br" . "Line break")
+ ("button" . "Clickable button")
+ ("canvas" . "Script generated graphics canvas")
("caption" . "Table caption")
("center" . "Centered text")
("changed" . "Change bars")
("cite" . "Citation of a document")
("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")
("dt" . "Term to be defined")
("em" . "Emphasized")
("embed" . "Embedded data in foreign format")
+ ("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")
("form" . "Form with input fields")
+ ("frame" . "Frame in which another HTML document can be displayed")
+ ("frameset" . "Container for frames")
("group" . "Document grouping")
("h1" . "Most important section headline")
("h2" . "Important section headline")
("h5" . "Unimportant section headline")
("h6" . "Least important section headline")
("head" . "Document header")
+ ("header" . "Header of a section")
+ ("hgroup" . "Group of headings - h1-h6 elements")
("hr" . "Horizontal rule")
("html" . "HTML Document")
("i" . "Italic face")
+ ("iframe" . "Inline frame with a nested browsing context")
("img" . "Graphic image")
("input" . "Form input field")
("ins" . "Inserted text")
("isindex" . "Input field for index search")
("kbd" . "Keyboard example face")
+ ("label" . "Caption for a user interface item")
("lang" . "Natural language")
+ ("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" . "Menu list (obsolete)")
+ ("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")
("nobr" . "Text without line break")
+ ("noframes" . "Content for user agents that don't support frames")
+ ("noscript" . "Alternate content for when a script isn't executed")
+ ("object" . "External resource")
("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")
+ ("tbody" . "Table body")
("td" . "Table data cell")
("textarea" . "Form multiline edit area")
+ ("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.")
If you mainly create your own documents, `sgml-specials' might be
interesting. But note that some HTML 2 browsers can't handle `''.
To work around that, do:
- (eval-after-load \"sgml-mode\" '(aset sgml-char-names ?' nil))
+ (eval-after-load \"sgml-mode\" \\='(aset sgml-char-names ?\\=' nil))
\\{html-mode-map}"
(setq-local sgml-display-text html-display-text)
"")))
\n))
+(define-skeleton html-navigational-links
+ "Group of navigational links."
+ nil
+ "<nav>" \n
+ "<ul>" \n
+ "<li><a href=\"" (skeleton-read "URL: " "#") "\">"
+ (skeleton-read "Title: ") "</a>"
+ (if sgml-xml-mode (if sgml-xml-mode "</li>")) \n
+ "</ul>" \n
+ "</nav>")
+
+(define-skeleton html-html5-template
+ "Initial HTML5 template"
+ nil
+ "<!DOCTYPE html>" \n
+ "<html lang=\"en\">" \n
+ "<head>" \n
+ "<meta charset=\"utf-8\">" \n
+ "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">" \n
+ "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">" \n
+ "<title>" (skeleton-read "Page Title: ") "</title>" \n
+ "</head>" \n
+ "<body>" \n
+ "<div id=\"app\"></div>" \n
+ "</body>" \n
+ "</html>")
+
(provide 'sgml-mode)
;;; sgml-mode.el ends here