• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/textmodes/

Lines Matching +refs:sgml +refs:name +refs:char

0 ;;; sgml-mode.el --- SGML- and HTML-editing modes -*- coding: iso-2022-7bit -*-
42 (defgroup sgml nil
47 (defcustom sgml-basic-offset 2
48 "*Specifies the basic indentation level for `sgml-indent-line'."
50 :group 'sgml)
52 (defcustom sgml-transformation-function 'identity
55 :group 'sgml)
57 (put 'sgml-transformation-function 'variable-interactive
59 (defvaralias 'sgml-transformation 'sgml-transformation-function)
61 (defcustom sgml-mode-hook nil
62 "Hook run by command `sgml-mode'.
64 :group 'sgml
70 (defvar sgml-specials '(?\")
72 This list is used when first loading the `sgml-mode' library.
81 self insert as named entities depending on `sgml-quick-keys'.
86 (defvar sgml-quick-keys nil
87 "Use <, >, &, /, SPC and `sgml-specials' keys \"electrically\" when non-nil.
88 This takes effect when first loading the `sgml-mode' library.")
90 (defvar sgml-mode-map
93 (define-key map "\C-c\C-i" 'sgml-tags-invisible)
94 (define-key map "/" 'sgml-slash)
95 (define-key map "\C-c\C-n" 'sgml-name-char)
96 (define-key map "\C-c\C-t" 'sgml-tag)
97 (define-key map "\C-c\C-a" 'sgml-attributes)
98 (define-key map "\C-c\C-b" 'sgml-skip-tag-backward)
99 (define-key map [?\C-c left] 'sgml-skip-tag-backward)
100 (define-key map "\C-c\C-f" 'sgml-skip-tag-forward)
101 (define-key map [?\C-c right] 'sgml-skip-tag-forward)
102 (define-key map "\C-c\C-d" 'sgml-delete-tag)
103 (define-key map "\C-c\^?" 'sgml-delete-tag)
104 (define-key map "\C-c?" 'sgml-tag-help)
105 (define-key map "\C-c/" 'sgml-close-tag)
106 (define-key map "\C-c8" 'sgml-name-8bit-mode)
107 (define-key map "\C-c\C-v" 'sgml-validate)
108 (when sgml-quick-keys
109 (define-key map "&" 'sgml-name-char)
110 (define-key map "<" 'sgml-tag)
111 (define-key map " " 'sgml-auto-attributes)
112 (define-key map ">" 'sgml-maybe-end-tag)
113 (when (memq ?\" sgml-specials)
114 (define-key map "\"" 'sgml-name-self))
115 (when (memq ?' sgml-specials)
116 (define-key map "'" 'sgml-name-self)))
117 (define-key map (vector (make-char 'latin-iso8859-1))
118 'sgml-maybe-name-self)
122 (aset map c 'sgml-maybe-name-self)))
123 (define-key map [menu-bar sgml] (cons "SGML" menu-map))
124 (define-key menu-map [sgml-validate] '("Validate" . sgml-validate))
125 (define-key menu-map [sgml-name-8bit-mode]
126 '("Toggle 8 Bit Insertion" . sgml-name-8bit-mode))
127 (define-key menu-map [sgml-tags-invisible]
128 '("Toggle Tag Visibility" . sgml-tags-invisible))
129 (define-key menu-map [sgml-tag-help]
130 '("Describe Tag" . sgml-tag-help))
131 (define-key menu-map [sgml-delete-tag]
132 '("Delete Tag" . sgml-delete-tag))
133 (define-key menu-map [sgml-skip-tag-forward]
134 '("Forward Tag" . sgml-skip-tag-forward))
135 (define-key menu-map [sgml-skip-tag-backward]
136 '("Backward Tag" . sgml-skip-tag-backward))
137 (define-key menu-map [sgml-attributes]
138 '("Insert Attributes" . sgml-attributes))
139 (define-key menu-map [sgml-tag] '("Insert Tag" . sgml-tag))
141 "Keymap for SGML mode. See also `sgml-specials'.")
143 (defun sgml-make-syntax-table (specials)
158 (defvar sgml-mode-syntax-table (sgml-make-syntax-table sgml-specials)
159 "Syntax table used in SGML mode. See also `sgml-specials'.")
161 (defconst sgml-tag-syntax-table
162 (let ((table (sgml-make-syntax-table '(?- ?\" ?\'))))
163 (dolist (char '(?\( ?\) ?\{ ?\} ?\[ ?\] ?$ ?% ?& ?* ?+ ?/))
164 (modify-syntax-entry char "." table))
168 (defcustom sgml-name-8bit-mode nil
171 :group 'sgml)
173 (defvar sgml-char-names
208 (put 'sgml-table 'char-table-extra-slots 0)
210 (defvar sgml-char-names-table
211 (let ((table (make-char-table 'sgml-table))
215 (setq elt (aref sgml-char-names i))
216 (if elt (aset table (make-char 'latin-iso8859-1 i) elt))
227 (defcustom sgml-validate-command "nsgmls -s" ; replaced old `sgmls'
229 The file name of current buffer file name will be appended to this,
233 :group 'sgml)
235 (defvar sgml-saved-validate-command nil
240 (defcustom sgml-slash-distance 1000
243 :group 'sgml)
245 (defconst sgml-namespace-re "[_[:alpha:]][-_.[:alnum:]]*")
246 (defconst sgml-name-re "[_:[:alpha:]][-_.:[:alnum:]]*")
247 (defconst sgml-tag-name-re (concat "<\\([!/?]?" sgml-name-re "\\)"))
248 (defconst sgml-attrs-re "\\(?:[^\"'/><]\\|\"[^\"]*\"\\|'[^']*'\\)*")
249 (defconst sgml-start-tag-regex (concat "<" sgml-name-re sgml-attrs-re)
253 (defface sgml-namespace
255 "`sgml-mode' face used to highlight the namespace part of identifiers."
256 :group 'sgml)
257 (defvar sgml-namespace-face 'sgml-namespace)
260 (defconst sgml-font-lock-keywords-1
261 `((,(concat "<\\([!?]" sgml-name-re "\\)") 1 font-lock-keyword-face)
262 ;; We could use the simpler "\\(" sgml-namespace-re ":\\)?" instead,
264 (,(concat "</?\\(" sgml-namespace-re "\\)\\(?::\\(" sgml-name-re "\\)\\)?")
265 (1 (if (match-end 2) sgml-namespace-face font-lock-function-name-face))
266 (2 font-lock-function-name-face nil t))
271 (,(concat "\\(?:^\\|[ \t]\\)\\(" sgml-namespace-re "\\)\\(?::\\("
272 sgml-name-re "\\)\\)?=[\"']")
273 (1 (if (match-end 2) sgml-namespace-face font-lock-variable-name-face))
274 (2 font-lock-variable-name-face nil t))
275 (,(concat "[&%]" sgml-name-re ";?") . font-lock-variable-name-face)))
277 (defconst sgml-font-lock-keywords-2
279 sgml-font-lock-keywords-1
282 (regexp-opt (mapcar 'car sgml-tag-face-alist) t)
285 sgml-tag-face-alist)) prepend))))))
288 ;; sgml-font-lock-keywords-1 and sgml-font-lock-keywords-2 above
289 (defvar sgml-font-lock-keywords sgml-font-lock-keywords-1
290 "*Rules for highlighting SGML code. See also `sgml-tag-face-alist'.")
292 (defvar sgml-font-lock-syntactic-keywords
294 ;; comments recognized when `sgml-specials' includes ?-.
298 "Syntactic keywords for `sgml-mode'.")
301 (defvar sgml-face-tag-alist ()
302 "Alist of face and tag name for facemenu.")
304 (defvar sgml-tag-face-alist ()
307 When more these are fontified together with `sgml-font-lock-keywords'.")
309 (defvar sgml-display-text ()
313 (defvar sgml-tags-invisible nil)
315 (defcustom sgml-tag-alist
341 :group 'sgml)
342 (put 'sgml-tag-alist 'risky-local-variable t)
344 (defcustom sgml-tag-help
351 "*Alist of tag name and short description."
354 :group 'sgml)
356 (defcustom sgml-xml-mode nil
363 :group 'sgml)
365 (defvar sgml-empty-tags nil
368 (defvar sgml-unclosed-tags nil
371 (defun sgml-xml-guess ()
374 (goto-char (point-min))
375 (when (or (string= "xml" (file-name-extension (or buffer-file-name "")))
385 (set (make-local-variable 'sgml-xml-mode) t))))
389 (defun sgml-comment-indent-new-line (&optional soft)
396 (defun sgml-mode-facemenu-add-face-function (face end)
397 (if (setq face (cdr (assq face sgml-face-tag-alist)))
402 (error "Face not configured for %s mode" mode-name)))
404 (defun sgml-fill-nobreak ()
405 ;; Don't break between a tag name and its first argument.
410 (eq (char-before) ?<))))
413 (define-derived-mode sgml-mode text-mode "SGML"
417 `sgml-quick-keys'.
423 If you like upcased tags, put (setq sgml-transformation-function 'upcase)
426 Use \\[sgml-validate] to validate your document with an SGML parser.
428 Do \\[describe-variable] sgml- SPC to see available variables.
430 \\{sgml-mode-map}"
431 (make-local-variable 'sgml-saved-validate-command)
438 \[ \t]*</?\\(" sgml-name-re sgml-attrs-re "\\)?>"))
442 (add-hook 'fill-nobreak-predicate 'sgml-fill-nobreak nil t)
443 (set (make-local-variable 'indent-line-function) 'sgml-indent-line)
446 (set (make-local-variable 'comment-indent-function) 'sgml-comment-indent)
448 'sgml-comment-indent-new-line)
457 '((sgml-font-lock-keywords
458 sgml-font-lock-keywords-1
459 sgml-font-lock-keywords-2)
462 . sgml-font-lock-syntactic-keywords)))
464 'sgml-mode-facemenu-add-face-function)
465 (sgml-xml-guess)
466 (if sgml-xml-mode
467 (setq mode-name "XML")
469 sgml-transformation-function))
478 sgml-name-re "\\)")
482 (if sgml-xml-mode "" "?")
483 "\\)\\(" sgml-name-re "\\)\\1")
487 (if sgml-xml-mode "" "?")
488 "\\)\\(" sgml-name-re "\\)\\1")
494 (defalias 'xml-mode 'sgml-mode)
496 (defun sgml-comment-indent ()
499 (defun sgml-slash (arg)
501 Behaves electrically if `sgml-quick-keys' is non-nil."
504 ((not (and (eq (char-before) ?<) (= arg 1)))
505 (sgml-slash-matching arg))
506 ((eq sgml-quick-keys 'indent)
507 (insert-char ?/ 1)
509 ((eq sgml-quick-keys 'close)
510 (delete-backward-char 1)
511 (sgml-close-tag))
513 (sgml-slash-matching arg))))
515 (defun sgml-slash-matching (arg)
520 (insert-char ?/ arg)
527 (if sgml-slash-distance
529 (- (point) sgml-slash-distance))
531 (if (and (re-search-backward sgml-start-tag-regex (point-min) t)
534 (goto-char (1- oldpos))
538 (if (re-search-backward sgml-start-tag-regex
548 (goto-char blinkpos)
558 (defun sgml-name-char (&optional char)
559 "Insert a symbolic character name according to `sgml-char-names'.
565 (or char
566 (setq char (read-quoted-char "Enter char or octal number")))
567 (delete-backward-char 1)
568 (insert char)
570 (sgml-namify-char))
572 (defun sgml-namify-char ()
573 "Change the char before point into its `&name;' equivalent.
574 Uses `sgml-char-names'."
576 (let* ((char (char-before))
577 (name
579 ((null char) (error "No char before point"))
580 ((< char 256) (or (aref sgml-char-names char) char))
581 ((aref sgml-char-names-table char))
582 ((encode-char char 'ucs)))))
583 (if (not name)
584 (error "Don't know the name of `%c'" char)
585 (delete-backward-char 1)
586 (insert (format (if (numberp name) "&#%d;" "&%s;") name)))))
588 (defun sgml-name-self ()
589 "Insert a symbolic character name according to `sgml-char-names'."
591 (sgml-name-char last-command-char))
593 (defun sgml-maybe-name-self ()
594 "Insert a symbolic character name according to `sgml-char-names'."
596 (if sgml-name-8bit-mode
597 (let ((mc last-command-char))
599 (setq mc (unibyte-char-to-multibyte mc)))
600 (or mc (setq mc last-command-char))
601 (sgml-name-char mc))
604 (defun sgml-name-8bit-mode ()
608 (setq sgml-name-8bit-mode (not sgml-name-8bit-mode))
609 (message "sgml name entity mode is now %s"
610 (if sgml-name-8bit-mode "ON" "OFF")))
617 (defvar sgml-tag-last nil)
618 (defvar sgml-tag-history nil)
619 (define-skeleton sgml-tag
621 Completion and configuration are done according to `sgml-tag-alist'.
625 (setq sgml-transformation-function 'upcase)"
627 (setq sgml-tag-last
629 (if (> (length sgml-tag-last) 0)
630 (format "Tag (default %s): " sgml-tag-last)
632 sgml-tag-alist nil nil nil 'sgml-tag-history sgml-tag-last)))
635 `(("") '(setq v2 (sgml-attributes ,str t)) ?>
638 (backward-char)
640 ((and (eq v2 t) sgml-xml-mode (member ,str sgml-empty-tags))
642 ((or (and (eq v2 t) (not sgml-xml-mode)) (string-match "^[/!?]" ,str))
660 (defun sgml-attributes (tag &optional quiet)
663 Completion and configuration of TAG are done according to `sgml-tag-alist'.
665 (interactive (list (save-excursion (sgml-beginning-of-tag t))))
669 (alist (cdr (assoc (downcase tag) sgml-tag-alist)))
679 (insert (if (eq (preceding-char) ?\s) "" ?\s)
681 (sgml-value alist))
692 (sgml-value (assoc (downcase attribute) alist))
694 (if (eq (preceding-char) ?\s)
695 (delete-backward-char 1)))
698 (defun sgml-auto-attributes (arg)
705 (not sgml-tag-alist) ; no message when nothing configured
706 (symbolp (setq tag (save-excursion (sgml-beginning-of-tag t))))
709 (sgml-attributes tag)
710 (setq last-command-char ?\s)
714 (defun sgml-tag-help (&optional tag)
719 (if (eq (following-char) ?<)
720 (forward-char))
721 (setq tag (sgml-beginning-of-tag))))
726 (or (cdr (assoc (downcase tag) sgml-tag-help))
728 (cdr (assoc (downcase (substring tag 1)) sgml-tag-help)))
731 (defun sgml-maybe-end-tag (&optional arg)
734 (if (or arg (eq (car (sgml-lexical-context)) 'tag))
736 (sgml-name-self)))
738 (defun sgml-skip-tag-backward (arg)
742 ;; FIXME: use sgml-get-context or something similar.
752 (eq (char-after (1+ (point))) ?/))
753 (forward-char 1)
754 (sgml-skip-tag-backward 1))))
757 (defun sgml-skip-tag-forward (arg)
762 ;; FIXME: Use sgml-get-context or something similar.
766 (with-syntax-table sgml-tag-syntax-table
769 (if (eq (following-char) ?>)
784 (eq (char-after (1+ (match-beginning 0))) ?/)))
785 (goto-char (match-beginning 0))
786 (sgml-skip-tag-forward 1))
789 (goto-char point)
795 (defun sgml-delete-tag (arg)
796 ;; FIXME: Should be called sgml-kill-tag or should not touch the kill-ring.
805 (if (eq (char-after (match-end 0)) ?/)
809 (goto-char (match-end 0))))
811 (or (save-excursion (setq close (sgml-beginning-of-tag)
817 (sgml-skip-tag-backward 1)
818 (if (or (not (eq (following-char) ?<))
825 (sgml-skip-tag-backward 1)
827 (goto-char close)
830 (when (and (sgml-skip-tag-forward 1)
837 (goto-char open)
846 (or (get 'sgml-tag 'invisible)
847 (setplist 'sgml-tag
849 point-entered sgml-point-entered
852 (symbol-plist 'sgml-tag))))
854 (defun sgml-tags-invisible (arg)
861 (buffer-file-name nil)
863 ;; since it moves point and might call sgml-point-entered.
869 (goto-char (point-min))
870 (if (set (make-local-variable 'sgml-tags-invisible)
873 (not sgml-tags-invisible)))
874 (while (re-search-forward sgml-tag-name-re nil t)
877 sgml-display-text)))
878 (goto-char (match-beginning 0))
883 (overlay-put ol 'sgml-tag t)))
886 'category 'sgml-tag))
890 (if (overlay-get ol 'sgml-tag)
894 (run-hooks 'sgml-tags-invisible-hook)
897 (defun sgml-point-entered (x y)
907 (not (eq (following-char) ?<)))
909 (eq (preceding-char) ?>)))
917 (defun sgml-validate (command)
925 (or sgml-saved-validate-command
926 (concat sgml-validate-command
929 (let ((name (buffer-file-name)))
930 (and name
931 (file-name-nondirectory name)))))))))
932 (setq sgml-saved-validate-command command)
936 (defsubst sgml-at-indentation-p ()
942 (defun sgml-lexical-context (&optional limit)
953 (goto-char limit)
955 (while (and (ignore-errors (sgml-parse-tag-backward))
956 (not (sgml-at-indentation-p)))))
957 (with-syntax-table sgml-tag-syntax-table
983 (defun sgml-beginning-of-tag (&optional top-level)
984 "Skip to beginning of tag and return its name.
986 (let ((context (sgml-lexical-context)))
989 (goto-char (cdr context))
990 (when (looking-at sgml-tag-name-re)
994 (goto-char (cdr context))
995 (sgml-beginning-of-tag t))))))
997 (defun sgml-value (alist)
999 See `sgml-tag-alist' for info about attribute rules."
1003 (if (and (eq (car alist) t) (not sgml-xml-mode))
1009 (delete-backward-char 2)))
1015 (defun sgml-quote (start end &optional unquotep)
1022 (goto-char (point-min))
1029 nil (if (eq (char-before (match-end 0)) ?\;) 0 1)))
1031 (replace-match (cdr (assq (char-before) '((?& . "&amp;")
1036 (defun sgml-pretty-print (beg end)
1046 (goto-char beg)
1047 (goto-char end)
1052 (with-syntax-table sgml-tag-syntax-table
1054 (goto-char (match-beginning 0))
1066 (defstruct (sgml-tag
1067 (:constructor sgml-make-tag (type start end name)))
1068 type start end name)
1070 (defsubst sgml-parse-tag-name ()
1071 "Skip past a tag-name, and return the name."
1075 (defsubst sgml-looking-back-at (str)
1081 (defun sgml-tag-text-p (start end)
1087 (with-syntax-table sgml-tag-syntax-table
1091 (defun sgml-parse-tag-backward (&optional limit)
1096 (let (tag-type tag-start tag-end name)
1099 (when (eq (char-after) ?<)
1102 (with-syntax-table sgml-tag-syntax-table
1108 (goto-char pos)
1109 (throw 'found (sgml-parse-tag-backward limit))))
1111 (unless (sgml-tag-text-p pos (point))
1112 (goto-char pos)
1113 (throw 'found (sgml-parse-tag-backward limit)))
1114 (forward-char -1))))
1117 ((sgml-looking-back-at "--") ; comment
1120 ((sgml-looking-back-at "]]") ; cdata
1125 (with-syntax-table sgml-tag-syntax-table
1126 (goto-char tag-end)
1131 (goto-char (1- tag-end))
1132 (throw 'found (sgml-parse-tag-backward limit))))
1134 (goto-char (1+ tag-start))
1135 (case (char-after)
1141 (forward-char 1)
1143 name (sgml-parse-tag-name)))
1148 name (sgml-parse-tag-name))
1149 (if (or (eq ?/ (char-before (- tag-end 1)))
1150 (sgml-empty-tag-p name))
1152 (goto-char tag-start)
1153 (sgml-make-tag tag-type tag-start tag-end name))))
1155 (defun sgml-get-context (&optional until)
1181 (not (sgml-at-indentation-p))
1183 (/= (point) (sgml-tag-start (car context)))
1184 (sgml-unclosed-tag-p (sgml-tag-name (car context)))))
1185 (setq tag-info (ignore-errors (sgml-parse-tag-backward))))
1190 (> (sgml-tag-end tag-info)
1191 (sgml-tag-end (car context))))
1195 ((> (sgml-tag-end tag-info) here)
1201 ((eq (sgml-tag-type tag-info) 'open)
1204 (if (member-ignore-case (sgml-tag-name tag-info) ignore)
1213 ((eq t (compare-strings (sgml-tag-name tag-info) nil nil
1218 (if (not sgml-xml-mode)
1219 (unless (sgml-unclosed-tag-p (sgml-tag-name tag-info))
1220 (message "Unclosed tag <%s>" (sgml-tag-name tag-info))
1227 (sgml-tag-name tag-info) nil nil
1232 (sgml-tag-name tag-info) (pop stack)))))
1234 (if (and (null stack) (sgml-unclosed-tag-p (sgml-tag-name tag-info)))
1238 (push (sgml-tag-name tag-info) ignore)))
1241 ((eq (sgml-tag-type tag-info) 'close)
1242 (if (sgml-empty-tag-p (sgml-tag-name tag-info))
1243 (message "Spurious </%s>: empty tag" (sgml-tag-name tag-info))
1244 (push (sgml-tag-name tag-info) stack)))
1250 (defun sgml-show-context (&optional full)
1256 (let ((context (sgml-get-context)))
1259 (while (setq more (sgml-get-context))
1267 (defun sgml-close-tag ()
1272 (case (car (sgml-lexical-context))
1279 (let ((context (save-excursion (sgml-get-context))))
1282 (insert "</" (sgml-tag-name (car (last context))) ">")
1287 (defun sgml-empty-tag-p (tag-name)
1289 (and (not sgml-xml-mode)
1290 (member-ignore-case tag-name sgml-empty-tags)))
1292 (defun sgml-unclosed-tag-p (tag-name)
1294 (and (not sgml-xml-mode)
1295 (member-ignore-case tag-name sgml-unclosed-tags)))
1297 (defun sgml-calculate-indent (&optional lcon)
1300 (unless lcon (setq lcon (sgml-lexical-context)))
1305 (save-excursion (goto-char (cdr lcon)) (looking-at "<!--")))
1318 (goto-char (cdr lcon))
1331 (goto-char (cdr lcon))
1334 (goto-char (match-beginning 0)))
1336 (forward-char 2) (skip-chars-forward " \t"))
1343 (goto-char (1+ (cdr lcon)))
1344 (skip-chars-forward "^ \t\n") ;Skip tag name.
1349 (goto-char (1+ (cdr lcon)))
1350 (+ (current-column) sgml-basic-offset)))
1357 (unclosed (and ;; (not sgml-xml-mode)
1358 (looking-at sgml-tag-name-re)
1360 sgml-unclosed-tags)
1371 (goto-char here)
1372 (nreverse (sgml-get-context (if unclosed nil 'empty)))))
1377 (sgml-tag-name (car context)) nil nil
1383 ((and context (> (sgml-tag-end (car context)) here))
1384 (goto-char here)
1385 (sgml-calculate-indent
1386 (cons (if (memq (sgml-tag-type (car context)) '(comment cdata))
1387 (sgml-tag-type (car context)) 'tag)
1388 (sgml-tag-start (car context)))))
1391 (goto-char (sgml-tag-end (car context)))
1393 (< (point) here) (sgml-at-indentation-p))
1396 (goto-char there)
1398 (* sgml-basic-offset (length context)))))))
1405 (defun sgml-indent-line ()
1413 (sgml-calculate-indent))))
1420 (defun sgml-guess-indent ()
1421 "Guess an appropriate value for `sgml-basic-offset'.
1423 Add this to `sgml-mode-hook' for convenience."
1426 (goto-char (point-min))
1429 (set (make-local-variable 'sgml-basic-offset)
1431 (message "Guessed sgml-basic-offset = %d"
1432 sgml-basic-offset)
1435 (defun sgml-parse-dtd ()
1438 (goto-char (point-min))
1455 `text-mode-hook' and `sgml-mode-hook' are run first."
1456 :group 'sgml
1460 (defvar html-quick-keys sgml-quick-keys
1462 This defaults to `sgml-quick-keys'.
1468 (set-keymap-parent map sgml-mode-map)
1484 (define-key map "\C-c\C-cn" 'html-name-anchor)
1494 (define-key map "\C-cn" 'html-name-anchor)
1520 (define-key menu-map "n" '("Name Anchor" . html-name-anchor))
1529 "Value of `sgml-face-tag-alist' for HTML mode.")
1552 "Value of `sgml-tag-face-alist' for HTML mode.")
1558 "Value of `sgml-display-text' for HTML mode.")
1572 (name '("name"))
1578 (if sgml-xml-mode "</li>") \n))))
1587 `(("a" ,name ,@link)
1592 (if sgml-xml-mode " />" ">"))
1604 ("input" t ("size" ,@1-9) ("maxlength" ,@1-9) ("checked" t) ,name
1614 "<option>" str (if sgml-xml-mode "</option>") \n))
1615 ,name ("size" ,@1-9) ("multiple" t))
1620 (if sgml-xml-mode (concat "<" str "></tr>")) \n))
1623 ("textarea" ,name ("rows" ,@1-9) ("cols" ,@1-9))
1627 ,@sgml-tag-alist
1633 ("Item: " "<item>" str (if sgml-xml-mode "</item>") \n))
1642 ("box" (nil _ "<over>" _ (if sgml-xml-mode "</over>")))
1648 ("dd" ,(not sgml-xml-mode))
1654 "<dt>" str (if sgml-xml-mode "</dt>")
1655 "<dd>" _ (if sgml-xml-mode "</dd>") \n)))
1656 ("dt" (t _ (if sgml-xml-mode "</dt>")
1657 "<dd>" (if sgml-xml-mode "</dd>") \n))
1668 "\">" (user-full-name) "</a>\n</address>\n"
1676 ("li" ,(not sgml-xml-mode))
1693 ("function-name")
1697 ("variable-name")
1708 "*Value of `sgml-tag-alist' for HTML mode.")
1711 `(,@sgml-tag-help
1799 "*Value of `sgml-tag-help' for HTML mode.")
1804 (define-derived-mode html-mode sgml-mode "HTML"
1808 \\[browse-url-of-buffer] to see how this comes out. See also `sgml-mode' on
1811 Do \\[describe-variable] html- SPC and \\[describe-variable] sgml- SPC to see available variables.
1827 Pages can have <a name=\"SOMENAME\">named points</a> and can link other points
1834 If you mainly create your own documents, `sgml-specials' might be
1837 (eval-after-load \"sgml-mode\" '(aset sgml-char-names ?' nil))
1840 (set (make-local-variable 'sgml-display-text) html-display-text)
1841 (set (make-local-variable 'sgml-tag-face-alist) html-tag-face-alist)
1842 (make-local-variable 'sgml-tag-alist)
1843 (make-local-variable 'sgml-face-tag-alist)
1844 (make-local-variable 'sgml-tag-help)
1850 sgml-tag-alist html-tag-alist
1851 sgml-face-tag-alist html-face-tag-alist
1852 sgml-tag-help html-tag-help
1856 (char-before (match-end 0))))
1858 (when sgml-xml-mode (setq mode-name "XHTML"))
1859 (set (make-local-variable 'sgml-empty-tags)
1860 ;; From HTML-4.01's loose.dtd, parsed with `sgml-parse-dtd',
1864 (set (make-local-variable 'sgml-unclosed-tags)
1865 ;; From HTML-4.01's loose.dtd, parsed with `sgml-parse-dtd'.
1884 (goto-char (point-min))
1900 :group 'sgml
1913 (define-skeleton html-name-anchor
1914 "HTML anchor tag with name attribute."
1916 "<a name=\"" str "\""
1917 (if sgml-xml-mode (concat " id=\"" str "\""))
1953 (if sgml-xml-mode "<hr />" "<hr>") \n)
1959 (if sgml-xml-mode " />" ">"))
1964 (if sgml-xml-mode "<br />" "<br>") \n)
1970 "<li>" _ (if sgml-xml-mode "</li>") \n
1977 "<li>" _ (if sgml-xml-mode "</li>") \n
1984 "<li>" _ (if sgml-xml-mode "</li>"))
1990 "<p>" _ (if sgml-xml-mode "</p>"))
1999 "\" name=\"" (or v1 (setq v1 (skeleton-read "Name: ")))
2003 (if sgml-xml-mode " checked=\"checked\"" " checked")))
2004 (if sgml-xml-mode " />" ">")
2008 (if sgml-xml-mode "<br />" "<br>"))
2019 "\" name=\"" (or (car v2) (setcar v2 (skeleton-read "Name: ")))
2023 (if sgml-xml-mode " checked=\"checked\"" " checked")))
2024 (if sgml-xml-mode " />" ">")
2028 (if sgml-xml-mode "<br />" "<br>"))
2032 (provide 'sgml-mode)
2035 ;;; sgml-mode.el ends here