# HG changeset patch # User Sam Steingold # Date 1002298874 0 # Node ID 13a1b8cf5135eb628f0d4a1e372669c48b3a388b # Parent 4287ce76bf9f3ed51161dba0ec5da559cc59cb39 added `html-xhtml' for XHTML input diff -r 4287ce76bf9f -r 13a1b8cf5135 lisp/ChangeLog --- a/lisp/ChangeLog Fri Oct 05 15:53:02 2001 +0000 +++ b/lisp/ChangeLog Fri Oct 05 16:21:14 2001 +0000 @@ -1,3 +1,12 @@ +2001-10-05 Sam Steingold + + * textmodes/sgml-mode.el (html-xhtml): New user option. + (html-tag-alist, html-horizontal-rule, html-image, html-line) + (html-ordered-list, html-unordered-list, html-list-item) + (html-paragraph, html-checkboxes, html-radio-buttons): Use it. + (sgml-skip-close-p): New function. + (sgml-value): Use it. + 2001-10-05 Sam Steingold * calendar/diary-lib.el (diary-entry-compare): When times are diff -r 4287ce76bf9f -r 13a1b8cf5135 lisp/textmodes/sgml-mode.el --- a/lisp/textmodes/sgml-mode.el Fri Oct 05 15:53:02 2001 +0000 +++ b/lisp/textmodes/sgml-mode.el Fri Oct 05 16:21:14 2001 +0000 @@ -95,16 +95,15 @@ (define-key map "\C-c?" 'sgml-tag-help) (define-key map "\C-c8" 'sgml-name-8bit-mode) (define-key map "\C-c\C-v" 'sgml-validate) - (if sgml-quick-keys - (progn - (define-key map "&" 'sgml-name-char) - (define-key map "<" 'sgml-tag) - (define-key map " " 'sgml-auto-attributes) - (define-key map ">" 'sgml-maybe-end-tag) - (if (memq ?\" sgml-specials) - (define-key map "\"" 'sgml-name-self)) - (if (memq ?' sgml-specials) - (define-key map "'" 'sgml-name-self)))) + (when sgml-quick-keys + (define-key map "&" 'sgml-name-char) + (define-key map "<" 'sgml-tag) + (define-key map " " 'sgml-auto-attributes) + (define-key map ">" 'sgml-maybe-end-tag) + (when (memq ?\" sgml-specials) + (define-key map "\"" 'sgml-name-self)) + (when (memq ?' sgml-specials) + (define-key map "'" 'sgml-name-self))) (define-key map (vector (make-char 'latin-iso8859-1)) 'sgml-maybe-name-self) (define-key map [menu-bar sgml] (cons "SGML" menu-map)) @@ -509,9 +508,8 @@ (if (string= "![" ,str) (prog1 '(("") " [ " _ " ]]") (backward-char)) - (if (or (eq v2 t) - (string-match "^[/!?]" ,str)) - () + (unless (or (sgml-skip-close-p v2) ; (eq v2 t) + (string-match "^[/!?]" ,str)) (if (symbolp v2) ;; We go use `identity' to prevent skeleton from passing ;; `str' through skeleton-transformation a second time. @@ -807,13 +805,16 @@ (match-end 0)) t))) +(defun sgml-skip-close-p (obj) + (and (eq obj t) (not html-xhtml))) + (defun sgml-value (alist) "Interactively insert value taken from attributerule ALIST. See `sgml-tag-alist' for info about attributerules.." (setq alist (cdr alist)) (if (stringp (car alist)) (insert "=\"" (car alist) ?\") - (if (eq (car alist) t) + (if (sgml-skip-close-p (car alist)) ; (eq (car alist) t) (if (cdr alist) (progn (insert "=\"") @@ -940,6 +941,13 @@ (li . "o ")) "Value of `sgml-display-text' for HTML mode.") + +(defcustom html-xhtml nil + "*When non-nil, tag insertion functions will be XHTML-compliant." + :type 'boolean + :version "21.2" + :group 'sgml) + ;; should code exactly HTML 3 here when that is finished (defvar html-tag-alist (let* ((1-7 '(("1") ("2") ("3") ("4") ("5") ("6") ("7"))) @@ -955,7 +963,8 @@ ("rel" ,@rel) ("rev" ,@rel) ("title"))) - (list '((nil \n ("List item: " "
  • " str \n)))) + (list '((nil \n ("List item: " "
  • " str + (if html-xhtml "
  • ") \n)))) (cell `(t ,@align ("valign" ,@valign) @@ -1029,7 +1038,8 @@ ("div") ("dl" (nil \n ( "Term: " - "
    " str "
    " _ \n))) + "
    " str (if html-xhtml "
    ") + "
    " _ (if html-xhtml "
    ") \n))) ("dt" (t _ "
    ")) ("em") ;("fn" "id" "fn") ; ??? @@ -1100,7 +1110,7 @@ ("dir" . "Directory list (obsolete)") ("dl" . "Definition list") ("dt" . "Term to be definined") - ("em" . "Emphasised") + ("em" . "Emphasised") ("embed" . "Embedded data in foreign format") ("fig" . "Figure") ("figa" . "Figure anchor") @@ -1217,7 +1227,7 @@ (setq sentence-end (if sentence-end-double-space "[.?!][]\"')}]*\\(<[^>]*>\\)*\\($\\| $\\|\t\\| \\)[ \t\n]*" - + "[.?!][]\"')}]*\\(<[^>]*>\\)*\\($\\| \\|\t\\)[ \t\n]*")) (setq sgml-tag-alist html-tag-alist sgml-face-tag-alist html-face-tag-alist @@ -1312,43 +1322,44 @@ (define-skeleton html-horizontal-rule "HTML horizontal rule tag." nil - "
    " \n) + (if html-xhtml "
    " "
    ") \n) (define-skeleton html-image "HTML image tag." nil - "") + "" ">")) (define-skeleton html-line "HTML line break tag." nil - "
    " \n) + (if html-xhtml "
    " "
    ") \n) (define-skeleton html-ordered-list "HTML ordered list tags." nil "
      " \n - "
    1. " _ \n + "
    2. " _ (if html-xhtml "
    3. ") \n "
    ") (define-skeleton html-unordered-list "HTML unordered list tags." nil "
      " \n - "
    • " _ \n + "
    • " _ (if html-xhtml "
    • ") \n "
    ") (define-skeleton html-list-item "HTML list item tag." nil (if (bolp) nil '\n) - "
  • ") + "
  • " _ (if html-xhtml "
  • ")) (define-skeleton html-paragraph "HTML paragraph tag." nil (if (bolp) nil ?\n) - \n "

    ") + \n "

    " _ (if html-xhtml "

    ")) (define-skeleton html-checkboxes "Group of connected checkbox inputs." @@ -1359,11 +1370,13 @@ "" + (when (y-or-n-p "Set \"checked\" attribute? ") + (funcall skeleton-transformation " checked")) + (if html-xhtml "/>" ">") (skeleton-read "Text: " (capitalize str)) (or v2 (setq v2 (if (y-or-n-p "Newline after text? ") - (funcall skeleton-transformation "
    ") + (funcall skeleton-transformation + (if html-xhtml "
    " "
    ")) ""))) \n)) @@ -1376,11 +1389,13 @@ "") + (when (and (not v1) (setq v1 (y-or-n-p "Set \"checked\" attribute? "))) + (funcall skeleton-transformation " checked")) + (if html-xhtml "/>" ">") (skeleton-read "Text: " (capitalize str)) (or (cdr v2) (setcdr v2 (if (y-or-n-p "Newline after text? ") - (funcall skeleton-transformation "
    ") + (funcall skeleton-transformation + (if html-xhtml "
    " "
    ")) ""))) \n))