forked from ballerina-platform/ballerina-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspec.rnc
83 lines (61 loc) · 2.21 KB
/
spec.rnc
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
# Schema for specific subset of XHTML used by the spec
start = element html { attribute lang { token }, head, body }
head = element head { title & meta & style & link* & script* }
title = element title { text }
meta = element meta { attribute charset { "utf-8" } }
style = element style {
attribute type { "text/css" },
text
}
link = element link { attribute rel { token }, attribute href { string} }
script = element script { attribute src { string } }
body = element body { h1, block*, section2* }
# Blocks
block = p|ul|ol|pre|table
# Headings
h1 = element h1 { h.model }
section2 = element section { section2.class?, h2, block*, section3* }
section2.class = attribute class { "toc" | "appendix" }
h2 = element h2 { h.model }
section3 = element section { h3, block*, section4* }
h3 = element h3 { h.model }
section4 = element section { h4, block*, section5* }
h4 = element h4 { h.model }
section5 = element section { h5, block* }
h5 = element h5 { h.model }
h.model = attribute id { token }?, inline.content
# Paragraphs
p = element p { p.class?, inline.content }
p.class = attribute class { "status" | "langlib" }
pre = element pre { pre.class?, pre.content }
pre.class = attribute class { "grammar" | "langlib" }
# libxml2 seems to have some problems with allowed content depending
# on attribute value, so keep this simple
pre.content = mixed { (inline | element dfn|abbr { text })* }
# Lists
ol = element ol { li+ }
ul = element ul { li+ }
li = element li { inline.content, (ul|ol)* }
# Tables
table = element table { tr+ }
tr = element tr { (th|td)* }
td = element td { tcell.model }
th = element th { tcell.model }
tcell.model = tcell.rowspan?, tcell.colspan?, inline.content
tcell.rowspan = attribute rowspan { token }
tcell.colspan = attribute colspan { token }
# Inline
inline = code|var|em|strong|a|sub|sup|br
inline.content = mixed { inline* }
code = element code { attribute class { "grammar" }?, inline.content }
var = element var { inline.content }
em = element em { inline.content }
strong = element strong { inline.content }
sub = element sub { inline.content }
sup = element sup { inline.content }
br = element br { empty }
a = element a {
attribute href { text },
attribute type { text }?,
inline.content
}