-
Notifications
You must be signed in to change notification settings - Fork 0
/
doctype.scm
99 lines (88 loc) · 4.13 KB
/
doctype.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
;; Some XHTML and HTML doctypes, as strings
;; Author: Jim Ursetto
;; License: Public domain
;; see HTML5 spec 8.1.1 "The DOCTYPE"
;; (http://dev.w3.org/html5/spec/Overview.html#the-doctype)
(module doctype
(
doctype-html
;; legacy doctype string
doctype-html-legacy
;; obsolete permitted doctype strings
doctype-html-4.01-strict
doctype-xhtml-1.0-strict
doctype-html-4.01-transitional
doctype-xhtml-1.0-transitional
doctype-html-4.01-frameset
doctype-xhtml-1.0-frameset
doctype-html-3.2
doctype-html-2.0
;; sxml-transforms
doctype-rules
;; deprecated aliases for users of older doctype egg
html-4.01-strict
xhtml-1.0-strict
html-4.01-transitional
xhtml-1.0-transitional
html-4.01-frameset
xhtml-1.0-frameset
html-3.2
html-2.0
)
(import scheme)
(cond-expand
(chicken-4 (import data-structures))
(else (import (chicken base))))
;; generic html doctype (introduced in HTML5; backward compatible with all known browsers)
(define doctype-html
"<!DOCTYPE HTML>")
;; legacy html doctype -- don't use, provided only for completeness
(define doctype-html-legacy
"<!DOCTYPE HTML SYSTEM \"about:legacy-compat\">")
;; obsolete permitted html doctypes
(define doctype-html-4.01-strict
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">")
(define doctype-xhtml-1.0-strict
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">")
(define doctype-html-4.01-transitional
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">")
(define doctype-xhtml-1.0-transitional
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">")
(define doctype-html-4.01-frameset
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">")
(define doctype-xhtml-1.0-frameset
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">")
(define doctype-html-3.2
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">")
(define doctype-html-2.0
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">")
;; deprecated aliases for this module
(define html-4.01-strict doctype-html-4.01-strict)
(define xhtml-1.0-strict doctype-xhtml-1.0-strict)
(define html-4.01-transitional doctype-html-4.01-transitional)
(define xhtml-1.0-transitional doctype-xhtml-1.0-transitional)
(define html-4.01-frameset doctype-html-4.01-frameset)
(define xhtml-1.0-frameset doctype-xhtml-1.0-frameset)
(define html-3.2 doctype-html-3.2)
(define html-2.0 doctype-html-2.0)
;; example rules for sxml-transforms
(define doctype-rules
`((doctype-html *preorder* . ,(constantly doctype-html))
(doctype-html-4.01-strict *preorder* . ,(constantly doctype-html-4.01-strict))
(doctype-xhtml-1.0-strict *preorder* . ,(constantly doctype-xhtml-1.0-strict))
(doctype-html-4.01-transitional *preorder* . ,(constantly doctype-html-4.01-transitional))
(doctype-xhtml-1.0-transitional *preorder* . ,(constantly doctype-xhtml-1.0-transitional))
(doctype-html-4.01-frameset *preorder* . ,(constantly doctype-html-4.01-frameset))
(doctype-xhtml-1.0-frameset *preorder* . ,(constantly doctype-xhtml-1.0-frameset))
(doctype-html-3.2 *preorder* . ,(constantly doctype-html-3.2))
(doctype-html-2.0 *preorder* . ,(constantly doctype-html-2.0))
;; deprecated aliases (probably retained for the foreseeable future, though)
(html-4.01-strict *preorder* . ,(constantly doctype-html-4.01-strict))
(xhtml-1.0-strict *preorder* . ,(constantly doctype-xhtml-1.0-strict))
(html-4.01-transitional *preorder* . ,(constantly doctype-html-4.01-transitional))
(xhtml-1.0-transitional *preorder* . ,(constantly doctype-xhtml-1.0-transitional))
(html-4.01-frameset *preorder* . ,(constantly doctype-html-4.01-frameset))
(xhtml-1.0-frameset *preorder* . ,(constantly doctype-xhtml-1.0-frameset))
(html-3.2 *preorder* . ,(constantly doctype-html-3.2))
(html-2.0 *preorder* . ,(constantly doctype-html-2.0))))
)