2
|
1 ;;; w3-style.el --- Emacs-W3 binding style sheet mechanism
|
0
|
2 ;; Author: wmperry
|
16
|
3 ;; Created: 1997/01/17 14:27:39
|
|
4 ;; Version: 1.25
|
0
|
5 ;; Keywords: faces, hypermedia
|
|
6
|
|
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2
|
8 ;;; Copyright (c) 1993 - 1996 by William M. Perry (wmperry@cs.indiana.edu)
|
16
|
9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
|
0
|
10 ;;;
|
14
|
11 ;;; This file is part of GNU Emacs.
|
0
|
12 ;;;
|
|
13 ;;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
14 ;;; it under the terms of the GNU General Public License as published by
|
|
15 ;;; the Free Software Foundation; either version 2, or (at your option)
|
|
16 ;;; any later version.
|
|
17 ;;;
|
|
18 ;;; GNU Emacs is distributed in the hope that it will be useful,
|
|
19 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21 ;;; GNU General Public License for more details.
|
|
22 ;;;
|
|
23 ;;; You should have received a copy of the GNU General Public License
|
14
|
24 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
|
|
25 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
26 ;;; Boston, MA 02111-1307, USA.
|
0
|
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
28
|
|
29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
30 ;;; A style sheet mechanism for emacs-w3
|
|
31 ;;;
|
|
32 ;;; This will eventually be able to under DSSSL[-lite] as well as the
|
|
33 ;;; experimental W3C mechanism
|
|
34 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
35 (require 'font)
|
|
36 (require 'w3-keyword)
|
|
37 (require 'cl)
|
14
|
38 (require 'css)
|
0
|
39
|
|
40
|
|
41
|
16
|
42 (defun w3-handle-style (&optional plist)
|
|
43 (let ((url (or (plist-get plist 'href)
|
|
44 (plist-get plist 'src)
|
|
45 (plist-get plist 'uri)))
|
|
46 (media (intern (downcase (or (plist-get plist 'media) "all"))))
|
|
47 (type (downcase (or (plist-get plist 'notation) "text/css")))
|
0
|
48 (url-working-buffer " *style*")
|
|
49 (stylesheet nil)
|
|
50 (defines nil)
|
|
51 (cur-sheet w3-current-stylesheet)
|
16
|
52 (string (plist-get plist 'data)))
|
|
53 (if (not (memq media (css-active-device-types)))
|
|
54 nil ; Not applicable to us!
|
|
55 (save-excursion
|
|
56 (set-buffer (get-buffer-create url-working-buffer))
|
|
57 (erase-buffer)
|
|
58 (setq url-be-asynchronous nil)
|
|
59 (cond
|
|
60 ((member type '("experimental" "arena" "w3c-style" "css" "text/css"))
|
|
61 (setq stylesheet (css-parse url string cur-sheet)))
|
|
62 (t
|
|
63 (w3-warn 'html "Unknown stylesheet notation: %s" type))))
|
|
64 (setq w3-current-stylesheet stylesheet))))
|
0
|
65
|
|
66 (defun w3-display-stylesheet (&optional sheet)
|
|
67 (interactive)
|
|
68 (if (not sheet) (setq sheet w3-current-stylesheet))
|
14
|
69 (css-display sheet))
|
0
|
70
|
|
71 (provide 'w3-style)
|