annotate lisp/w3/w3-display.el @ 32:e04119814345 r19-15b99

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