aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Steingold2001-10-05 16:21:14 +0000
committerSam Steingold2001-10-05 16:21:14 +0000
commitb4f05c3831958b43db41b07cac35bfa95b656a49 (patch)
treea70225568830a9fd66f866e5b25bd581c1119d3a
parent4dd618ff50cecf9666cbafb349710578812b630c (diff)
downloademacs-b4f05c3831958b43db41b07cac35bfa95b656a49.tar.gz
emacs-b4f05c3831958b43db41b07cac35bfa95b656a49.zip
added `html-xhtml' for XHTML input
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/textmodes/sgml-mode.el77
2 files changed, 55 insertions, 31 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0140a33291b..7ff2d7d007b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,14 @@
12001-10-05 Sam Steingold <sds@gnu.org> 12001-10-05 Sam Steingold <sds@gnu.org>
2 2
3 * textmodes/sgml-mode.el (html-xhtml): New user option.
4 (html-tag-alist, html-horizontal-rule, html-image, html-line)
5 (html-ordered-list, html-unordered-list, html-list-item)
6 (html-paragraph, html-checkboxes, html-radio-buttons): Use it.
7 (sgml-skip-close-p): New function.
8 (sgml-value): Use it.
9
102001-10-05 Sam Steingold <sds@gnu.org>
11
3 * calendar/diary-lib.el (diary-entry-compare): When times are 12 * calendar/diary-lib.el (diary-entry-compare): When times are
4 identical, compare the entries lexicographically. 13 identical, compare the entries lexicographically.
5 14
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 5b9e7a63553..612c3f36880 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -95,16 +95,15 @@ This takes effect when first loading the sgml-mode library.")
95 (define-key map "\C-c?" 'sgml-tag-help) 95 (define-key map "\C-c?" 'sgml-tag-help)
96 (define-key map "\C-c8" 'sgml-name-8bit-mode) 96 (define-key map "\C-c8" 'sgml-name-8bit-mode)
97 (define-key map "\C-c\C-v" 'sgml-validate) 97 (define-key map "\C-c\C-v" 'sgml-validate)
98 (if sgml-quick-keys 98 (when sgml-quick-keys
99 (progn 99 (define-key map "&" 'sgml-name-char)
100 (define-key map "&" 'sgml-name-char) 100 (define-key map "<" 'sgml-tag)
101 (define-key map "<" 'sgml-tag) 101 (define-key map " " 'sgml-auto-attributes)
102 (define-key map " " 'sgml-auto-attributes) 102 (define-key map ">" 'sgml-maybe-end-tag)
103 (define-key map ">" 'sgml-maybe-end-tag) 103 (when (memq ?\" sgml-specials)
104 (if (memq ?\" sgml-specials) 104 (define-key map "\"" 'sgml-name-self))
105 (define-key map "\"" 'sgml-name-self)) 105 (when (memq ?' sgml-specials)
106 (if (memq ?' sgml-specials) 106 (define-key map "'" 'sgml-name-self)))
107 (define-key map "'" 'sgml-name-self))))
108 (define-key map (vector (make-char 'latin-iso8859-1)) 107 (define-key map (vector (make-char 'latin-iso8859-1))
109 'sgml-maybe-name-self) 108 'sgml-maybe-name-self)
110 (define-key map [menu-bar sgml] (cons "SGML" menu-map)) 109 (define-key map [menu-bar sgml] (cons "SGML" menu-map))
@@ -509,9 +508,8 @@ skeleton-transformation RET upcase RET, or put this in your `.emacs':
509 (if (string= "![" ,str) 508 (if (string= "![" ,str)
510 (prog1 '(("") " [ " _ " ]]") 509 (prog1 '(("") " [ " _ " ]]")
511 (backward-char)) 510 (backward-char))
512 (if (or (eq v2 t) 511 (unless (or (sgml-skip-close-p v2) ; (eq v2 t)
513 (string-match "^[/!?]" ,str)) 512 (string-match "^[/!?]" ,str))
514 ()
515 (if (symbolp v2) 513 (if (symbolp v2)
516 ;; We go use `identity' to prevent skeleton from passing 514 ;; We go use `identity' to prevent skeleton from passing
517 ;; `str' through skeleton-transformation a second time. 515 ;; `str' through skeleton-transformation a second time.
@@ -807,13 +805,16 @@ If this can't be done, return t."
807 (match-end 0)) 805 (match-end 0))
808 t))) 806 t)))
809 807
808(defun sgml-skip-close-p (obj)
809 (and (eq obj t) (not html-xhtml)))
810
810(defun sgml-value (alist) 811(defun sgml-value (alist)
811 "Interactively insert value taken from attributerule ALIST. 812 "Interactively insert value taken from attributerule ALIST.
812See `sgml-tag-alist' for info about attributerules.." 813See `sgml-tag-alist' for info about attributerules.."
813 (setq alist (cdr alist)) 814 (setq alist (cdr alist))
814 (if (stringp (car alist)) 815 (if (stringp (car alist))
815 (insert "=\"" (car alist) ?\") 816 (insert "=\"" (car alist) ?\")
816 (if (eq (car alist) t) 817 (if (sgml-skip-close-p (car alist)) ; (eq (car alist) t)
817 (if (cdr alist) 818 (if (cdr alist)
818 (progn 819 (progn
819 (insert "=\"") 820 (insert "=\"")
@@ -940,6 +941,13 @@ This takes effect when first loading the library.")
940 (li . "o ")) 941 (li . "o "))
941 "Value of `sgml-display-text' for HTML mode.") 942 "Value of `sgml-display-text' for HTML mode.")
942 943
944
945(defcustom html-xhtml nil
946 "*When non-nil, tag insertion functions will be XHTML-compliant."
947 :type 'boolean
948 :version "21.2"
949 :group 'sgml)
950
943;; should code exactly HTML 3 here when that is finished 951;; should code exactly HTML 3 here when that is finished
944(defvar html-tag-alist 952(defvar html-tag-alist
945 (let* ((1-7 '(("1") ("2") ("3") ("4") ("5") ("6") ("7"))) 953 (let* ((1-7 '(("1") ("2") ("3") ("4") ("5") ("6") ("7")))
@@ -955,7 +963,8 @@ This takes effect when first loading the library.")
955 ("rel" ,@rel) 963 ("rel" ,@rel)
956 ("rev" ,@rel) 964 ("rev" ,@rel)
957 ("title"))) 965 ("title")))
958 (list '((nil \n ("List item: " "<li>" str \n)))) 966 (list '((nil \n ("List item: " "<li>" str
967 (if html-xhtml "</li>") \n))))
959 (cell `(t 968 (cell `(t
960 ,@align 969 ,@align
961 ("valign" ,@valign) 970 ("valign" ,@valign)
@@ -1029,7 +1038,8 @@ This takes effect when first loading the library.")
1029 ("div") 1038 ("div")
1030 ("dl" (nil \n 1039 ("dl" (nil \n
1031 ( "Term: " 1040 ( "Term: "
1032 "<dt>" str "<dd>" _ \n))) 1041 "<dt>" str (if html-xhtml "</dt>")
1042 "<dd>" _ (if html-xhtml "</dd>") \n)))
1033 ("dt" (t _ "<dd>")) 1043 ("dt" (t _ "<dd>"))
1034 ("em") 1044 ("em")
1035 ;("fn" "id" "fn") ; ??? 1045 ;("fn" "id" "fn") ; ???
@@ -1100,7 +1110,7 @@ This takes effect when first loading the library.")
1100 ("dir" . "Directory list (obsolete)") 1110 ("dir" . "Directory list (obsolete)")
1101 ("dl" . "Definition list") 1111 ("dl" . "Definition list")
1102 ("dt" . "Term to be definined") 1112 ("dt" . "Term to be definined")
1103 ("em" . "Emphasised") 1113 ("em" . "Emphasised")
1104 ("embed" . "Embedded data in foreign format") 1114 ("embed" . "Embedded data in foreign format")
1105 ("fig" . "Figure") 1115 ("fig" . "Figure")
1106 ("figa" . "Figure anchor") 1116 ("figa" . "Figure anchor")
@@ -1217,7 +1227,7 @@ To work around that, do:
1217 (setq sentence-end 1227 (setq sentence-end
1218 (if sentence-end-double-space 1228 (if sentence-end-double-space
1219 "[.?!][]\"')}]*\\(<[^>]*>\\)*\\($\\| $\\|\t\\| \\)[ \t\n]*" 1229 "[.?!][]\"')}]*\\(<[^>]*>\\)*\\($\\| $\\|\t\\| \\)[ \t\n]*"
1220 1230
1221 "[.?!][]\"')}]*\\(<[^>]*>\\)*\\($\\| \\|\t\\)[ \t\n]*")) 1231 "[.?!][]\"')}]*\\(<[^>]*>\\)*\\($\\| \\|\t\\)[ \t\n]*"))
1222 (setq sgml-tag-alist html-tag-alist 1232 (setq sgml-tag-alist html-tag-alist
1223 sgml-face-tag-alist html-face-tag-alist 1233 sgml-face-tag-alist html-face-tag-alist
@@ -1312,43 +1322,44 @@ Can be used as a value for `html-mode-hook'."
1312(define-skeleton html-horizontal-rule 1322(define-skeleton html-horizontal-rule
1313 "HTML horizontal rule tag." 1323 "HTML horizontal rule tag."
1314 nil 1324 nil
1315 "<hr>" \n) 1325 (if html-xhtml "<hr/>" "<hr>") \n)
1316 1326
1317(define-skeleton html-image 1327(define-skeleton html-image
1318 "HTML image tag." 1328 "HTML image tag."
1319 nil 1329 nil
1320 "<img src=\"" _ "\">") 1330 "<img src=\"" _ "\""
1331 (if html-xhtml "/>" ">"))
1321 1332
1322(define-skeleton html-line 1333(define-skeleton html-line
1323 "HTML line break tag." 1334 "HTML line break tag."
1324 nil 1335 nil
1325 "<br>" \n) 1336 (if html-xhtml "<br/>" "<br>") \n)
1326 1337
1327(define-skeleton html-ordered-list 1338(define-skeleton html-ordered-list
1328 "HTML ordered list tags." 1339 "HTML ordered list tags."
1329 nil 1340 nil
1330 "<ol>" \n 1341 "<ol>" \n
1331 "<li>" _ \n 1342 "<li>" _ (if html-xhtml "</li>") \n
1332 "</ol>") 1343 "</ol>")
1333 1344
1334(define-skeleton html-unordered-list 1345(define-skeleton html-unordered-list
1335 "HTML unordered list tags." 1346 "HTML unordered list tags."
1336 nil 1347 nil
1337 "<ul>" \n 1348 "<ul>" \n
1338 "<li>" _ \n 1349 "<li>" _ (if html-xhtml "</li>") \n
1339 "</ul>") 1350 "</ul>")
1340 1351
1341(define-skeleton html-list-item 1352(define-skeleton html-list-item
1342 "HTML list item tag." 1353 "HTML list item tag."
1343 nil 1354 nil
1344 (if (bolp) nil '\n) 1355 (if (bolp) nil '\n)
1345 "<li>") 1356 "<li>" _ (if html-xhtml "</li>"))
1346 1357
1347(define-skeleton html-paragraph 1358(define-skeleton html-paragraph
1348 "HTML paragraph tag." 1359 "HTML paragraph tag."
1349 nil 1360 nil
1350 (if (bolp) nil ?\n) 1361 (if (bolp) nil ?\n)
1351 \n "<p>") 1362 \n "<p>" _ (if html-xhtml "</p>"))
1352 1363
1353(define-skeleton html-checkboxes 1364(define-skeleton html-checkboxes
1354 "Group of connected checkbox inputs." 1365 "Group of connected checkbox inputs."
@@ -1359,11 +1370,13 @@ Can be used as a value for `html-mode-hook'."
1359 "<input type=\"" (identity "checkbox") ; see comment above about identity 1370 "<input type=\"" (identity "checkbox") ; see comment above about identity
1360 "\" name=\"" (or v1 (setq v1 (skeleton-read "Name: "))) 1371 "\" name=\"" (or v1 (setq v1 (skeleton-read "Name: ")))
1361 "\" value=\"" str ?\" 1372 "\" value=\"" str ?\"
1362 (if (y-or-n-p "Set \"checked\" attribute? ") 1373 (when (y-or-n-p "Set \"checked\" attribute? ")
1363 (funcall skeleton-transformation " checked")) ">" 1374 (funcall skeleton-transformation " checked"))
1375 (if html-xhtml "/>" ">")
1364 (skeleton-read "Text: " (capitalize str)) 1376 (skeleton-read "Text: " (capitalize str))
1365 (or v2 (setq v2 (if (y-or-n-p "Newline after text? ") 1377 (or v2 (setq v2 (if (y-or-n-p "Newline after text? ")
1366 (funcall skeleton-transformation "<br>") 1378 (funcall skeleton-transformation
1379 (if html-xhtml "<br/>" "<br>"))
1367 ""))) 1380 "")))
1368 \n)) 1381 \n))
1369 1382
@@ -1376,11 +1389,13 @@ Can be used as a value for `html-mode-hook'."
1376 "<input type=\"" (identity "radio") ; see comment above about identity 1389 "<input type=\"" (identity "radio") ; see comment above about identity
1377 "\" name=\"" (or (car v2) (setcar v2 (skeleton-read "Name: "))) 1390 "\" name=\"" (or (car v2) (setcar v2 (skeleton-read "Name: ")))
1378 "\" value=\"" str ?\" 1391 "\" value=\"" str ?\"
1379 (if (and (not v1) (setq v1 (y-or-n-p "Set \"checked\" attribute? "))) 1392 (when (and (not v1) (setq v1 (y-or-n-p "Set \"checked\" attribute? ")))
1380 (funcall skeleton-transformation " checked") ">") 1393 (funcall skeleton-transformation " checked"))
1394 (if html-xhtml "/>" ">")
1381 (skeleton-read "Text: " (capitalize str)) 1395 (skeleton-read "Text: " (capitalize str))
1382 (or (cdr v2) (setcdr v2 (if (y-or-n-p "Newline after text? ") 1396 (or (cdr v2) (setcdr v2 (if (y-or-n-p "Newline after text? ")
1383 (funcall skeleton-transformation "<br>") 1397 (funcall skeleton-transformation
1398 (if html-xhtml "<br/>" "<br>"))
1384 ""))) 1399 "")))
1385 \n)) 1400 \n))
1386 1401