Skip to content
Newer
Older
100755 123 lines (102 sloc) 3.9 KB
c27f5b3 Rename to version-less name
Edi Weitz authored Mar 9, 2009
1 ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package:CL-WHO; Base: 10 -*-
22a45b7 Dev version
Edi Weitz authored Mar 9, 2009
2 ;;; $Header: /usr/local/cvsrep/cl-who/specials.lisp,v 1.6 2009/01/26 11:10:49 edi Exp $
c27f5b3 Rename to version-less name
Edi Weitz authored Mar 9, 2009
3
22a45b7 Dev version
Edi Weitz authored Mar 9, 2009
4 ;;; Copyright (c) 2003-2009, Dr. Edmund Weitz. All rights reserved.
c27f5b3 Rename to version-less name
Edi Weitz authored Mar 9, 2009
5
6 ;;; Redistribution and use in source and binary forms, with or without
7 ;;; modification, are permitted provided that the following conditions
8 ;;; are met:
9
10 ;;; * Redistributions of source code must retain the above copyright
11 ;;; notice, this list of conditions and the following disclaimer.
12
13 ;;; * Redistributions in binary form must reproduce the above
14 ;;; copyright notice, this list of conditions and the following
15 ;;; disclaimer in the documentation and/or other materials
16 ;;; provided with the distribution.
17
18 ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
19 ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22 ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24 ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30 (in-package :cl-who)
31
32 #+:sbcl
33 (defmacro defconstant (name value &optional doc)
34 "Make sure VALUE is evaluated only once \(to appease SBCL)."
35 `(cl:defconstant ,name (if (boundp ',name) (symbol-value ',name) ,value)
36 ,@(when doc (list doc))))
37
38 (defvar *prologue*
39 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
40 "This is the first line that'll be printed if the :PROLOGUE keyword
41 argument is T")
42
22a45b7 Dev version
Edi Weitz authored Mar 9, 2009
43 (defvar *escape-char-p*
44 (lambda (char)
45 (or (find char "<>&'\"")
46 (> (char-code char) 127)))
c27f5b3 Rename to version-less name
Edi Weitz authored Mar 9, 2009
47 "Used by ESCAPE-STRING to test whether a character should be escaped.")
48
22a45b7 Dev version
Edi Weitz authored Mar 9, 2009
49 (defvar *indent* nil
c27f5b3 Rename to version-less name
Edi Weitz authored Mar 9, 2009
50 "Whether to insert line breaks and indent. Also controls amount of
51 indentation dynamically.")
52
53 (defvar *html-mode* :xml
3cf315c HTML5 support
Edi Weitz authored Oct 12, 2010
54 ":SGML for \(SGML-)HTML, :XML \(default) for XHTML, :HTML5 for HTML5.")
c27f5b3 Rename to version-less name
Edi Weitz authored Mar 9, 2009
55
56 (defvar *downcase-tokens-p* t
57 "If NIL, a keyword symbol representing a tag or attribute name will
58 not be automatically converted to lowercase. This is useful when one
59 needs to output case sensitive XML.")
60
22a45b7 Dev version
Edi Weitz authored Mar 9, 2009
61 (defvar *attribute-quote-char* #\'
c27f5b3 Rename to version-less name
Edi Weitz authored Mar 9, 2009
62 "Quote character for attributes.")
63
22a45b7 Dev version
Edi Weitz authored Mar 9, 2009
64 (defvar *empty-tag-end* " />"
c27f5b3 Rename to version-less name
Edi Weitz authored Mar 9, 2009
65 "End of an empty tag. Default is XML style.")
66
a4c3fca @nikodemus *HTML-NO-INDENT-TAGS*
nikodemus authored Apr 9, 2012
67 (defvar *html-no-indent-tags*
4151679 @nikodemus add :TEXTAREA to *HTML-NO-INDENT-TAGS*
nikodemus authored Apr 10, 2012
68 '(:pre :textarea)
69 "The list of HTML tags that should disable indentation inside them. The initial
70 value is a list containing only :PRE and :TEXTAREA.")
a4c3fca @nikodemus *HTML-NO-INDENT-TAGS*
nikodemus authored Apr 9, 2012
71
22a45b7 Dev version
Edi Weitz authored Mar 9, 2009
72 (defvar *html-empty-tags*
c27f5b3 Rename to version-less name
Edi Weitz authored Mar 9, 2009
73 '(:area
74 :atop
75 :audioscope
76 :base
77 :basefont
78 :br
79 :choose
80 :col
3cf315c HTML5 support
Edi Weitz authored Oct 12, 2010
81 :command
82 :embed
c27f5b3 Rename to version-less name
Edi Weitz authored Mar 9, 2009
83 :frame
84 :hr
85 :img
86 :input
87 :isindex
88 :keygen
89 :left
90 :limittext
91 :link
92 :meta
93 :nextid
94 :of
95 :over
96 :param
0ec40e4 @nikodemus delete trailing whitespace
nikodemus authored Apr 9, 2012
97 :range
c27f5b3 Rename to version-less name
Edi Weitz authored Mar 9, 2009
98 :right
3cf315c HTML5 support
Edi Weitz authored Oct 12, 2010
99 :source
c27f5b3 Rename to version-less name
Edi Weitz authored Mar 9, 2009
100 :spacer
101 :spot
102 :tab
3cf315c HTML5 support
Edi Weitz authored Oct 12, 2010
103 :track
c27f5b3 Rename to version-less name
Edi Weitz authored Mar 9, 2009
104 :wbr)
105 "The list of HTML tags that should be output as empty tags.
106 See *HTML-EMPTY-TAG-AWARE-P*.")
107
22a45b7 Dev version
Edi Weitz authored Mar 9, 2009
108 (defvar *html-empty-tag-aware-p* t
c27f5b3 Rename to version-less name
Edi Weitz authored Mar 9, 2009
109 "Set this to NIL to if you want to use CL-WHO as a strict XML
110 generator. Otherwise, CL-WHO will only write empty tags listed
111 in *HTML-EMPTY-TAGS* as <tag/> \(XHTML mode) or <tag> \(SGML
3cf315c HTML5 support
Edi Weitz authored Oct 12, 2010
112 mode and HTML5 mode). For all other tags, it will always generate
c27f5b3 Rename to version-less name
Edi Weitz authored Mar 9, 2009
113 <tag></tag>.")
114
115 (defconstant +newline+ (make-string 1 :initial-element #\Newline)
116 "Used for indentation.")
117
118 (defconstant +spaces+ (make-string 2000
119 :initial-element #\Space
120 :element-type 'base-char)
121 "Used for indentation.")
122
Something went wrong with that request. Please try again.