comparison lisp/w3/css.el @ 136:b980b6286996 r20-2b2

Import from CVS: tag r20-2b2
author cvs
date Mon, 13 Aug 2007 09:31:12 +0200
parents 34a5b81f86ba
children 5a88923fcbfe
comparison
equal deleted inserted replaced
135:4636a6841cd6 136:b980b6286996
1 ;;; css.el -- Cascading Style Sheet parser 1 ;;; css.el -- Cascading Style Sheet parser
2 ;; Author: wmperry 2 ;; Author: wmperry
3 ;; Created: 1997/04/17 13:50:34 3 ;; Created: 1997/04/21 14:00:12
4 ;; Version: 1.36 4 ;; Version: 1.38
5 ;; Keywords: 5 ;; Keywords:
6 6
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@cs.indiana.edu) 8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@cs.indiana.edu)
9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc. 9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
771 (defun css-active-device-types (&optional device) 771 (defun css-active-device-types (&optional device)
772 (let ((types (list 'all 772 (let ((types (list 'all
773 (if css-running-xemacs 'xemacs 'emacs) 773 (if css-running-xemacs 'xemacs 'emacs)
774 (if (css-color-light-p 'default) 'light 'dark))) 774 (if (css-color-light-p 'default) 'light 'dark)))
775 (type (device-type device))) 775 (type (device-type device)))
776 ;; For reasons I don't really want to get into, emacspeak and TTY
777 ;; are mutually exclusive for most of our purposes (insert-before,
778 ;; xetc)
779 (if (featurep 'emacspeak)
780 (setq types (cons 'speech types))
781 (if (eq type 'tty)
782 (setq types (cons 'tty types))))
776 (cond 783 (cond
777 ((featurep 'emacspeak)
778 (setq types (cons 'speech types)))
779 ((eq type 'tty)
780 (if (and (fboundp 'tty-color-list)
781 (/= 0 (length (tty-color-list))))
782 (setq types (cons 'ansi-tty types))
783 (setq types (cons 'tty types))))
784 ((eq 'color (device-class)) 784 ((eq 'color (device-class))
785 (if (not (device-bitplanes)) 785 (if (not (device-bitplanes))
786 (setq types (cons 'color types)) 786 (setq types (cons 'color types))
787 (setq types 787 (setq types
788 (append 788 (append
800 types))) 800 types)))
801 ((eq 'mono (device-class)) 801 ((eq 'mono (device-class))
802 (setq types (append (list 'mono 'monochrome) types))) 802 (setq types (append (list 'mono 'monochrome) types)))
803 (t 803 (t
804 (setq types (cons 'unknown types)))) 804 (setq types (cons 'unknown types))))
805 ;; FIXME: Remove me when the real 3.0 comes out
806 (if (and (memq 'tty types) (memq 'color types))
807 (setq types (cons 'ansi-tty types)))
805 types)) 808 types))
806 809
807 (defmacro css-rule-specificity-internal (rule) 810 (defmacro css-rule-specificity-internal (rule)
808 (` 811 (`
809 (progn 812 (progn
896 ;; *sigh* SGML comments are being used to 'hide' data inlined 899 ;; *sigh* SGML comments are being used to 'hide' data inlined
897 ;; with the <style> tag from older browsers. 900 ;; with the <style> tag from older browsers.
898 ((or (looking-at "<!--+") ; begin 901 ((or (looking-at "<!--+") ; begin
899 (looking-at "--+>")) ; end 902 (looking-at "--+>")) ; end
900 (goto-char (match-end 0))) 903 (goto-char (match-end 0)))
901 ;; C++ style comments, and we are doing IE compatibility 904 ;; C++ style comments
902 ((looking-at "//") 905 ((looking-at "//")
903 (end-of-line)) 906 (end-of-line))
904 ;; Pre-Processor directives 907 ;; Pre-Processor directives
905 ((looking-at "[ \t\r]*@\\([^ \t\r\n]\\)") 908 ((looking-at "[ \t\r]*@\\([^ \t\r\n]\\)")
906 (let (data directive) 909 (let (data directive)