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