annotate lisp/w3/w3-style.el @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children 9ee227acff29
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1 ;;; w3-style.el --- Emacs-W3 binding style sheet mechanism
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Author: wmperry
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3 ;; Created: 1996/08/12 03:10:30
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
4 ;; Version: 1.13
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: faces, hypermedia
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
8 ;;; Copyright (c) 1993 - 1996 by William M. Perry (wmperry@cs.indiana.edu)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; This file is not part of GNU Emacs, but the same permissions apply.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;; along with GNU Emacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;; A style sheet mechanism for emacs-w3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; This will eventually be able to under DSSSL[-lite] as well as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;; experimental W3C mechanism
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (require 'font)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (require 'w3-keyword)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (require 'cl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (defvar w3-style-css-syntax-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (copy-syntax-table mm-parse-args-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 "The syntax table for parsing stylesheets")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (defvar w3-style-ie-compatibility nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 "*Whether we want to do Internet Explorer 3.0 compatible parsing of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 CSS stylesheets.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (defun w3-style-css-parse-args (st &optional nd defines)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;; Return an assoc list of attribute/value pairs from a CSS style entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (let (
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 name ; From name=
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 value ; its value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 results ; Assoc list of results
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 name-pos ; Start of XXXX= position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 val-pos ; Start of value position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (if (stringp st)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (set-buffer (get-buffer-create " *w3-style-temp*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (set-syntax-table w3-style-css-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (insert st)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (setq st (point-min)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 nd (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (set-syntax-table w3-style-css-syntax-table))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (if (< nd st)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (narrow-to-region nd nd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (narrow-to-region st nd))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (skip-chars-forward ";, \n\t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (setq name-pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (skip-chars-forward "^ \n\t:=,;")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (downcase-region name-pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (setq name (buffer-substring name-pos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (skip-chars-forward " \t\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (if (not (eq (char-after (point)) ?:)) ; There is no value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (setq value nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (skip-chars-forward " \t\n:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (setq val-pos (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ((or (= (or (char-after val-pos) 0) ?\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (= (or (char-after val-pos) 0) ?'))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (buffer-substring (1+ val-pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (prog2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (forward-sexp 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (1- (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (skip-chars-forward "\""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (skip-chars-forward "^ \t\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (buffer-substring val-pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (if w3-style-ie-compatibility
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (skip-chars-forward "^;")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (skip-chars-forward "^,;"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (skip-chars-backward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (point)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (setq results (cons (cons name value) results))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (skip-chars-forward ";, \n\t"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 results))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (defvar w3-style-css-define-table nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (defun w3-style-css-handle-define ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (let ((name nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (save-pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (retval nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (skip-chars-forward "^ \t\r\n") ; Past the name token
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (downcase-region save-pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (setq name (buffer-substring save-pos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (skip-chars-forward "= \t\r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (setq save-pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (skip-chars-forward "^;")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (setq retval (cons name (buffer-substring save-pos (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (skip-chars-forward " \t\r\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 retval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (defun w3-style-css-handle-import ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (let ((url nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (save-pos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (if (looking-at "'\"")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (forward-sexp 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (error (skip-chars-forward "^ \t\r\n;")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (skip-chars-forward "^ \t\r\n;"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (setq url (url-expand-file-name (buffer-substring save-pos (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (skip-chars-forward "\"; \t\r\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (setq save-pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (let ((url-working-buffer (url-generate-new-buffer-name " *styleimport*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (url-mime-accept-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 "text/css ; level=2")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (sheet nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (set-buffer (get-buffer-create url-working-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (setq url-be-asynchronous nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (url-retrieve url)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (w3-style-css-clean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (setq sheet (buffer-string))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
142 (set-buffer-modified-p nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (kill-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (insert sheet)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (goto-char save-pos))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (defun w3-style-css-clean ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ;; Nuke comments, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (let ((save-pos nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (while (search-forward "/*" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (setq save-pos (- (point) 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (delete-region save-pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (if (search-forward "*/" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (delete-matching-lines "^[ \t\r]*$") ; Nuke blank lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (w3-replace-regexp "^[ \t\r]+" "") ; Nuke whitespace at beg. of line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (w3-replace-regexp "[ \t\r]+$" "") ; Nuke whitespace at end of line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (goto-char (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (defun w3-style-css-applies-to (st nd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (let ((results nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (save-pos nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (narrow-to-region st nd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (goto-char st)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (skip-chars-forward " \t\r\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (setq save-pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (skip-chars-forward "^,")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (skip-chars-backward " \r\t\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (setq results (cons (buffer-substring save-pos (point)) results))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (skip-chars-forward ", \t\r\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 results))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
179 (defun w3-style-active-device-types (&optional device)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
180 (let ((types (list 'normal 'default (if w3-running-xemacs 'xemacs 'emacs)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
181 (type (device-type device)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
182 (cond
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
183 ((featurep 'emacspeak)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
184 (setq types (cons 'speech types)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
185 ((eq type 'tty)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
186 (if (and (fboundp 'tty-color-list)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
187 (/= 0 (length (tty-color-list))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
188 (setq types (cons 'ansi-tty types))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
189 (setq types (cons 'tty types))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
190 ((eq 'color (device-class))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
191 (if (not (device-bitplanes))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
192 (setq types (cons 'color types))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
193 (setq types
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
194 (append
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
195 (list (intern (format "%dbit-color"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
196 (device-bitplanes)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
197 (intern (format "%dbit"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
198 (device-bitplanes)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
199 'color) types))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
200 (if (= 24 (device-bitplanes))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
201 (setq types (cons 'truecolor types)))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
202 ((eq 'grayscale (device-class))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
203 (setq types (append (list (intern (format "%dbit-grayscale"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
204 (device-bitplanes)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
205 'grayscale)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
206 types)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
207 ((eq 'mono (device-class))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
208 (setq types (append (list 'mono 'monochrome) types)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
209 (t
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
210 (setq types (cons 'unknown types))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
211 types))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
212
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (defun w3-style-parse-css (fname &optional string inherit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (let (
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (url-mime-accept-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 "text/css ; level=2")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (save-pos nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (applies-to nil) ; List of tags to apply style to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (attrs nil) ; List of name/value pairs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (tag nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (att nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (cur nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (val nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (class nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (defines nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (device-type nil)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
227 (active-device-types (w3-style-active-device-types (selected-device)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (sheet inherit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (set-buffer (get-buffer-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (url-generate-new-buffer-name " *style*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (set-syntax-table w3-style-css-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (if fname (url-insert-file-contents fname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (if string (insert string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (w3-style-css-clean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (setq save-pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (cond
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
242 ;; *sigh* SGML comments are being used to 'hide' data inlined
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
243 ;; with the <style> tag from older browsers.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
244 ((or (looking-at "<!--+") ; begin
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
245 (looking-at "--+>")) ; end
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
246 (goto-char (match-end 0)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ;; C++ style comments, and we are doing IE compatibility
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ((and (looking-at "//") w3-style-ie-compatibility)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (end-of-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 ;; Pre-Processor directives
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 ((looking-at "[ \t\r]*@\\([^ \t\r\n]\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (let ((directive nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (skip-chars-forward " @\t\r") ; Past any leading whitespace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (setq save-pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (skip-chars-forward "^ \t\r\n") ; Past the @ directive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (downcase-region save-pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (setq directive (buffer-substring save-pos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (skip-chars-forward " \t\r") ; Past any trailing whitespace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (setq save-pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 ((string= directive "define")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (let ((retval (w3-style-css-handle-define)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (and defines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (setq defines (cons retval defines)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 ((string= directive "import")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (w3-style-css-handle-import))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (w3-warn 'style (format "Unknown directive: @%s" directive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 'warning)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 ;; Giving us some output device information
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
271 ((looking-at "[ \t\r]*:\\([^: \n]+\\):")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (downcase-region (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (setq device-type (intern (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (match-end 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (goto-char (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (if (not (memq device-type active-device-types))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 ;; Not applicable to us... skip the info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (progn
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
279 (if (re-search-forward ":[^:{ ]*:" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (goto-char (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (goto-char (point-max))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 ;; Default is to treat it like a stylesheet declaration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (t
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
284 (skip-chars-forward "^{")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
285 ;;(downcase-region save-pos (point))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (setq applies-to (w3-style-css-applies-to save-pos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (skip-chars-forward "^{")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (setq save-pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (forward-sexp 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (skip-chars-backward "\r}")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (subst-char-in-region save-pos (point) ?\n ? )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (subst-char-in-region save-pos (point) ?\r ? )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (setq attrs (w3-style-css-parse-args (1+ save-pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (point) defines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (skip-chars-forward "}\r\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (while applies-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (setq cur (car applies-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 applies-to (cdr applies-to))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (cond
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
301 ((string-match "\\([^.]*\\)\\.\\(.*\\)" cur) ; Normal class
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (setq tag (intern (downcase (match-string 1 cur)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 class (match-string 2 cur)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 ((string-match "\\(.*\\):\\(.*\\)" cur) ; Pseudo class
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (setq tag (intern (downcase (match-string 1 cur)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 class (match-string 2 cur)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (t ; No class - global
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (setq tag (intern (downcase cur))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 class 'internal)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (let ((loop attrs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (while loop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (if (stringp (car (car loop)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (setcar (car loop) (intern (car (car loop)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (setq att (car (car loop))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 val (cdr (car loop))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 loop (cdr loop))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (case att
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 ((align textalign text-align display white-space)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (setq val (intern (downcase val))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 ((indent left-margin right-margin top-margin bottom-margin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (setq val (string-to-int val)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (otherwise
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (let* ((node-1 (assq tag sheet))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (node-2 (and node-1 (assoc class node-1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (node-3 (and node-2 (assq att node-2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 ((not node-1) ; New top-level element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (setq sheet (cons (cons tag (list (cons class
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (cons att val)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 sheet)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 ((and node-1 (not node-2)) ; New class for existing element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (setcdr node-1 (cons (cons class (list (cons att val)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (cdr node-1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 ((and node-2 (not node-3)) ; attribute/value on old class
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (setcdr node-2 (cons (cons att val) (cdr node-2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (node-3 ; Replace existing attribute value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (setcdr node-3 val)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (skip-chars-forward " \t\r\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (kill-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (cons sheet defines)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (defvar w3-style-font-size-mappings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 '(("xx-small" . 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 ("x-small" . 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 ("small" . 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 ("medium" . 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 ("large" . 4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 ("x-large" . 5)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 ("xx-large" . 6)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 "A list of font size mappings")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (defvar w3-style-font-weight-mappings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 '(("-3" . :extra-light)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 ("-2" . :light)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 ("-1" . :demi-light)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 ("0" . :medium)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 ("1" . :normal)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 ("2" . :demi-bold)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 ("3" . :bold)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 ("4" . :extrabold)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 ("bold" . :bold)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 ("demi-light" . :demi-light)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 ("demi-bold" . :demi-bold)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 ("extra-bold" . :extra-bold)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 ("extra-light". :extra-light)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 "A list of font weight mappings.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (defun w3-style-font-size-for-index (index)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (if (stringp index)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (setq index (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (cdr-safe (assoc (downcase index)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 w3-style-font-size-mappings))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 3)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (setq index (- index 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (let ((scaler (if (> index 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 1.44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 0.695))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (size 12))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (setq index (abs index))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (while (/= index 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (setq size (* size scaler)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 index (1- index)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 ;; This rounds to the nearest '10'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (format "%dpt" (* 10 (round (/ size 10))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
392 (defsubst w3-style-speech-normalize-number (num)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
393 (if num (% (abs (read num)) 9)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
394
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
395 (defun w3-generate-stylesheet-voices (sheet)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
396 (let ((todo sheet)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
397 cur cur-classes
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
398 node family gain
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
399 left right pitch
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
400 pitch-range stress
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
401 richness voice
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
402 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
403 (while todo
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
404 (setq cur (car todo)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
405 cur-classes (cdr cur)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
406 todo (cdr todo))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
407 (while cur-classes
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
408 (setq node (cdr (car cur-classes))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
409 cur (car cur-classes)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
410 cur-classes (cdr cur-classes)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
411 family (cdr-safe (assq 'voice-family node))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
412 family (if family (intern (downcase family)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
413 gain (w3-style-speech-normalize-number
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
414 (cdr-safe (assq 'gain node)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
415 left (w3-style-speech-normalize-number
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
416 (cdr-safe (assq 'left-volume node)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
417 right (w3-style-speech-normalize-number
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
418 (cdr-safe (assq 'right-volume node)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
419 pitch (w3-style-speech-normalize-number
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
420 (cdr-safe (assq 'pitch node)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
421 pitch-range (w3-style-speech-normalize-number
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
422 (cdr-safe (assq 'pitch-range node)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
423 stress (w3-style-speech-normalize-number
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
424 (cdr-safe (assq 'stress node)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
425 richness (w3-style-speech-normalize-number
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
426 (cdr-safe (assq 'richness node))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
427 (if (or family gain left right pitch pitch-range stress richness)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
428 (setq voice (dtk-personality-from-speech-style
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
429 (make-dtk-speech-style :family (or family 'paul)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
430 :gain (or gain 5)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
431 :left-volume (or left 5)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
432 :right-volume (or right 5)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
433 :average-pitch (or pitch 5)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
434 :pitch-range (or pitch-range 5)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
435 :stress (or stress 5)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
436 :richness (or richness 5))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
437 (setq voice nil))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
438 (if voice (setcdr cur (cons (cons 'voice-spec voice) (cdr cur))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
439 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
440 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
441 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
442 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
443
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
444 (defun w3-style-post-process-stylesheet (sheet)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
445 (w3-generate-stylesheet-faces sheet)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
446 (if (featurep 'emacspeak)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
447 (w3-generate-stylesheet-voices w3-user-stylesheet)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
448
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
449 (defun w3-style-css-split-font-shorthand (font)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
450 ;; [<font-weight> || <font-style>]? <font-size> [ / <line-height> ]? <font-family>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
451 (let (weight size height family)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
452 (if (not (string-match " *\\([0-9.]+[^ /]+\\)" font))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
453 (error "Malformed font shorthand: %s" font))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
454 (setq weight (if (/= 0 (match-beginning 0))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
455 (substring font 0 (match-beginning 0)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
456 size (match-string 1 font)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
457 font (substring font (match-end 0) nil))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
458 (if (string-match " */ *\\([^ ]+\\) *" font)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
459 ;; they specified a line-height as well
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
460 (setq height (match-string 1 font)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
461 family (substring font (match-end 0) nil))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
462 (setq family (url-strip-leading-spaces font)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
463 (list weight size height family)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
464
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (defun w3-generate-stylesheet-faces (sheet)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (let ((todo sheet)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (cur nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (cur-classes nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (node nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (fore nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (back nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (pixmap nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (font nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (family nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (decoration nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (style nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (size nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (index nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (shorthand nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (weight nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (break-style nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (while todo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (setq cur (car todo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 cur-classes (cdr cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 todo (cdr todo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (while cur-classes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (setq node (cdr (car cur-classes))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 cur (car cur-classes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 cur-classes (cdr cur-classes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 fore (cdr-safe (assq 'color node))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 back (cdr-safe (assq 'background node))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 decoration (cdr-safe (assq 'text-decoration node))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 pixmap (cdr-safe (assq 'backdrop node))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 index (cdr-safe (assq 'font-size-index node))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 size (or (and index (w3-style-font-size-for-index index))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (cdr-safe (assq 'font-size node)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 family (cdr-safe (assq 'font-family node))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 weight (cdr-safe (assq 'font-weight node))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 weight (or (cdr-safe (assoc weight
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 w3-style-font-weight-mappings))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 weight)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 style (cdr-safe (assq 'font-style node))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 shorthand (cdr-safe (assq 'font node)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 ;; Make sure all 'break' items get intern'd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (if (or style decoration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (setq style (concat style decoration)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (setq break-style (assq 'break node))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (if (and (cdr break-style) (stringp (cdr break-style)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (setcdr break-style (intern (cdr break-style))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (if shorthand
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
512 (progn
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
513 (setq shorthand (w3-style-css-split-font-shorthand shorthand))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
514 (setq weight (or (nth 0 shorthand) weight)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
515 size (or (nth 1 shorthand) size)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
516 family (or (nth 3 shorthand) family)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 weight (or (cdr-safe
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (assoc weight
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 w3-style-font-weight-mappings))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
520 weight))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (if style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (setq style (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (while (string-match "-" x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (setq x (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (substring x 0 (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 (substring x (match-end 0) nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (intern-soft
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (concat "font-set-" (downcase x) "-p"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (delete "" (split-string style "[ \t&,]")))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
532 (if family (setq family (delete "" (split-string family ","))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (if (or family weight style size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (setq font (make-font :family family :weight weight :size size))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (while style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (and (fboundp (car style))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 (funcall (car style) font t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (setq style (cdr style))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (setq font nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (if font (setcdr cur (cons (cons 'font-spec font) (cdr cur))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (if fore (setcdr cur (cons (cons 'foreground fore) (cdr cur))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (if back (setcdr cur (cons (cons 'background back) (cdr cur))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (defun w3-handle-style (&optional args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (let ((fname (or (cdr-safe (assq 'href args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (cdr-safe (assq 'src args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (cdr-safe (assq 'uri args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (type (downcase (or (cdr-safe (assq 'notation args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 "experimental")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (url-working-buffer " *style*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (base (cdr-safe (assq 'base args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (stylesheet nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (defines nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (cur-sheet w3-current-stylesheet)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (string (cdr-safe (assq 'data args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (if fname (setq fname (url-expand-file-name fname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (cdr-safe
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (assoc base w3-base-alist)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (set-buffer (get-buffer-create url-working-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (setq url-be-asynchronous nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 ((member type '("experimental" "arena" "w3c-style" "css"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (let ((data (w3-style-parse-css fname string cur-sheet)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (setq stylesheet (nth 0 data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 defines (nth 1 data))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (w3-warn 'html "Unknown stylesheet notation: %s" type))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (setq w3-current-stylesheet stylesheet)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
576 (w3-style-post-process-stylesheet w3-current-stylesheet)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (defun w3-display-stylesheet (&optional sheet)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (if (not sheet) (setq sheet w3-current-stylesheet))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (with-output-to-temp-buffer "W3 Stylesheet"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (set-buffer standard-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (emacs-lisp-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (require 'pp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (pp sheet (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (provide 'w3-style)