annotate lisp/w3/w3-display.el @ 24:4103f0995bd7 r19-15b95

Import from CVS: tag r19-15b95
author cvs
date Mon, 13 Aug 2007 08:51:03 +0200
parents 8fc7fe29b841
children 441bb1e64a06
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1 ;;; w3-display.el --- display engine v99999
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2 ;; Author: wmperry
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
3 ;; Created: 1997/02/15 23:38:28
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
4 ;; Version: 1.128
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
5 ;; Keywords: faces, help, hypermedia
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
6
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@cs.indiana.edu)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
10 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
11 ;;;
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
12 ;;; This file is part of GNU Emacs.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
13 ;;;
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
14 ;;; GNU Emacs is free software; you can redistribute it and/or modify
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
15 ;;; it under the terms of the GNU General Public License as published by
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
16 ;;; the Free Software Foundation; either version 2, or (at your option)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
17 ;;; any later version.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
18 ;;;
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
19 ;;; GNU Emacs is distributed in the hope that it will be useful,
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
20 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
22 ;;; GNU General Public License for more details.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
23 ;;;
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
24 ;;; You should have received a copy of the GNU General Public License
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
25 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
26 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
27 ;;; Boston, MA 02111-1307, USA.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
28 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
29 (require 'cl)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
30 (require 'css)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
31 (require 'font)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
32 (require 'w3-widget)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
33 (require 'w3-imap)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
34
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 20
diff changeset
35 (define-widget-keywords :emacspeak-help)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
36 (autoload 'sentence-ify "flame")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
37 (autoload 'string-ify "flame")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
38 (autoload '*flame "flame")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
39 (if (not (fboundp 'flatten)) (autoload 'flatten "flame"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
40 (defvar w3-cookie-cache nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
41
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
42 (defmacro w3-d-s-var-def (var)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
43 (` (make-variable-buffer-local (defvar (, var) nil))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
44
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
45 (w3-d-s-var-def w3-display-open-element-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
46 (w3-d-s-var-def w3-display-alignment-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
47 (w3-d-s-var-def w3-display-list-stack)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
48 (w3-d-s-var-def w3-display-form-id)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
49 (w3-d-s-var-def w3-display-whitespace-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
50 (w3-d-s-var-def w3-display-font-family-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
51 (w3-d-s-var-def w3-display-font-weight-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
52 (w3-d-s-var-def w3-display-font-variant-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
53 (w3-d-s-var-def w3-display-font-size-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
54 (w3-d-s-var-def w3-face-color)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
55 (w3-d-s-var-def w3-face-background-color)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
56 (w3-d-s-var-def w3-active-faces)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
57 (w3-d-s-var-def w3-active-voices)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
58 (w3-d-s-var-def w3-current-form-number)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
59 (w3-d-s-var-def w3-face-font-family)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
60 (w3-d-s-var-def w3-face-font-weight)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
61 (w3-d-s-var-def w3-face-font-variant)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
62 (w3-d-s-var-def w3-face-font-size)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
63 (w3-d-s-var-def w3-face-font-family)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
64 (w3-d-s-var-def w3-face-font-size)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
65 (w3-d-s-var-def w3-face-font-style)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
66 (w3-d-s-var-def w3-face-font-spec)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
67 (w3-d-s-var-def w3-face-text-decoration)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
68 (w3-d-s-var-def w3-face-face)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
69 (w3-d-s-var-def w3-face-descr)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
70 (w3-d-s-var-def w3-face-pixmap)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
71 (w3-d-s-var-def w3-display-css-properties)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
72
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
73 (eval-when-compile
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
74 (defmacro w3-get-attribute (attr)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
75 (` (cdr-safe (assq (, attr) args))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
76
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
77 (defmacro w3-get-face-info (info)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
78 (let ((var (intern (format "w3-face-%s" info))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
79 (` (push (w3-get-style-info (quote (, info)) node (car (, var)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
80 (, var)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
81
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
82 (defmacro w3-pop-face-info (info)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
83 (let ((var (intern (format "w3-face-%s" info))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
84 (` (pop (, var)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
85
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
86 (defmacro w3-get-all-face-info ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
87 (`
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
88 (progn
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
89 (w3-get-face-info font-family)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
90 (w3-get-face-info font-style)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
91 (w3-get-face-info font-weight)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
92 (w3-get-face-info font-variant)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
93 (w3-get-face-info font-size)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
94 (w3-get-face-info text-decoration)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
95 ;;(w3-get-face-info pixmap)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
96 (w3-get-face-info color)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
97 (w3-get-face-info background-color)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
98 (setq w3-face-font-spec (make-font
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
99 :weight (car w3-face-font-weight)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
100 :family (car w3-face-font-family)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
101 :size (car w3-face-font-size))))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
102
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
103 (defmacro w3-pop-all-face-info ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
104 (`
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
105 (progn
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
106 (w3-pop-face-info font-family)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
107 (w3-pop-face-info font-weight)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
108 (w3-pop-face-info font-variant)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
109 (w3-pop-face-info font-size)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
110 (w3-pop-face-info font-style)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
111 (w3-pop-face-info text-decoration)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
112 ;;(w3-pop-face-info pixmap)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
113 (w3-pop-face-info color)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
114 (w3-pop-face-info background-color))))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
115
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
116 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
117
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
118 (defvar w3-display-same-buffer nil)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
119 (defvar w3-face-cache nil "Cache for w3-face-for-element")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
120 (defvar w3-face-index 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
121 (defvar w3-image-widgets-waiting nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
122
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
123 (make-variable-buffer-local 'w3-last-fill-pos)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
124
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
125 (defconst w3-fill-prefixes-vector
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
126 (let ((len 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
127 (prefix-vector (make-vector 80 nil)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
128 (while (< len 80)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
129 (aset prefix-vector len (make-string len ? ))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
130 (setq len (1+ len)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
131 prefix-vector))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
132
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
133 (defconst w3-line-breaks-vector
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
134 (let ((len 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
135 (breaks-vector (make-vector 10 nil)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
136 (while (< len 10)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
137 (aset breaks-vector len (make-string len ?\n))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
138 (setq len (1+ len)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
139 breaks-vector))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
140
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
141 (defun w3-pause ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
142 (cond
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
143 (w3-running-FSF19 (sit-for 0))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
144 (w3-running-xemacs
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
145 (sit-for 0))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
146 ;; (if (and (not (sit-for 0)) (input-pending-p))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
147 ;; (condition-case ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
148 ;; (dispatch-event (next-command-event))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
149 ;; (error nil)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
150 (t (sit-for 0))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
151
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
152 (defmacro w3-get-pad-string (len)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
153 (` (cond
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
154 ((< (, len) 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
155 "")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
156 ((< (, len) 80)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
157 (aref w3-fill-prefixes-vector (, len)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
158 (t (make-string (, len) ? )))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
159
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
160 (defsubst w3-set-fill-prefix-length (len)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
161 (setq fill-prefix (if (< len (- (or w3-strict-width (window-width)) 4))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
162 (w3-get-pad-string len)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
163 (url-warn
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
164 'html
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
165 "Runaway indentation! Too deep for window width!")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
166 fill-prefix)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
167
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
168 (defsubst w3-get-style-info (info node &optional default)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
169 (or (cdr-safe (assq info w3-display-css-properties)) default))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
170
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
171 (defun w3-decode-area-coords (str)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
172 (let (retval)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
173 (while (string-match "\\([ \t0-9]+\\),\\([ \t0-9]+\\)" str)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
174 (setq retval (cons (vector (string-to-int (match-string 1 str))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
175 (string-to-int (match-string 2 str))) retval)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
176 str (substring str (match-end 0) nil)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
177 (if (string-match "\\([0-9]+\\)" str)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
178 (setq retval (cons (vector (+ (aref (car retval) 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
179 (string-to-int (match-string 1 str)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
180 (aref (car retval) 1)) retval)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
181 (nreverse retval)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
182
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
183 (defun w3-normalize-color (color)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
184 (cond
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
185 ((valid-color-name-p color)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
186 color)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
187 ((valid-color-name-p (concat "#" color))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
188 (concat "#" color))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
189 ((string-match "[ \t\r\n]" color)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
190 (w3-normalize-color
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
191 (mapconcat (function (lambda (x) (if (memq x '(?\t ?\r ?\n ? )) ""
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
192 (char-to-string x)))) color "")))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
193 ((valid-color-name-p (font-normalize-color color))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
194 (font-normalize-color color))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
195 (t
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
196 (w3-warn 'html (format "Bad color specification: %s" color))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
197 nil)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
198
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
199 (defsubst w3-voice-for-element (node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
200 (if (featurep 'emacspeak)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
201 (let (family gain left right pitch pitch-range stress richness voice)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
202 (setq family (w3-get-style-info 'voice-family node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
203 gain (w3-get-style-info 'gain node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
204 left (w3-get-style-info 'left-volume node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
205 right (w3-get-style-info 'right-volume node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
206 pitch (w3-get-style-info 'pitch node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
207 pitch-range (w3-get-style-info 'pitch-range node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
208 stress (w3-get-style-info 'stress node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
209 richness (w3-get-style-info 'richness node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
210 (if (or family gain left right pitch pitch-range stress richness)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
211 (setq voice (dtk-personality-from-speech-style
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
212 (make-dtk-speech-style :family (or family 'paul)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
213 :gain (or gain 5)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
214 :left-volume (or left 5)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
215 :right-volume (or right 5)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
216 :average-pitch (or pitch 5)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
217 :pitch-range (or pitch-range 5)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
218 :stress (or stress 5)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
219 :richness (or richness 5))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
220 (setq voice nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
221 (or voice (car w3-active-voices)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
222
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
223 (defun w3-make-face-emacs19 (name &optional doc-string temporary)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
224 "Defines and returns a new FACE described by DOC-STRING.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
225 If the face already exists, it is unmodified.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
226 If TEMPORARY is non-nil, this face will cease to exist if not in use."
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
227 (make-face name))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
228
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
229 (cond
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
230 ((not (fboundp 'make-face))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
231 (fset 'w3-make-face 'ignore))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
232 (w3-running-xemacs
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
233 (fset 'w3-make-face 'make-face))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
234 (t
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
235 (fset 'w3-make-face 'w3-make-face-emacs19)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
236
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
237 (defsubst w3-face-for-element (node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
238 (w3-get-all-face-info)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
239 (if (car w3-face-text-decoration)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
240 (set-font-style-by-keywords w3-face-font-spec
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
241 (car w3-face-text-decoration)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
242 (if w3-face-font-variant
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
243 (set-font-style-by-keywords w3-face-font-spec
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
244 (car w3-face-font-variant)))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
245 (if w3-face-font-style
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
246 (set-font-style-by-keywords w3-face-font-spec
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
247 (car w3-face-font-style)))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
248 (setq w3-face-descr (list w3-face-font-spec
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
249 (car w3-face-color)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
250 (car w3-face-background-color))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
251 w3-face-face (cdr-safe (assoc w3-face-descr w3-face-cache)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
252 (if (or w3-face-face (not (or (car w3-face-color)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
253 (car w3-face-background-color)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
254 w3-face-font-spec)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
255 nil ; Do nothing, we got it already
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
256 (setq w3-face-face
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
257 (w3-make-face (intern (format "w3-style-face-%05d" w3-face-index))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
258 "An Emacs-W3 face... don't edit by hand." t)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
259 w3-face-index (1+ w3-face-index))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
260 (if w3-face-font-spec
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
261 (set-face-font w3-face-face w3-face-font-spec))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
262 (if (car w3-face-color)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
263 (set-face-foreground w3-face-face (car w3-face-color)))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
264 (if (car w3-face-background-color)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
265 (set-face-background w3-face-face (car w3-face-background-color)))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
266 ;;(set-face-background-pixmap w3-face-face w3-face-pixmap)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
267 (setq w3-face-cache (cons
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
268 (cons w3-face-descr w3-face-face)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
269 w3-face-cache)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
270 w3-face-face)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
271
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
272 (defun w3-normalize-spaces (string)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
273 ;; nuke spaces in the middle
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
274 (while (string-match "[ \t\r\n][ \r\t\n]+" string)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
275 (setq string (concat (substring string 0 (1+ (match-beginning 0)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
276 (substring string (match-end 0)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
277
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
278 ;; nuke spaces at the beginning
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
279 (if (string-match "^[ \t\r\n]+" string)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
280 (setq string (substring string (match-end 0))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
281
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
282 ;; nuke spaces at the end
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
283 (if (string-match "[ \t\n\r]+$" string)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
284 (setq string (substring string 0 (match-beginning 0))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
285 string)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
286
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
287 (defvar w3-bullets
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
288 '((disc . ?*)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
289 (circle . ?o)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
290 (square . ?#)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
291 (none . ? )
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
292 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
293 "*An assoc list of unordered list types mapping to characters to use
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
294 as the bullet character.")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
295
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
296
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
297 (defsubst w3-display-line-break (n)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
298 (if (or
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
299 (memq (car w3-display-whitespace-stack) '(pre nowrap)) ; Been told
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
300 (= w3-last-fill-pos (point))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
301 (> w3-last-fill-pos (point-max)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
302 (if (/= (preceding-char) ?\n) (setq n (1+ n))) ; at least put one line in
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
303 (let ((fill-column (max (1+ (length fill-prefix)) fill-column))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
304 width)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
305 (case (car w3-display-alignment-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
306 (center
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
307 (fill-region-as-paragraph w3-last-fill-pos (point))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
308 (center-region w3-last-fill-pos (point-max)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
309 ((justify full)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
310 (fill-region-as-paragraph w3-last-fill-pos (point) t))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
311 (right
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
312 (fill-region-as-paragraph w3-last-fill-pos (point))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
313 (goto-char w3-last-fill-pos)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
314 (catch 'fill-exit
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
315 (while (re-search-forward ".$" nil t)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
316 (if (>= (setq width (current-column)) fill-column)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
317 nil ; already justified, or error
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
318 (beginning-of-line)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
319 (insert-char ? (- fill-column width))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
320 (end-of-line)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
321 (if (eobp)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
322 (throw 'fill-exit t))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
323 (condition-case ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
324 (forward-char 1)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
325 (error (throw 'fill-exit t))))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
326 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
327 (otherwise ; Default is left justification
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
328 (fill-region-as-paragraph w3-last-fill-pos (point)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
329 ))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
330 (setq n (1- n)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
331 (setq w3-last-fill-pos (point-max))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
332 (insert (cond
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
333 ((<= n 0) "")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
334 ((< n 10)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
335 (aref w3-line-breaks-vector n))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
336 (t
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
337 (make-string n ?\n)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
338
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
339 (defsubst w3-munge-line-breaks-p ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
340 (eq (car w3-display-whitespace-stack) 'pre))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
341
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
342 (defvar w3-display-nil-face (w3-make-face nil "Stub face... don't ask." t))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
343
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
344 (defvar w3-scratch-start-point nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
345
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
346 (defsubst w3-handle-string-content (string)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
347 (setq w3-scratch-start-point (point))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
348 (insert string)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
349 (if (w3-munge-line-breaks-p)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
350 (progn
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
351 (goto-char w3-scratch-start-point)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
352 (if (not (search-forward "\n" nil t))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
353 (subst-char-in-region w3-scratch-start-point (point-max) ?\r ?\n)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
354 (subst-char-in-region w3-scratch-start-point (point-max) ?\r ? )))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
355 (goto-char w3-scratch-start-point)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
356 (while (re-search-forward
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
357 " [ \t\n\r]+\\|[\t\n\r][ \t\n\r]*"
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
358 nil 'move)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
359 (replace-match " "))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
360 (goto-char w3-scratch-start-point)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
361 (if (and (memq (preceding-char) '(? ?\t ?\r ?\n))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
362 (looking-at "[ \t\r\n]"))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
363 (delete-region (point)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
364 (progn
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
365 (skip-chars-forward " \t\r\n")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
366 (point)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
367 (goto-char (point-max))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
368 (add-text-properties w3-scratch-start-point
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
369 (point) (list 'face w3-active-faces
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
370 'start-open t
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
371 'end-open t
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
372 'rear-nonsticky t
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 20
diff changeset
373 'duplicable t))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
374 (if (car w3-active-voices)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
375 (add-text-properties w3-scratch-start-point (point)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
376 (list 'personality (car w3-active-voices))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
377 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
378
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
379 (defun w3-display-get-cookie (args)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
380 (if (not (fboundp 'cookie))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
381 "Sorry, no cookies today."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
382 (let* ((href (or (w3-get-attribute 'href) (w3-get-attribute 'src)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
383 (fname (or (cdr-safe (assoc href w3-cookie-cache))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
384 (url-generate-unique-filename "%s.cki")))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
385 (st (or (cdr-safe (assq 'start args)) "Loading cookies..."))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
386 (nd (or (cdr-safe (assq 'end args)) "Loading cookies... done.")))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
387 (if (not (file-exists-p fname))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
388 (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
389 (set-buffer (generate-new-buffer " *cookie*"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
390 (url-insert-file-contents href)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
391 (write-region (point-min) (point-max) fname 5)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
392 (setq w3-cookie-cache (cons (cons href fname) w3-cookie-cache))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
393 (cookie fname st nd))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
394
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
395 (defun w3-widget-echo (widget &rest ignore)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
396 (let ((url (widget-get widget 'href))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
397 (name (widget-get widget 'name))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
398 (text (buffer-substring (widget-get widget :from)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
399 (widget-get widget :to)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
400 (title (widget-get widget 'title))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
401 (check w3-echo-link)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
402 (msg nil))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
403 (if url
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
404 (setq url (url-truncate-url-for-viewing url)))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
405 (if name
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
406 (setq name (concat "anchor:" name)))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
407 (if (not (listp check))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
408 (setq check (cons check '(title url text name))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
409 (catch 'exit
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
410 (while check
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
411 (and (boundp (car check))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
412 (stringp (symbol-value (car check)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
413 (throw 'exit (symbol-value (car check))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
414 (pop check)))))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
415
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
416 (defun w3-follow-hyperlink (widget &rest ignore)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
417 (let* ((target (widget-get widget 'target))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
418 (href (widget-get widget 'href)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
419 (if target (setq target (intern (downcase target))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
420 (case target
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
421 ((_blank external)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
422 (w3-fetch-other-frame href))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
423 (_top
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
424 (delete-other-windows)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
425 (w3-fetch href))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
426 (otherwise
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
427 (w3-fetch href)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
428
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
429 (defun w3-balloon-help-callback (object &optional event)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
430 (let* ((widget (widget-at (extent-start-position object)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
431 (href (and widget (widget-get widget 'href))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
432 (if href
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
433 (url-truncate-url-for-viewing href)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
434 nil)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
435
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
436
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
437 ;; Various macros
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
438 (eval-when-compile
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
439 (defmacro w3-expand-url (url)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
440 (`
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
441 (url-expand-file-name (, url)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
442 (cdr-safe
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
443 (assoc
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
444 (cdr-safe
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
445 (assq 'base args)) w3-base-alist)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
446
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
447 (defmacro w3-handle-empty-tag ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
448 (`
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
449 (progn
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
450 (push (cons tag args) w3-display-open-element-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
451 (push content content-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
452 (setq content nil))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
453
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
454 (defmacro w3-handle-content (node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
455 (`
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
456 (progn
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
457 (push (cons tag args) w3-display-open-element-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
458 (push content content-stack)
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
459 (setq content (nth 2 (, node))))))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
460
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
461 (defmacro w3-display-handle-list-type ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
462 (`
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
463 (case (car break-style)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
464 (list-item
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
465 (let ((list-style (w3-get-style-info 'list-style-type node))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
466 (list-num (if (car w3-display-list-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
467 (incf (car w3-display-list-stack))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
468 1))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
469 (margin (1- (car left-margin-stack)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
470 (indent (w3-get-style-info 'text-indent node 0)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
471 (if (> indent 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
472 (setq margin (+ margin indent))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
473 (setq margin (max 0 (- margin indent))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
474 (beginning-of-line)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
475 (case list-style
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
476 ((disc circle square)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
477 (insert (format (format "%%%dc" margin)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
478 (or (cdr-safe (assq list-style w3-bullets))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
479 ?o))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
480 ((decimal lower-roman upper-roman lower-alpha upper-alpha)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
481 (let ((x (case list-style
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
482 (lower-roman
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
483 (w3-decimal-to-roman list-num))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
484 (upper-roman
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
485 (upcase
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
486 (w3-decimal-to-roman list-num)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
487 (lower-alpha
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
488 (w3-decimal-to-alpha list-num))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
489 (upper-alpha
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
490 (upcase
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
491 (w3-decimal-to-alpha list-num)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
492 (otherwise
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
493 (int-to-string list-num)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
494 (insert (format (format "%%%ds." margin) x))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
495 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
496 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
497 (otherwise
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
498 (insert (w3-get-pad-string margin)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
499 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
500 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
501 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
502 (otherwise
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
503 (insert (w3-get-pad-string (+ (car left-margin-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
504 (w3-get-style-info 'text-indent node 0)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
505 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
506 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
507 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
508
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
509 (defmacro w3-display-set-margins ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
510 (`
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
511 (progn
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
512 (push (+ (w3-get-style-info 'margin-left node 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
513 (car left-margin-stack)) left-margin-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
514 (push (-
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
515 (car right-margin-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
516 (w3-get-style-info 'margin-right node 0)) right-margin-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
517 (setq fill-column (car right-margin-stack))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
518 (w3-set-fill-prefix-length (car left-margin-stack))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
519 (w3-display-handle-list-type))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
520
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
521 (defmacro w3-display-restore-margins ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
522 (`
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
523 (progn
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
524 (pop right-margin-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
525 (pop left-margin-stack))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
526
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
527 (defmacro w3-display-handle-break ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
528 (`
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
529 (case (car break-style)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
530 (block ; Full paragraph break
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
531 (if (eq (cadr break-style) 'list-item)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
532 (setf (cadr break-style) 'line)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
533 (w3-display-line-break 1))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
534 (w3-display-set-margins)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
535 (push
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
536 (w3-get-style-info 'white-space node
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
537 (car w3-display-whitespace-stack))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
538 w3-display-whitespace-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
539 (push
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
540 (or (w3-get-attribute 'align)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
541 (w3-get-style-info 'text-align node
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
542 (car w3-display-alignment-stack)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
543 w3-display-alignment-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
544 (and w3-do-incremental-display (w3-pause)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
545 ((line list-item) ; Single line break
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
546 (w3-display-line-break 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
547 (w3-display-set-margins)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
548 (push
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
549 (w3-get-style-info 'white-space node
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
550 (car w3-display-whitespace-stack))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
551 w3-display-whitespace-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
552 (push
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
553 (w3-get-style-info 'text-align node
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
554 (or (w3-get-attribute 'align)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
555 (car w3-display-alignment-stack)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
556 w3-display-alignment-stack))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
557 (otherwise ; Assume 'inline' rendering as default
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
558 nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
559 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
560 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
561
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
562 (defmacro w3-display-progress-meter ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
563 (`
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
564 (url-lazy-message "Drawing... %c" (aref "/|\\-" (random 4)))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
565
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
566 (defmacro w3-display-handle-end-break ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
567 (`
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
568 (case (pop break-style)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
569 (block ; Full paragraph break
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
570 (w3-display-line-break 1)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
571 (w3-display-restore-margins)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
572 (pop w3-display-whitespace-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
573 (pop w3-display-alignment-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
574 (and w3-do-incremental-display (w3-pause)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
575 ((line list-item) ; Single line break
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
576 (w3-display-restore-margins)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
577 (w3-display-line-break 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
578 (pop w3-display-whitespace-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
579 (pop w3-display-alignment-stack))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
580 (otherwise ; Assume 'inline' rendering as default
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
581 nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
582 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
583 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
584 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
585
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
586 ;; <link> handling
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
587 (defun w3-parse-link (args)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
588 (let* ((type (if (w3-get-attribute 'rel) 'rel 'rev))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
589 (desc (w3-get-attribute type))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
590 (dc-desc (and desc (downcase desc))) ; canonical case
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
591 (dest (w3-get-attribute 'href))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
592 (plist (alist-to-plist args))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
593 (node-1 (assq type w3-current-links))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
594 (node-2 (and node-1 desc (or (assoc desc
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
595 (cdr node-1))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
596 (assoc dc-desc
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
597 (cdr node-1)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
598 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
599 ;; Canonicalize the case of link types we may look for
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
600 ;; specifically (toolbar etc.) since that's done with
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
601 ;; assoc. See `w3-mail-document-author' and
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
602 ;; `w3-link-toolbar', at least.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
603 (if (member dc-desc w3-defined-link-types)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
604 (setq desc dc-desc))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
605 (if dest ; ignore if HREF missing
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
606 (cond
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
607 (node-2 ; Add to old value
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
608 (setcdr node-2 (cons plist (cdr node-2))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
609 (node-1 ; first rel/rev
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
610 (setcdr node-1 (cons (cons desc (list plist))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
611 (cdr node-1))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
612 (t (setq w3-current-links
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
613 (cons (cons type (list (cons desc (list plist))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
614 w3-current-links)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
615 (setq desc (and desc (intern dc-desc)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
616 (case desc
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
617 ((style stylesheet)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
618 (w3-handle-style plist))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
619 (otherwise
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
620 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
621 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
622 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
623 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
624
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
625
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
626 ;; Image handling
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
627 (defun w3-maybe-start-image-download (widget)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
628 (let* ((src (widget-get widget 'src))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
629 (cached-glyph (w3-image-cached-p src)))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
630 (cond
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
631 ((and cached-glyph
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
632 (widget-glyphp cached-glyph)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
633 (not (eq 'nothing
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
634 (image-instance-type
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
635 (glyph-image-instance cached-glyph)))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
636 (setq w3-image-widgets-waiting (cons widget w3-image-widgets-waiting)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
637 ((or w3-delay-image-loads ; Delaying images
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
638 (not (fboundp 'valid-specifier-domain-p)) ; Can't do images
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
639 (eq (device-type) 'tty)) ; Why bother?
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
640 (w3-add-delayed-graphic widget))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
641 ((not (w3-image-loadable-p src nil)) ; Hey, we can't load it!
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 20
diff changeset
642 (message "Skipping image %s" (url-basepath src t))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
643 (w3-add-delayed-graphic widget))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
644 (t ; Grab the images
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
645 (let (
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
646 (url-request-method "GET")
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
647 (old-asynch url-be-asynchronous)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
648 (url-request-data nil)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
649 (url-request-extra-headers nil)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
650 (url-source t)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
651 (url-mime-accept-string (substring
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
652 (mapconcat
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
653 (function
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
654 (lambda (x)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
655 (if x
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
656 (concat (car x) ",")
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
657 "")))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
658 w3-allowed-image-types "")
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
659 0 -1))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
660 (url-working-buffer (generate-new-buffer-name " *W3GRAPH*")))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
661 (setq-default url-be-asynchronous t)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
662 (setq w3-graphics-list (cons (cons src (make-glyph))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
663 w3-graphics-list))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
664 (save-excursion
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
665 (set-buffer (get-buffer-create url-working-buffer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
666 (setq url-current-callback-data (list widget)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
667 url-be-asynchronous t
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
668 url-current-callback-func 'w3-finalize-image-download)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
669 (url-retrieve src))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
670 (setq-default url-be-asynchronous old-asynch))))))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
671
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
672 (defun w3-finalize-image-download (widget)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
673 (let ((glyph nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
674 (url (widget-get widget 'src))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
675 (node nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
676 (buffer (widget-get widget 'buffer)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
677 (message "Enhancing image...")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
678 (setq glyph (image-normalize (cdr-safe (assoc url-current-mime-type
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
679 w3-image-mappings))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
680 (buffer-string)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
681 (message "Enhancing image... done")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
682 (kill-buffer (current-buffer))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
683 (cond
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
684 ((w3-image-invalid-glyph-p glyph)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
685 (setq glyph nil)
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 20
diff changeset
686 (message "Reading of %s failed." url))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
687 ((eq (aref glyph 0) 'xbm)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
688 (let ((temp-fname (url-generate-unique-filename "%s.xbm")))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
689 (save-excursion
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
690 (set-buffer (generate-new-buffer " *xbm-garbage*"))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
691 (erase-buffer)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
692 (insert (aref glyph 2))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
693 (setq glyph temp-fname)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
694 (write-region (point-min) (point-max) temp-fname)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
695 (kill-buffer (current-buffer)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
696 (setq glyph (make-glyph (list (cons 'x glyph))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
697 (condition-case ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
698 (delete-file temp-fname)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
699 (error nil))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
700 (t
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
701 (setq glyph (make-glyph glyph))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
702 (setq node (assoc url w3-graphics-list))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
703 (cond
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
704 ((and node glyph)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
705 (set-glyph-image (cdr node) (glyph-image glyph)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
706 (glyph
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
707 (setq w3-graphics-list (cons (cons url glyph) w3-graphics-list)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
708 (t nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
709
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
710 (if (and (buffer-name buffer) ; Dest. buffer exists
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
711 (widget-glyphp glyph)) ; got a valid glyph
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
712 (save-excursion
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
713 (set-buffer buffer)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
714 (if (eq major-mode 'w3-mode)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
715 (widget-value-set widget glyph)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
716 (setq w3-image-widgets-waiting
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
717 (cons widget w3-image-widgets-waiting)))))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
718
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
719 (defmacro w3-node-visible-p ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
720 (` (not (eq (car break-style) 'none))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
721
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
722 (defmacro w3-handle-image ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
723 (`
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
724 (let* ((height (w3-get-attribute 'height))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
725 (width (w3-get-attribute 'width))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
726 (src (or (w3-get-attribute 'src) "Error Image"))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
727 (our-alt (cond
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
728 ((null w3-auto-image-alt) "")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
729 ((eq t w3-auto-image-alt)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
730 (concat "[IMAGE(" (url-basepath src t) ")] "))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
731 ((stringp w3-auto-image-alt)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
732 (format w3-auto-image-alt (url-basepath src t)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
733 (alt (or (w3-get-attribute 'alt) our-alt))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
734 (ismap (and (assq 'ismap args) 'ismap))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
735 (usemap (w3-get-attribute 'usemap))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
736 (base (w3-get-attribute 'base))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
737 (href (and hyperlink-info (widget-get (cadr hyperlink-info) 'href)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
738 (widget nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
739 (align (or (w3-get-attribute 'align)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
740 (w3-get-style-info 'vertical-align node))))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
741 (if (assq '*table-autolayout w3-display-open-element-stack)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
742 (insert alt)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
743 (setq widget (widget-create 'image
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
744 :value-face w3-active-faces
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
745 'src src ; Where to load the image from
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
746 'alt alt ; Textual replacement
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
747 'ismap ismap ; Is it a server-side map?
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
748 'usemap usemap ; Is it a client-side map?
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
749 'href href ; Hyperlink destination
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
750 ))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
751 (widget-put widget 'buffer (current-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
752 (w3-maybe-start-image-download widget)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
753 (goto-char (point-max))))))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
754
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
755 ;; The table handling
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
756
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
757 (defvar w3-display-table-cut-words-p nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
758 "*Whether to cut words that are oversized in table cells")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
759
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
760 (defvar w3-display-table-force-borders nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
761 "*Whether to always draw table borders")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
762
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
763 (defun w3-display-table-cut ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
764 (save-excursion
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
765 (goto-char (point-min))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
766 (let ((offset -1))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
767 (while (< offset 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
768 (end-of-line)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
769 (setq offset (- fill-column (current-column)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
770 (cond ((< offset 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
771 (condition-case nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
772 (progn (forward-char offset)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
773 (insert ?\n))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
774 (error (setq offset 0))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
775 ((not (eobp))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
776 (forward-line 1)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
777 (setq offset -1)))))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
778
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
779
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
780 (defun w3-display-fix-widgets ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
781 ;; Make markers belong to the right buffer
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
782 (save-excursion
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
783 (let ((st (point-min))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
784 (nd nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
785 (widget nil) parent
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
786 (to-marker nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
787 (from-marker nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
788 (while (setq st (next-single-property-change st 'button))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
789 (setq nd (or (next-single-property-change st 'button) (point-max))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
790 widget (widget-at st)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
791 to-marker (and widget (widget-get widget :to))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
792 from-marker (and widget (widget-get widget :from))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
793 parent (and widget (widget-get widget :parent))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
794 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
795 (if (not widget)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
796 nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
797 (widget-put widget :from (set-marker (make-marker) st))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
798 (widget-put widget :to (set-marker (make-marker) nd))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
799 (if (not parent)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
800 nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
801 (widget-put parent :from (set-marker (make-marker) st))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
802 (widget-put parent :to (set-marker (make-marker) nd))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
803 (if (condition-case ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
804 (get-text-property (1+ nd) 'button)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
805 (error nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
806 (setq st nd)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
807 (setq st (min (point-max) (1+ nd))))))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
808
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
809 (defun w3-size-of-tree (tree minmax)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
810 (declare (special args))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
811 (save-excursion
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
812 (save-restriction
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
813 (narrow-to-region (point) (point))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
814 ;; XXX fill-column set to 1 fails when fill-prefix is set
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
815 ;; XXX setting fill-column at all isn't really right
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
816 ;; for example <hr>s shouldn't be especially wide
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
817 ;; we should set a flag that makes w3 never wrap a line
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
818 (let ((fill-column (cond ((eq minmax 'min)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
819 3)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
820 ((eq minmax 'max)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
821 400)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
822 (fill-prefix "")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
823 (w3-last-fill-pos (point-min))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
824 a retval
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
825 (w3-do-incremental-display nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
826 (hr-regexp (concat "^"
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
827 (regexp-quote
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
828 (make-string 5 w3-horizontal-rule-char))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
829 "*$"))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
830 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
831 ;;(push 'left w3-display-alignment-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
832 (push (if (eq minmax 'max) 'nowrap) w3-display-whitespace-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
833 (while tree
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
834 (push (cons '*td args) w3-display-open-element-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
835 (w3-display-node (pop tree)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
836 (pop w3-display-whitespace-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
837 (goto-char (point-min))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
838 (while (re-search-forward hr-regexp nil t)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
839 (replace-match "" t t))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
840 (goto-char (point-min))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
841 (while (not (eobp))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
842 ;; loop invariant: at beginning of uncounted line
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
843 (end-of-line)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
844 (skip-chars-backward " ")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
845 (setq retval (cons (current-column)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
846 retval))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
847 (beginning-of-line 2))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
848 (if (= (point-min) (point-max))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
849 (setq retval 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
850 (setq retval (apply 'max (cons 0 retval))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
851 (delete-region (point-min) (point-max))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
852 retval))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
853
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
854 (defun w3-display-table-dimensions (node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
855 ;; fill-column sets maximum width
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
856 (declare (special args))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
857 (let (min-vector
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
858 max-vector
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
859 rows cols
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
860 ;;(w3-form-elements (and (boundp 'w3-form-elements) w3-form-elements))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
861 (table-info (assq 'w3-table-info (cadr node))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
862
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
863 (if table-info
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
864 (setq min-vector (nth 1 table-info)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
865 max-vector (nth 2 table-info)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
866 rows (nth 3 table-info)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
867 cols (nth 4 table-info))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
868
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
869 (push (cons '*table-autolayout args) w3-display-open-element-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
870 (let (content
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
871 cur
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
872 (table-spans (list nil)) ; don't make this '(nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
873 ptr
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
874 col
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
875 constraints
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
876
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
877 colspan rowspan min max)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
878 (setq content (nth 2 node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
879 (setq rows 0 cols 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
880 (while content
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
881 (setq cur (pop content))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
882 (if (stringp cur)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
883 nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
884 (case (car cur)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
885 (tr
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
886 (setq col 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
887 (setq rows (1+ rows))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
888 (setq ptr table-spans)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
889 (mapcar
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
890 (function
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
891 (lambda (td)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
892 (setq colspan (string-to-int (or (cdr-safe (assq 'colspan (nth 1 td))) "1"))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
893 rowspan (string-to-int (or (cdr-safe (assq 'rowspan (nth 1 td))) "1"))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
894 min (w3-size-of-tree (nth 2 td) 'min)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
895 max (w3-size-of-tree (nth 2 td) 'max)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
896 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
897 (while (eq (car-safe (car-safe (cdr ptr))) col)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
898 (setq col (+ col (cdr (cdr (car (cdr ptr))))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
899 (if (= 0 (decf (car (cdr (car (cdr ptr))))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
900 (pop (cdr ptr))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
901 (setq ptr (cdr ptr))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
902 (push (list col colspan min max)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
903 constraints)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
904 (if (= rowspan 1) nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
905 (push (cons col (cons (1- rowspan) colspan)) (cdr ptr))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
906 (setq ptr (cdr ptr)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
907 (setq col (+ col colspan))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
908 ))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
909 (nth 2 cur))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
910 (while (cdr ptr)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
911 (if (= 0 (decf (car (cdr (car (cdr ptr))))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
912 (pop (cdr ptr))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
913 (setq ptr (cdr ptr))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
914 (setq cols (max cols col))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
915 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
916 (caption
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
917 nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
918 (otherwise
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
919 (setq content (nth 2 cur)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
920 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
921 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
922 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
923 (setq constraints (sort constraints
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
924 (function
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
925 (lambda (a b)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
926 (< (cadr a) (cadr b)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
927 min-vector (make-vector cols 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
928 max-vector (make-vector cols 0))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
929 (let (start end i mincellwidth maxcellwidth)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
930 (mapcar (function (lambda (c)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
931 (cond ((= (cadr c) 1)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
932 (aset min-vector (car c)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
933 (max (aref min-vector (car c))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
934 (nth 2 c)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
935 (aset max-vector (car c)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
936 (max (aref max-vector (car c))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
937 (nth 3 c))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
938 (t
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
939 (setq start (car c)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
940 end (+ (car c) (cadr c))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
941 mincellwidth 0
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
942 maxcellwidth 0
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
943 i start)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
944 (while (< i end)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
945 (setq mincellwidth (+ mincellwidth
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
946 (aref min-vector i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
947 maxcellwidth (+
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
948 maxcellwidth
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
949 (aref max-vector i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
950 i (1+ i)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
951 (setq i start)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
952 (if (= mincellwidth 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
953 ;; if existing width is 0 divide evenly
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
954 (while (< i end)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
955 (aset min-vector i
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
956 (/ (nth 2 c) (cadr c)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
957 (aset max-vector i
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
958 (/ (nth 3 c) (cadr c)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
959 (setq i (1+ i)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
960 ;; otherwise weight it by existing widths
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
961 (while (< i end)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
962 (aset min-vector i
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
963 (max (aref min-vector i)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
964 (/ (* (nth 2 c)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
965 (aref min-vector i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
966 mincellwidth)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
967 (aset max-vector i
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
968 (max (aref max-vector i)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
969 (/ (* (nth 3 c)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
970 (aref max-vector i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
971 maxcellwidth)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
972 (setq i (1+ i))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
973 ))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
974 constraints)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
975 (push (cons 'w3-table-info
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
976 (list min-vector max-vector rows cols))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
977 (cadr node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
978 (pop w3-display-open-element-stack))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
979
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
980 (let (max-width
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
981 min-width
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
982 ret-vector
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
983 col
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
984 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
985
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
986
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
987 (setq max-width (apply '+ (append max-vector (list cols 1))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
988 (setq min-width (apply '+ (append min-vector (list cols 1))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
989
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
990 ;; the comments in the cond are excerpts from rfc1942 itself
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
991 (cond
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
992 ;; 1. The minimum table width is equal to or wider than the available
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
993 ;; space. In this case, assign the minimum widths and allow the
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
994 ;; user to scroll horizontally. For conversion to braille, it will
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
995 ;; be necessary to replace the cells by references to notes
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
996 ;; containing their full content. By convention these appear
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
997 ;; before the table.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
998 ((>= min-width fill-column)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
999 (setq ret-vector min-vector))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1000
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1001 ;; 2. The maximum table width fits within the available space. In
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1002 ;; this case, set the columns to their maximum widths.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1003 ((<= max-width fill-column)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1004 (setq ret-vector max-vector))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1005
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1006 ;; 3. The maximum width of the table is greater than the available
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1007 ;; space, but the minimum table width is smaller. In this case,
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1008 ;; find the difference between the available space and the minimum
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1009 ;; table width, lets call it W. Lets also call D the difference
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1010 ;; between maximum and minimum width of the table.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1011
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1012 ;; For each column, let d be the difference between maximum and
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1013 ;; minimum width of that column. Now set the column's width to the
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1014 ;; minimum width plus d times W over D. This makes columns with
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1015 ;; large differences between minimum and maximum widths wider than
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1016 ;; columns with smaller differences.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1017 (t
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1018 (setq ret-vector (make-vector cols 0))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1019 (let ((W (- fill-column min-width))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1020 (D (- max-width min-width))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1021 d extra)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1022 (setq col 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1023 (while (< col (length ret-vector))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1024 (setq d (- (aref max-vector col)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1025 (aref min-vector col)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1026 (aset ret-vector col
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1027 (+ (aref min-vector col)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1028 (/ (* d W) D)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1029 (setq col (1+ col)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1030 (setq extra (- fill-column
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1031 (apply '+ (append ret-vector
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1032 (list (length ret-vector) 1))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1033 col 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1034 (while (and (< col (length ret-vector)) (> extra 0))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1035 (if (= 1 (- (aref max-vector col) (aref ret-vector col) ))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1036 (aset ret-vector col (1+ (aref ret-vector col))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1037 (setq extra (1- extra)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1038 col (1+ col)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1039 )))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1040 (list rows cols ret-vector))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1041
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1042 (defvar w3-table-ascii-border-chars
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1043 [? ? ? ?/ ? ?- ?\\ ?- ? ?\\ ?| ?| ?/ ?- ?| ?-]
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1044 "Vector of ascii characters to use to draw table borders.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1045 w3-table-unhack-border-chars uses this to restore w3-table-border-chars.")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1046
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1047 (defvar w3-table-border-chars w3-table-ascii-border-chars
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1048 "Vector of characters to use to draw table borders.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1049 If you set this you should set w3-table-ascii-border-chars to the same value
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1050 so that w3-table-unhack-borders can restore the value if necessary.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1051
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1052 A reasonable value is [? ? ? ?/ ? ?- ?\\\\ ?^ ? ?\\\\ ?| ?< ?/ ?- ?> ?-]
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1053 Though i recommend replacing the ^ with - and the < and > with |")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1054
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1055 (defsubst w3-table-lookup-char (l u r b)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1056 (aref w3-table-border-chars (logior (if l 1 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1057 (if u 2 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1058 (if r 4 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1059 (if b 8 0))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1060
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1061 (defun w3-table-hack-borders nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1062 "Try to find the best set of characters to draw table borders with.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1063 I definitely recommend trying this on X.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1064 On a console, this can trigger some Emacs display bugs.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1065
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1066 I haven't tried this on XEmacs or any window-system other than X."
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1067 (interactive)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1068 (case (device-type)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1069 (x
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1070 (let ((id (or (and (find-face 'w3-table-hack-x-face)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1071 (face-id 'w3-table-hack-x-face))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1072 (progn
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1073 (make-face 'w3-table-hack-x-face)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1074 (set-face-font 'w3-table-hack-x-face
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1075 (make-font :family "terminal"))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1076 (face-id 'w3-table-hack-x-face)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1077 (if (not (face-differs-from-default-p 'w3-table-hack-x-face))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1078 nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1079 (aset standard-display-table 1 (vector (+ (* 256 id) ?l)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1080 (aset standard-display-table 2 (vector (+ (* 256 id) ?q)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1081 (aset standard-display-table 3 (vector (+ (* 256 id) ?k)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1082 (aset standard-display-table 4 (vector (+ (* 256 id) ?t)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1083 (aset standard-display-table 5 (vector (+ (* 256 id) ?n)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1084 (aset standard-display-table 6 (vector (+ (* 256 id) ?u)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1085 (aset standard-display-table 7 (vector (+ (* 256 id) ?m)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1086 (aset standard-display-table 8 (vector (+ (* 256 id) ?x)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1087 (aset standard-display-table 11 (vector (+ (* 256 id) ?j)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1088 (aset standard-display-table 14 (vector (+ (* 256 id) ?v)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1089 (aset standard-display-table 15 (vector (+ (* 256 id) ?w)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1090 (setq w3-table-border-chars [? ? ? 11 ? 2 7 14 ? 3 8 6 1 15 4 5])
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1091 (setq w3-horizontal-rule-char 2))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1092 (tty
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1093 (standard-display-g1 1 108) ; ulcorner
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1094 (standard-display-g1 2 113) ; hline
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1095 (standard-display-g1 3 107) ; urcorner
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1096 (standard-display-g1 4 116) ; leftt
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1097 (standard-display-g1 5 110) ; intersection
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1098 (standard-display-g1 6 117) ; rightt
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1099 (standard-display-g1 7 109) ; llcorner
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1100 (standard-display-g1 8 120) ; vline
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1101 (standard-display-g1 11 106) ; lrcorner
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1102 (standard-display-g1 14 118) ; upt
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1103 (standard-display-g1 15 119) ; downt
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1104 (setq w3-table-border-chars [? ? ? 11 ? 2 7 14 ? 3 8 6 1 15 4 5])
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1105 (setq w3-horizontal-rule-char 2))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1106 (otherwise
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1107 (error "Unknown window-system, can't do any better than ascii borders")))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1108 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1109
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1110 (defun w3-table-unhack-borders nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1111 (interactive)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1112 (w3-table-excise-hack (buffer-list))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1113 (standard-display-default 1 15)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1114 (setq w3-table-border-chars w3-table-ascii-border-chars)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1115 (setq w3-horizontal-rule-char ?-))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1116
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1117 (defun w3-table-excise-hack (buffs)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1118 "Replace hacked characters with ascii characters in buffers BUFFS.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1119 Should be run before restoring w3-table-border-chars to ascii characters."
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1120 (interactive (list (list (current-buffer))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1121 (let ((inhibit-read-only t)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1122 (tr (make-string 16 ? ))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1123 (i 0))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1124 (while (< i (length tr))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1125 (aset tr i i)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1126 (setq i (1+ i)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1127 (setq i 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1128 (while (< i (length w3-table-border-chars))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1129 (if (< (aref w3-table-border-chars i) 16)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1130 (aset tr
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1131 (aref w3-table-border-chars i)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1132 (aref w3-table-ascii-border-chars i)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1133 (setq i (1+ i)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1134 (mapcar (function (lambda (buf)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1135 (save-excursion
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1136 (set-buffer buf)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1137 (if (eq major-mode 'w3-mode)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1138 (translate-region (point-min)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1139 (point-max)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1140 tr)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1141 buffs)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1142
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1143 (defun w3-display-table (node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1144 (let* ((dimensions (w3-display-table-dimensions node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1145 (num-cols (max (cadr dimensions) 1))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1146 (num-rows (max (car dimensions) 1))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1147 (column-dimensions (caddr dimensions))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1148 (table-width (apply '+ (append column-dimensions (list num-cols 1)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1149 (cond
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1150 ((or (<= (cadr dimensions) 0) (<= (car dimensions) 0))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1151 ;; We have an invalid table
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1152 nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1153 ((assq '*table-autolayout w3-display-open-element-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1154 ;; don't bother displaying the table if all we really need is the size
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1155 (progn (insert-char ?T table-width) (insert "\n")))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1156 (t
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1157 (let* ((tag (nth 0 node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1158 (args (nth 1 node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1159 (border-node (cdr-safe (assq 'border args)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1160 (border (or w3-display-table-force-borders
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1161 (and border-node
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1162 (or (/= 0 (string-to-int border-node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1163 (string= "border" border-node)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1164 (w3-table-border-chars
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1165 (if border
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1166 w3-table-border-chars
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1167 (make-vector (length w3-table-border-chars) ? )))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1168 valign align
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1169 (content (nth 2 node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1170 (avgwidth (/ (- fill-column num-cols num-cols) num-cols))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1171 (formatted-cols (make-vector num-cols nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1172 (table-rowspans (make-vector num-cols 0))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1173 (table-colspans (make-vector num-cols 1))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1174 (prev-colspans (make-vector num-cols 0))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1175 (prev-rowspans (make-vector num-cols 0))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1176 (table-colwidth (make-vector num-cols 0))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1177 (fill-prefix "")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1178 (height nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1179 (cur-height nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1180 (cols nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1181 (rows nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1182 (row 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1183 (this-rectangle nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1184 (i 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1185 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1186
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1187 (push (cons tag args) w3-display-open-element-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1188
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1189 (if (memq 'nowrap w3-display-whitespace-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1190 (setq fill-prefix "")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1191 (case (car w3-display-alignment-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1192 (center
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1193 (w3-set-fill-prefix-length
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1194 (max 0 (/ (- fill-column table-width) 2))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1195 (right
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1196 (w3-set-fill-prefix-length
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1197 (max 0 (- fill-column table-width))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1198 (t
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1199 (setq fill-prefix ""))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1200 (while content
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1201 (case (caar content)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1202 (tr
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1203 (setq w3-display-css-properties (css-get
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1204 (nth 0 (car content))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1205 (nth 1 (car content))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1206 w3-current-stylesheet
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1207 w3-display-open-element-stack))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1208 (setq cols (nth 2 (car content))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1209 valign (or (cdr-safe (assq 'valign (nth 1 (car content))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1210 (w3-get-style-info 'vertical-align node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1211 align (or (cdr-safe (assq 'align (nth 1 (car content))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1212 (w3-get-style-info 'text-align node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1213 content (cdr content)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1214 row (1+ row))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1215 (if (and valign (stringp valign))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1216 (setq valign (intern (downcase valign))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1217 ;; this is iffy
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1218 ;;(if align (push (intern (downcase align)) w3-display-alignment-stack))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1219 (save-excursion
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1220 (save-restriction
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1221 (narrow-to-region (point) (point))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1222 (setq fill-column avgwidth
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1223 inhibit-read-only t
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1224 w3-last-fill-pos (point-min)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1225 i 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1226 ;; skip over columns that have leftover content
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1227 (while (and (< i num-cols)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1228 (/= 0 (aref table-rowspans i)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1229 (setq i (+ i (max 1 (aref table-colspans i)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1230 (while cols
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1231 (let* ((node (car cols))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1232 (attributes (nth 1 node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1233 (colspan (string-to-int
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1234 (or (cdr-safe (assq 'colspan attributes))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1235 "1")))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1236 (rowspan (string-to-int
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1237 (or (cdr-safe (assq 'rowspan attributes))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1238 "1")))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1239 fill-column column-width
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1240 (fill-prefix "")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1241 (w3-do-incremental-display nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1242 (indent-tabs-mode nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1243 c e
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1244 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1245
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1246 (aset table-colspans i colspan)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1247 (aset table-rowspans i rowspan)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1248
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1249 (setq fill-column 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1250 (setq c i
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1251 e (+ i colspan))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1252 (while (< c e)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1253 (setq fill-column (+ fill-column
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1254 (aref column-dimensions c)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1255 1)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1256 c (1+ c)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1257 (setq fill-column (1- fill-column))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1258 (aset table-colwidth i fill-column)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1259
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1260 (setq w3-last-fill-pos (point-min))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1261 (push (cons (nth 0 node) (nth 1 node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1262 w3-display-open-element-stack)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1263 (w3-display-node node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1264 (setq fill-column (aref table-colwidth i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1265 (if w3-display-table-cut-words-p
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1266 (w3-display-table-cut))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1267 (setq cols (cdr cols))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1268 (goto-char (point-min))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1269 (skip-chars-forward "\t\n\r")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1270 (beginning-of-line)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1271 (delete-region (point-min) (point))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1272 (goto-char (point-max))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1273 (skip-chars-backward " \t\n\r")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1274 (delete-region (point) (point-max))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1275 (if (>= fill-column (current-column))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1276 (insert-char ? (- fill-column (current-column))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1277 (aset formatted-cols i (extract-rectangle (point-min) (point-max)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1278 (delete-region (point-min) (point-max))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1279 (let ((j (1- colspan)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1280 (while (> j 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1281 (aset table-colspans (+ i j) 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1282 (setq j (1- j))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1283 (setq i (+ i colspan))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1284 ;; skip over columns that have leftover content
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1285 (while (and (< i num-cols)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1286 (/= 0 (aref table-rowspans i)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1287 (setq i (+ i (max 1 (aref table-colspans i)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1288 ))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1289
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1290 ;; finish off the columns
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1291 (while (< i num-cols)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1292 (aset table-colwidth i (aref column-dimensions i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1293 (aset table-colspans i 1)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1294 (setq i (1+ i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1295 (while (and (< i num-cols)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1296 (/= 0 (aref table-rowspans i)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1297 (setq i (+ i (max 1 (aref table-colspans i))))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1298
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1299 ;; on the last row empty any pending rowspans per the rfc
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1300 (if content nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1301 (fillarray table-rowspans 1))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1302
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1303 ;; Find the tallest rectangle that isn't a rowspanning cell
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1304 (setq height 0
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1305 i 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1306 (while (< i num-cols)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1307 (if (= 1 (aref table-rowspans i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1308 (setq height (max height (length (aref formatted-cols i)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1309 (setq i (+ i (max 1 (aref table-colspans i)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1310
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1311 ;; Make all rectangles the same height
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1312 (setq i 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1313 (while (< i num-cols)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1314 (setq this-rectangle (aref formatted-cols i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1315 (if (> height (length this-rectangle))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1316 (let ((colspan-fill-line
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1317 (make-string (abs (aref table-colwidth i)) ? )))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1318 (case valign
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1319 ((center middle)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1320 (aset formatted-cols i
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1321 (append (make-list (/ (- height (length this-rectangle)) 2)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1322 colspan-fill-line)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1323 this-rectangle)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1324 (bottom
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1325 (aset formatted-cols i
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1326 (append (make-list (- height (length this-rectangle))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1327 colspan-fill-line)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1328 this-rectangle))))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1329 (setq i (+ i (max 1 (aref table-colspans i)))))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1330
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1331
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1332 ;; fix broken colspans (this should only matter on illegal tables)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1333 (setq i 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1334 (while (< i num-cols)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1335 (if (= (aref table-colspans i) 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1336 (aset table-colspans i 1))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1337 (setq i (+ i (aref table-colspans i))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1338
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1339 ;; Insert a separator
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1340 (insert fill-prefix)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1341 (setq i 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1342 (let (rflag bflag tflag lflag)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1343 (while (< i num-cols)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1344
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1345 (setq rflag (= (aref prev-rowspans i) 0))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1346 (setq bflag (/= (aref table-colspans i) 0))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1347 (setq tflag (/= (aref prev-colspans i) 0))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1348
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1349 (insert (w3-table-lookup-char lflag tflag rflag bflag))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1350 (setq lflag t)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1351 (cond ((= (aref prev-rowspans i) 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1352 (insert-char (w3-table-lookup-char t nil t nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1353 (aref column-dimensions i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1354 (setq i (1+ i)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1355 ((car (aref formatted-cols i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1356 (insert (pop (aref formatted-cols i)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1357 (setq lflag nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1358 (setq i (+ i (max (aref table-colspans i)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1359 (aref prev-colspans i) 1))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1360 (t
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1361 (insert-char ? (aref table-colwidth i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1362 (setq lflag nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1363 (setq i (+ i (max (aref table-colspans i)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1364 (aref prev-colspans i) 1))))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1365 (insert (w3-table-lookup-char lflag (/= row 1) nil t) "\n"))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1366
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1367 ;; recalculate height (in case we've shortened a rowspanning cell
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1368 (setq height 0
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1369 i 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1370 (while (< i num-cols)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1371 (if (= 1 (aref table-rowspans i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1372 (setq height (max height (length (aref formatted-cols i)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1373 (setq i (+ i (max 1 (aref table-colspans i)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1374
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1375 ;; Insert a row back in original buffer
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1376 (while (> height 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1377 (insert fill-prefix (w3-table-lookup-char nil t nil t))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1378 (setq i 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1379 (while (< i num-cols)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1380 (if (car (aref formatted-cols i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1381 (insert (pop (aref formatted-cols i)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1382 (insert-char ? (aref table-colwidth i)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1383 (insert (w3-table-lookup-char nil t nil t))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1384 (setq i (+ i (max (aref table-colspans i) 1))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1385 (insert "\n")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1386 ;;(and w3-do-incremental-display (w3-pause))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1387 (setq height (1- height)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1388
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1389 (setq i 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1390 (while (< i num-cols)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1391 (if (> (aref table-rowspans i) 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1392 (decf (aref table-rowspans i)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1393 (incf i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1394
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1395 (setq prev-rowspans (copy-seq table-rowspans))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1396 (setq prev-colspans (copy-seq table-colspans))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1397
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1398 (and w3-do-incremental-display (w3-pause))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1399
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1400 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1401 (caption
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1402 (let ((left (length fill-prefix))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1403 (fill-prefix "")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1404 (fill-column table-width)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1405 (start (point)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1406 (w3-display-node (pop content))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1407 (indent-rigidly start (point) left)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1408 (otherwise
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1409 (delete-horizontal-space)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1410 (setq content (nth 2 (car content))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1411 ))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1412 (if (= (length column-dimensions) 0) nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1413 (insert fill-prefix)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1414 (setq i 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1415 (let (tflag lflag)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1416 (while (< i num-cols)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1417 (setq tflag (/= (aref prev-colspans i) 0))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1418 (insert (w3-table-lookup-char lflag tflag t nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1419 (setq lflag t)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1420 (insert-char (w3-table-lookup-char t nil t nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1421 (aref column-dimensions i))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1422 (setq i (1+ i)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1423 (insert (w3-table-lookup-char t t nil nil) "\n")))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1424 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1425 (pop w3-display-open-element-stack)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1426
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1427
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1428
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1429 (defun w3-display-create-unique-id ()
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1430 (let* ((date (current-time-string))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1431 (dateinfo (and date (timezone-parse-date date)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1432 (timeinfo (and date (timezone-parse-time (aref dateinfo 3)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1433 (if (and dateinfo timeinfo)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1434 (concat (aref dateinfo 0) ; Year
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1435 (aref dateinfo 1) ; Month
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1436 (aref dateinfo 2) ; Day
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1437 (aref timeinfo 0) ; Hour
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1438 (aref timeinfo 1) ; Minute
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1439 (aref timeinfo 2) ; Second
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1440 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1441 "HoplesSLYCoNfUSED")))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1442
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1443 (defun w3-display-chop-into-table (node cols)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1444 ;; Chop the content of 'node' up into 'cols' columns suitable for inclusion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1445 ;; as the content of a table
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1446 (let ((content (nth 2 node))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1447 (items nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1448 (rows nil))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1449 (setq cols (max cols 1))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1450 (while content
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1451 (push (list 'td nil (list (pop content))) items)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1452 (if (= (length items) cols)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1453 (setq rows (cons (nreverse items) rows)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1454 items nil)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1455 (if items ; Store any leftovers
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1456 (setq rows (cons (nreverse items) rows)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1457 items nil))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1458 (while rows
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1459 (push (list 'tr nil (pop rows)) items))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1460 items))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1461
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1462 (defun w3-display-normalize-form-info (args)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1463 (let* ((plist (alist-to-plist args))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1464 (type (intern (downcase
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1465 (or (plist-get plist 'type) "text"))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1466 (name (plist-get plist 'name))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1467 (value (or (plist-get plist 'value) ""))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1468 (size (if (plist-get plist 'size)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1469 (string-to-int (plist-get plist 'size))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1470 (maxlength (if (plist-get plist 'maxlength)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1471 (string-to-int
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1472 (plist-get plist 'maxlength))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1473 (default value)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1474 (checked (assq 'checked args)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1475 (if (memq type '(checkbox radio)) (setq default checked))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1476 (if (and (eq type 'checkbox) (string= value ""))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1477 (setq value "on"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1478 (if (and (not (memq type '(submit reset button)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1479 (not name))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1480 (setq name (symbol-name type)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1481 (while (and name (string-match "[\r\n]+" name))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1482 (setq name (concat (substring name 0 (match-beginning 0))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1483 (substring name (match-end 0) nil))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1484 (setq plist (plist-put plist 'type type)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1485 plist (plist-put plist 'name name)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1486 plist (plist-put plist 'value value)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1487 plist (plist-put plist 'size size)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1488 plist (plist-put plist 'default default)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1489 plist (plist-put plist 'internal-form-number w3-current-form-number)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1490 plist (plist-put plist 'action w3-display-form-id)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1491 plist (plist-put plist 'maxlength maxlength))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1492 plist))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1493
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1494 (defun w3-display-node (node &optional nofaces)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1495 (let (
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1496 (content-stack (list (list node)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1497 (right-margin-stack (list fill-column))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1498 (left-margin-stack (list 0))
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1499 (inhibit-read-only t)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1500 node
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1501 insert-before
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1502 insert-after
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1503 tag
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1504 args
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1505 content
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1506 hyperlink-info
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1507 break-style
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1508 cur
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1509 id
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1510 class
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1511 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1512 (while content-stack
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1513 (setq content (pop content-stack))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1514 (pop w3-active-faces)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1515 (pop w3-active-voices)
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1516 (w3-display-progress-meter)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1517 (case (car (pop w3-display-open-element-stack))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1518 ;; Any weird, post-display-of-content stuff for specific tags
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1519 ;; goes here. Couldn't think of any better way to do this when we
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1520 ;; are iterative. *sigh*
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1521 (a
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1522 (if (not hyperlink-info)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1523 nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1524 (add-text-properties (car hyperlink-info) (point)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1525 (list
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1526 'mouse-face 'highlight
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1527 'duplicable t
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1528 'start-open t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1529 'end-open t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1530 'rear-nonsticky t
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1531 'help-echo 'w3-balloon-help-callback
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1532 'balloon-help 'w3-balloon-help-callback))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1533 (fillin-text-property (car hyperlink-info) (point)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1534 'button 'button (cadr hyperlink-info))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1535 (widget-put (cadr hyperlink-info) :to (set-marker
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1536 (make-marker) (point))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1537 (setq hyperlink-info nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1538 ((ol ul dl dir menu)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1539 (pop w3-display-list-stack))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1540 (otherwise
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1541 nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1542 (if (car insert-after)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1543 (w3-handle-string-content (car insert-after)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1544 (pop insert-after)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1545 (w3-display-handle-end-break)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1546 (w3-pop-all-face-info)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1547 ;; Handle the element's content
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1548 (while content
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1549 (w3-display-progress-meter)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1550 (if (stringp (car content))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1551 (w3-handle-string-content (pop content))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1552 (setq node (pop content)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1553 tag (nth 0 node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1554 args (nth 1 node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1555 id (or (w3-get-attribute 'name)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1556 (w3-get-attribute 'id))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1557 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1558 ;; This little bit of magic takes care of inline styles.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1559 ;; Evil Evil Evil, but it appears to work.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1560 (if (w3-get-attribute 'style)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1561 (let ((unique-id (or (w3-get-attribute 'id)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1562 (w3-display-create-unique-id)))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1563 (sheet "")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1564 (class (assq 'class args)))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1565 (setq sheet (format "%s.%s { %s }\n" tag unique-id
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1566 (w3-get-attribute 'style)))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1567 (if class
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1568 (setcdr class (cons unique-id (cdr class)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1569 (setf (nth 1 node) (cons (cons 'class (list unique-id))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1570 (nth 1 node))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1571 (setf (nth 1 node) (cons (cons 'id unique-id) (nth 1 node)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1572 (w3-handle-style (list 'data sheet
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1573 'notation "css"))))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1574 (setq w3-display-css-properties (css-get
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1575 (nth 0 node)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1576 (nth 1 node)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1577 w3-current-stylesheet
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1578 w3-display-open-element-stack))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1579 (if nofaces
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1580 nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1581 (push (w3-face-for-element node) w3-active-faces)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1582 (push (w3-voice-for-element node) w3-active-voices))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1583 (push (w3-get-style-info 'display node) break-style)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1584 (push (w3-get-style-info 'insert-after node) insert-after)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1585 (setq insert-before (w3-get-style-info 'insert-before node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1586 (w3-display-handle-break)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1587 (if (w3-node-visible-p)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1588 nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1589 (setq insert-before nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1590 tag '*invisible)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1591 (setcar insert-after nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1592 (if insert-before
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1593 (w3-handle-string-content insert-before))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1594 (setq insert-before nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1595 (if id
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1596 (setq w3-id-positions (cons
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1597 (cons (intern id)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1598 (set-marker (make-marker)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1599 (point-max)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1600 w3-id-positions)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1601 (case tag
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1602 (a ; Hyperlinks
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1603 (let* (
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1604 (title (w3-get-attribute 'title))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1605 (name (or (w3-get-attribute 'id)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1606 (w3-get-attribute 'name)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1607 (btdt nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1608 class
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1609 (before nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1610 (after nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1611 (face nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1612 (voice nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1613 (st nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1614 (setq st (point)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1615 hyperlink-info (list
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1616 st
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1617 (append
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1618 (list 'link :args nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1619 :value "" :tag ""
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1620 :action 'w3-follow-hyperlink
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 20
diff changeset
1621 :from (set-marker (make-marker) st)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1622 :help-echo 'w3-widget-echo
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 20
diff changeset
1623 :emacspeak-help 'w3-widget-echo
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1624 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1625 (alist-to-plist args))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1626 (w3-handle-content node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1627 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1628 )
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1629 ((ol ul dl menu)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1630 (push 0 w3-display-list-stack)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1631 (w3-handle-content node))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1632 (dir
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1633 (push 0 w3-display-list-stack)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1634 (setq node
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1635 (list tag args
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1636 (list
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1637 (list 'table nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1638 (w3-display-chop-into-table node 3)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1639 (w3-handle-content node))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1640 (multicol
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1641 (setq node (list tag args
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1642 (list
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1643 (list 'table nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1644 (w3-display-chop-into-table node 2)))))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1645 (w3-handle-content node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1646 (img ; inlined image
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1647 (w3-handle-image)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1648 (w3-handle-empty-tag))
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1649 (frameset
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1650 (if w3-display-frames
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1651 (w3-handle-content node)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1652 (w3-handle-empty-tag)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1653 (frame
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1654 (let* ((href (or (w3-get-attribute 'src)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1655 (w3-get-attribute 'href)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1656 (name (or (w3-get-attribute 'name)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1657 (w3-get-attribute 'title)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1658 (w3-get-attribute 'alt)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1659 "Unknown frame name")))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1660 (w3-handle-content
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1661 (list tag args
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1662 (list
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1663 (list 'p nil
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1664 (list
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1665 (list 'a
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1666 (cons (cons 'href href)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1667 args)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1668 (list
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1669 "Fetch frame: "
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1670 name)))))))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1671 (noframes
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1672 (if w3-display-frames
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1673 (w3-handle-empty-tag)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1674 (w3-handle-content node)))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1675 (script ; Scripts
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1676 (w3-handle-empty-tag))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1677 ((embed object) ; Embedded images/content
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1678 (w3-handle-content node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1679 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1680 (hr ; Cause line break & insert rule
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1681 (let* ((perc (or (w3-get-attribute 'width)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1682 (w3-get-style-info 'width node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1683 "100%"))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1684 (rule nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1685 (width nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1686 (setq perc (/ (min (string-to-int perc) 100) 100.0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1687 width (* fill-column perc)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1688 rule (make-string (max (truncate width) 0)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1689 w3-horizontal-rule-char)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1690 node (list 'hr nil (list rule)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1691 (w3-handle-content node)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1692 (map ; Client side imagemaps
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1693 (let ((name (or (w3-get-attribute 'name)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1694 (w3-get-attribute 'id)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1695 "unnamed"))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1696 (areas
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1697 (mapcar
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1698 (function
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1699 (lambda (node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1700 (let* ((args (nth 1 node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1701 (type (downcase (or
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1702 (w3-get-attribute 'shape)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1703 "rect")))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1704 (coords (w3-decode-area-coords
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1705 (or (cdr-safe
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1706 (assq 'coords args)) "")))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1707 (alt (w3-get-attribute 'alt))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1708 (href (if (assq 'nohref args)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1709 t
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1710 (or (w3-get-attribute 'src)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1711 (w3-get-attribute 'href))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1712 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1713 (vector type coords href alt))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1714 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1715 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1716 (nth 2 node))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1717 (setq w3-imagemaps (cons (cons name areas) w3-imagemaps)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1718 (w3-handle-empty-tag)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1719 )
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1720 (note
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1721 ;; Ewwwwhhh. Looks gross, but it works. This converts a
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1722 ;; <note> into a two-cell table, so that things look all
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1723 ;; pretty.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1724 (setq node
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1725 (list 'note nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1726 (list
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1727 (list 'table nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1728 (list
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1729 (list 'tr nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1730 (list
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1731 (list 'td (list 'align 'right)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1732 (list
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1733 (concat
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1734 (or (w3-get-attribute 'role)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1735 "CAUTION") ":")))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1736 (list 'td nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1737 (nth 2 node)))))))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1738 (w3-handle-content node)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1739 )
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1740 (table
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1741 (w3-display-table node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1742 (setq w3-last-fill-pos (point))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1743 (w3-handle-empty-tag)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1744 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1745 (isindex
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1746 (let ((prompt (or (w3-get-attribute 'prompt)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1747 "Search on (+ separates keywords): "))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1748 action node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1749 (setq action (or (w3-get-attribute 'src)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1750 (w3-get-attribute 'href)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1751 (url-view-url t)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1752 (if (and prompt (string-match "[^: \t-]+$" prompt))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1753 (setq prompt (concat prompt ": ")))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1754 (setq node
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1755 (list 'isindex nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1756 (list
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1757 (list 'hr nil nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1758 (list 'form
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1759 (list (cons 'action action)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1760 (cons 'enctype
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1761 "application/x-w3-isindex")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1762 (cons 'method "get"))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1763 (list
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1764 prompt
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1765 (list 'input
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1766 (list (cons 'type "text")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1767 (cons 'name "isindex"))))))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1768 (w3-handle-content node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1769 (setq w3-current-isindex (cons action prompt)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1770 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1771 (*document
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1772 (let ((info (mapcar (lambda (x) (cons x (symbol-value x)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1773 w3-persistent-variables)))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1774 (if (not w3-display-same-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1775 (set-buffer (generate-new-buffer "Untitled")))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1776 (setq w3-current-form-number 0
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1777 w3-display-open-element-stack nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1778 w3-last-fill-pos (point-min)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1779 fill-column (min (- (or w3-strict-width (window-width))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1780 w3-right-margin)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1781 (or w3-maximum-line-length
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1782 (window-width))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1783 (switch-to-buffer (current-buffer))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1784 (buffer-disable-undo (current-buffer))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1785 (mapcar (function (lambda (x) (set (car x) (cdr x)))) info)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1786 ;; ACK! We don't like filladapt mode!
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1787 (set (make-local-variable 'filladapt-mode) nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1788 (set (make-local-variable 'adaptive-fill-mode) nil)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1789 (set (make-local-variable 'voice-lock-mode) t)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1790 (setq w3-current-stylesheet (css-copy-stylesheet
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1791 w3-user-stylesheet)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1792 w3-last-fill-pos (point)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1793 fill-column (min (- (or w3-strict-width (window-width))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1794 w3-right-margin)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1795 (or w3-maximum-line-length
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1796 (window-width)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1797 fill-prefix "")
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
1798 (set (make-local-variable 'inhibit-read-only) t))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1799 (w3-handle-content node)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1800 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1801 (*invisible
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1802 (w3-handle-empty-tag))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1803 (meta
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1804 (let* ((equiv (cdr-safe (assq 'http-equiv args)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1805 (value (w3-get-attribute 'content))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1806 (name (w3-get-attribute 'name))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1807 (node (and equiv (assoc (setq equiv (downcase equiv))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1808 url-current-mime-headers))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1809 (if equiv
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1810 (setq url-current-mime-headers (cons
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1811 (cons equiv value)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1812 url-current-mime-headers)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1813 (if name
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1814 (setq w3-current-metainfo (cons
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1815 (cons name value)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1816 w3-current-metainfo)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1817
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1818 ;; Special-case the Set-Cookie header
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1819 (if (and equiv (string= (downcase equiv) "set-cookie"))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1820 (url-cookie-handle-set-cookie value))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1821 ;; Special-case the refresh header
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1822 (if (and equiv (string= (downcase equiv) "refresh"))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1823 (url-handle-refresh-header value)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1824 (w3-handle-empty-tag)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1825 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1826 (link
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1827 ;; This doesn't handle blank-separated values per the RFC.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1828 (w3-parse-link args)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1829 (w3-handle-empty-tag))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1830 (title
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1831 (let ((potential-title "")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1832 (content (nth 2 node)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1833 (while content
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1834 (setq potential-title (concat potential-title (car content))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1835 content (cdr content)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1836 (setq potential-title (w3-normalize-spaces potential-title))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1837 (if (or w3-display-same-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1838 (string-match "^[ \t]*$" potential-title))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1839 nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1840 (rename-buffer (generate-new-buffer-name
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1841 (w3-fix-spaces potential-title)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1842 (w3-handle-empty-tag))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1843 (form
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1844 (setq w3-current-form-number (1+ w3-current-form-number))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1845 (let* (
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1846 (action (w3-get-attribute 'action))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1847 (url nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1848 (if (not action)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1849 (setq args (cons (cons 'action (url-view-url t)) args)))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1850 (setq w3-display-form-id (cons
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1851 (cons 'form-number
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1852 w3-current-form-number)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1853 args))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1854 (w3-handle-content node)))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1855 ; (keygen
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1856 ; (w3-form-add-element 'keygen
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1857 ; (or (w3-get-attribute 'name)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1858 ; (w3-get-attribute 'id)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1859 ; "keygen")
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1860 ; nil ; value
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1861 ; nil ; size
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1862 ; nil ; maxlength
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1863 ; nil ; default
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1864 ; w3-display-form-id ; action
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1865 ; nil ; options
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1866 ; w3-current-form-number
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1867 ; (w3-get-attribute 'id) ; id
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1868 ; nil ; checked
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1869 ; (car w3-active-faces)))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1870 (input
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1871 (w3-form-add-element
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1872 (w3-display-normalize-form-info args)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1873 w3-active-faces)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1874 (w3-handle-empty-tag)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1875 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1876 (select
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1877 (let* ((plist (w3-display-normalize-form-info args))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1878 (tmp nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1879 (multiple (assq 'multiple args))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1880 (value nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1881 (name (plist-get plist 'name))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1882 (options (mapcar
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1883 (function
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1884 (lambda (n)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1885 (setq tmp (w3-normalize-spaces
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1886 (apply 'concat (nth 2 n)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1887 tmp (cons tmp
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1888 (or
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1889 (cdr-safe
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1890 (assq 'value (nth 1 n)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1891 tmp)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1892 (if (assq 'selected (nth 1 n))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1893 (setq value (car tmp)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1894 tmp))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1895 (nth 2 node))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1896 (if (not value)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1897 (setq value (caar options)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1898 (setq plist (plist-put plist 'value value))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1899 (if multiple
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1900 (progn
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1901 (setq options
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1902 (mapcar
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1903 (function
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1904 (lambda (opt)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1905 (list 'div nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1906 (list
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1907 (list 'input
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1908 (list (cons 'name name)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1909 (cons 'type "checkbox")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1910 (cons 'value (car opt))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1911 " " (car opt) (list 'br nil nil)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1912 options))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1913 (setq node (list 'p nil options))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1914 (w3-handle-content node))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1915 (setq plist (plist-put plist 'type 'option)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1916 plist (plist-put plist 'options options))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1917 (w3-form-add-element plist w3-active-faces)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1918 ;; This should really not be necessary, but some versions
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1919 ;; of the widget library leave point _BEFORE_ the menu
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1920 ;; widget instead of after.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1921 (goto-char (point-max))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1922 (w3-handle-empty-tag))))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1923 (textarea
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1924 (let* ((plist (w3-display-normalize-form-info args))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1925 (value (w3-normalize-spaces
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1926 (apply 'concat (nth 2 node)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1927 (setq plist (plist-put plist 'type 'multiline)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1928 plist (plist-put plist 'value value))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1929 (w3-form-add-element plist w3-active-faces))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1930 (w3-handle-empty-tag)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1931 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1932 (style
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1933 (w3-handle-style (alist-to-plist
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1934 (cons (cons 'data (apply 'concat (nth 2 node)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1935 (nth 1 node))))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1936 (w3-handle-empty-tag))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1937 ;; Emacs-W3 stuff that cannot be expressed in a stylesheet
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1938 (pinhead
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1939 ;; This check is so that we don't screw up table auto-layout
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1940 ;; by changing our text midway through the parse/layout/display
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1941 ;; steps.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1942 (if (nth 2 node)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1943 nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1944 (setcar (cddr node)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1945 (list
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1946 (if (fboundp 'yow)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1947 (yow)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1948 "AIEEEEE! I am having an UNDULATING EXPERIENCE!"))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1949 (w3-handle-content node))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1950 (flame
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1951 (if (nth 2 node)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1952 nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1953 (setcar
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1954 (cddr node)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1955 (list
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1956 (condition-case ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1957 (concat
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1958 (sentence-ify
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1959 (string-ify
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1960 (append-suffixes-hack (flatten (*flame))))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1961 (error
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1962 "You know, everything is really a graphics editor.")))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1963 (w3-handle-content node))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1964 (cookie
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1965 (if (nth 2 node)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1966 nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1967 (setcar
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1968 (cddr node)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1969 (list
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1970 (w3-display-get-cookie args))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1971 (w3-handle-content node))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1972 ;; Generic formatting - all things that can be fully specified
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
1973 ;; by a CSS stylesheet.
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1974 (otherwise
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1975 (w3-handle-content node))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1976 ) ; case tag
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1977 ) ; stringp content
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1978 ) ; while content
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1979 ) ; while content-stack
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1980 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1981 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1982
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1983 (defun w3-draw-tree (tree)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1984 ;; The main entry point - wow complicated
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1985 (setq w3-current-stylesheet w3-user-stylesheet)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1986 (while tree
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1987 (w3-display-node (car tree))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1988 (setq tree (cdr tree)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1989 (w3-display-fix-widgets)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1990 (w3-form-resurrect-widgets))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1991
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1992 (defun time-display (&optional tree)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1993 ;; Return the # of seconds it took to draw 'tree'
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1994 (let ((st (nth 1 (current-time)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1995 (nd nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1996 (w3-draw-tree (or tree w3-last-parse-tree))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1997 (setq nd (nth 1 (current-time)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1998 (- nd st)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
1999
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2000
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2001 (defun w3-fixup-eol-faces ()
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2002 ;; Remove 'face property at end of lines - underlining screws up stuff
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2003 (let ((inhibit-read-only t))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2004 (save-excursion
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2005 (goto-char (point-min))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2006 (while (search-forward "\n" nil t)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2007 (put-text-property (match-beginning 0) (match-end 0) 'face nil)))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2008
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2009 (defsubst w3-finish-drawing ()
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2010 (let (url glyph widget)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2011 (while w3-image-widgets-waiting
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2012 (setq widget (car w3-image-widgets-waiting)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2013 w3-image-widgets-waiting (cdr w3-image-widgets-waiting)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2014 url (widget-get widget 'src)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2015 glyph (cdr-safe (assoc url w3-graphics-list)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2016 (condition-case nil
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2017 (widget-value-set widget glyph)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2018 (error nil))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2019 (and (not w3-running-xemacs)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2020 (not (eq (device-type) 'tty))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2021 (w3-fixup-eol-faces))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2022 ;;(w3-handle-headers)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2023 )
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2024
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2025 (defun w3-region (st nd)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2026 (if (not w3-setup-done) (w3-do-setup))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2027 (let* ((source (buffer-substring st nd))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2028 (w3-dislplay-same-buffer t)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2029 (parse nil))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2030 (save-window-excursion
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2031 (save-excursion
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2032 (set-buffer (get-buffer-create " *w3-region*"))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2033 (erase-buffer)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2034 (insert source)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2035 (setq parse (w3-parse-buffer (current-buffer))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2036 (narrow-to-region st nd)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2037 (delete-region (point-min) (point-max))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2038 (w3-draw-tree parse)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2039 (w3-finish-drawing)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2040 (widen))))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2041
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2042 (defun w3-refresh-buffer ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2043 (interactive)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2044 (let ((parse w3-current-parse)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2045 (inhibit-read-only t)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2046 (w3-display-same-buffer t))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2047 (if (not parse)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2048 (error "Could not find the parse tree for this buffer. EEEEK!"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2049 (erase-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2050 (w3-draw-tree parse)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2051 (w3-finish-drawing)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2052 (w3-mode)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2053 (set-buffer-modified-p nil)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2054
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2055 (defun w3-prepare-buffer (&rest args)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2056 ;; The text/html viewer - does all the drawing and displaying of the buffer
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2057 ;; that is necessary to go from raw HTML to a good presentation.
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2058 (let* ((source (buffer-string))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2059 (source-buf (current-buffer))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2060 (parse (w3-parse-buffer source-buf)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2061 (set-buffer-modified-p nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2062 (w3-draw-tree parse)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2063 (kill-buffer source-buf)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2064 (set-buffer-modified-p nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2065 (setq w3-current-source source
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2066 w3-current-parse parse)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
2067 (w3-finish-drawing)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2068 (w3-mode)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2069 (set-buffer-modified-p nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2070 (goto-char (point-min))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2071 (if url-keep-history
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2072 (let ((url (url-view-url t)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2073 (if (not url-history-list)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2074 (setq url-history-list (make-hash-table :size 131 :test 'equal)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2075 (cl-puthash url (buffer-name) url-history-list)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2076 (if (fboundp 'w3-shuffle-history-menu)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2077 (w3-shuffle-history-menu)))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2078 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2079
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents:
diff changeset
2080 (provide 'w3-display)