]> code.delx.au - gnu-emacs-elpa/blob - meta.rnc
Refine some ARIA checking to sync w/ current spec
[gnu-emacs-elpa] / meta.rnc
1 datatypes w = "http://whattf.org/datatype-draft"
2
3 # #####################################################################
4 ## RELAX NG Schema for HTML 5: Global Structure & Metadata #
5 # #####################################################################
6
7 ## Root Element: <html>
8
9 html.elem =
10 element html { html.inner & html.attrs }
11 html.attrs =
12 ( common.attrs
13 & ( common.attrs.aria.role.presentation
14 | common.attrs.aria.role.menuitem
15 )?
16 )
17 html.inner =
18 ( head.elem
19 , body.elem
20 )
21
22 ## Metadata Container: <head>
23
24 head.elem =
25 element head { head.inner & head.attrs }
26 head.attrs =
27 ( common.attrs
28 # & head.attrs.profile?
29 & ( common.attrs.aria.role.presentation
30 | common.attrs.aria.role.menuitem
31 )?
32 )
33 # head.attrs.profile =
34 # attribute profile {
35 # common.data.uris #REVISIT should these be absolute (zero or more)
36 # }
37 head.inner =
38 ( title.elem
39 & base.elem? # REVISIT need a non-schema checker or Schematron
40 & common.inner.metadata # Limit encoding decl position in Schematron
41 )
42 # head.inner =
43 # ( meta.elem.encoding?
44 # , ( title.elem
45 # & base.elem? # REVISIT need a non-schema checker or Schematron
46 # & common.inner.metadata
47 # )
48 # )
49
50 ## Content Container: <body>
51
52 body.elem =
53 element body { body.inner & body.attrs }
54 body.attrs =
55 ( common.attrs
56 & ( common.attrs.aria.landmark.application
57 | common.attrs.aria.landmark.document
58 | common.attrs.aria.role.presentation
59 | common.attrs.aria.implicit.document
60 )?
61 & body.attrs.onafterprint?
62 & body.attrs.onbeforeprint?
63 & body.attrs.onbeforeunload?
64 & body.attrs.onhashchange?
65 & body.attrs.onmessage?
66 & body.attrs.onoffline?
67 & body.attrs.ononline?
68 & body.attrs.onpagehide?
69 & body.attrs.onpageshow?
70 & body.attrs.onpopstate?
71 & body.attrs.onresize?
72 & body.attrs.onstorage?
73 & body.attrs.onunload?
74 )
75 body.inner =
76 ( common.inner.flow )
77
78 body.attrs.onafterprint =
79 attribute onafterprint { common.data.functionbody }
80 body.attrs.onbeforeprint =
81 attribute onbeforeprint { common.data.functionbody }
82 body.attrs.onbeforeunload =
83 attribute onbeforeunload { common.data.functionbody }
84 body.attrs.onhashchange =
85 attribute onhashchange { common.data.functionbody }
86 body.attrs.onmessage =
87 attribute onmessage { common.data.functionbody }
88 body.attrs.onoffline =
89 attribute onoffline { common.data.functionbody }
90 body.attrs.ononline =
91 attribute ononline { common.data.functionbody }
92 body.attrs.onpopstate =
93 attribute onpopstate { common.data.functionbody }
94 body.attrs.onpagehide =
95 attribute onpagehide { common.data.functionbody }
96 body.attrs.onpageshow =
97 attribute onpageshow { common.data.functionbody }
98 body.attrs.onredo =
99 attribute onredo { common.data.functionbody }
100 body.attrs.onresize =
101 attribute onresize { common.data.functionbody }
102 body.attrs.onstorage =
103 attribute onstorage { common.data.functionbody }
104 body.attrs.onundo =
105 attribute onundo { common.data.functionbody }
106 body.attrs.onunload =
107 attribute onunload { common.data.functionbody }
108
109 ## Document Title: <title>
110
111 title.elem =
112 element title { title.inner & title.attrs }
113 title.attrs =
114 ( common.attrs
115 & ( common.attrs.aria.role.presentation
116 | common.attrs.aria.role.menuitem
117 )?
118 )
119 title.inner =
120 ( text )
121
122 ## Base URI: <base>
123
124 base.elem =
125 element base { base.inner & base.attrs }
126 base.attrs =
127 ( common.attrs.basic
128 & common.attrs.i18n
129 & common.attrs.present
130 & common.attrs.other
131 & ( ( base.attrs.href
132 & base.attrs.target?
133 )
134 | base.attrs.target
135 )
136 & ( common.attrs.aria.role.presentation
137 | common.attrs.aria.role.menuitem
138 )?
139 )
140 base.attrs.href =
141 attribute href {
142 common.data.uri
143 }
144 base.attrs.target =
145 attribute target {
146 common.data.browsing-context-or-keyword
147 }
148 base.inner =
149 ( empty )
150
151 ## Global Relationships: <link>
152
153 link.elem =
154 element link { link.inner & link.attrs }
155 link.attrs =
156 ( common.attrs.basic
157 & common.attrs.i18n
158 & common.attrs.present
159 & common.attrs.other
160 & link.attrs.href
161 & link.attrs.rel
162 & shared-hyperlink.attrs.hreflang?
163 & shared-hyperlink.attrs.media?
164 & shared-hyperlink.attrs.type?
165 & link.attrs.sizes?
166 # link.attrs.title included in common.attrs
167 & embedded.content.attrs.crossorigin?
168 & ( common.attrs.aria.role.link
169 | common.attrs.aria.role.presentation
170 | common.attrs.aria.role.menuitem
171 )?
172 )
173 link.attrs.href =
174 attribute href {
175 common.data.uri.non-empty
176 }
177 link.attrs.rel =
178 attribute rel {
179 w:link-rel
180 }
181 link.attrs.sizes =
182 attribute sizes {
183 w:string "any" | common.data.sizes
184 }
185 link.inner =
186 ( empty )
187
188 common.elem.metadata |= link.elem
189
190 ## Global Style: <style>
191
192 style.elem =
193 element style { style.inner & style.attrs }
194 style.attrs =
195 ( common.attrs
196 & style.attrs.type?
197 & style.attrs.media?
198 # style.attrs.title included in common.attrs
199 & ( common.attrs.aria.role.presentation
200 | common.attrs.aria.role.menuitem
201 )?
202 )
203 style.attrs.type =
204 attribute type {
205 common.data.mimetype
206 }
207 style.attrs.media =
208 attribute media {
209 common.data.mediaquery
210 }
211 style.inner =
212 ( common.inner.anything )
213
214 common.elem.metadata |= style.elem
215
216 ## Scoped Style: <style scoped>
217
218 style.elem.scoped =
219 element style { style.inner & style.scoped.attrs }
220 style.scoped.attrs =
221 ( common.attrs
222 & style.attrs.type?
223 & style.attrs.media?
224 & style.attrs.scoped
225 # style.attrs.title included in common.attrs
226 & ( common.attrs.aria.role.presentation
227 | common.attrs.aria.role.menuitem
228 )?
229 )
230 style.attrs.scoped =
231 attribute scoped {
232 w:string "scoped" | w:string ""
233 }
234
235 ## Name-Value Metadata: <meta name>
236
237 meta.name.elem =
238 element meta { meta.inner & meta.name.attrs }
239 meta.name.attrs =
240 ( common.attrs.basic
241 & common.attrs.i18n
242 & common.attrs.present
243 & common.attrs.other
244 & meta.name.attrs.name
245 & meta.name.attrs.content
246 & ( common.attrs.aria.role.presentation
247 | common.attrs.aria.role.menuitem
248 )?
249 )
250 meta.name.attrs.name =
251 attribute name {
252 w:non-empty-string
253 }
254 meta.name.attrs.content =
255 attribute content {
256 string
257 }
258 meta.inner =
259 ( empty )
260
261 common.elem.metadata |= meta.name.elem
262
263 ## "refresh" pragma directive: <meta http-equiv='refresh'>
264
265 meta.http-equiv.refresh.elem =
266 element meta { meta.inner & meta.http-equiv.refresh.attrs }
267 meta.http-equiv.refresh.attrs =
268 ( common.attrs.basic
269 & common.attrs.i18n
270 & common.attrs.present
271 & common.attrs.other
272 & meta.http-equiv.attrs.http-equiv.refresh
273 & meta.http-equiv.attrs.content.refresh
274 & ( common.attrs.aria.role.presentation
275 | common.attrs.aria.role.menuitem
276 )?
277 )
278 meta.http-equiv.attrs.http-equiv.refresh =
279 attribute http-equiv {
280 w:string "refresh"
281 }
282 meta.http-equiv.attrs.content.refresh =
283 attribute content {
284 common.data.refresh
285 }
286 common.elem.metadata |= meta.http-equiv.refresh.elem # not quite right per spec
287 # if the definition is
288 # reused in another language
289
290 ## "default-style" pragma directive: <meta http-equiv='default-style'>
291
292 meta.http-equiv.default-style.elem =
293 element meta { meta.inner & meta.http-equiv.default-style.attrs }
294 meta.http-equiv.default-style.attrs =
295 ( common.attrs.basic
296 & common.attrs.i18n
297 & common.attrs.present
298 & common.attrs.other
299 & meta.http-equiv.attrs.http-equiv.default-style
300 & meta.http-equiv.attrs.content.default-style
301 & ( common.attrs.aria.role.presentation
302 | common.attrs.aria.role.menuitem
303 )?
304 )
305 meta.http-equiv.attrs.http-equiv.default-style =
306 attribute http-equiv {
307 w:string "default-style"
308 }
309 meta.http-equiv.attrs.content.default-style =
310 attribute content {
311 common.data.default-style
312 }
313
314 common.elem.metadata |= meta.http-equiv.default-style.elem # not quite right per spec
315 # if the definition is
316 # reused in another language
317
318 ## "x-ua-compatible" pragma directive: <meta http-equiv='x-ua-compatible'>
319
320 meta.http-equiv.x-ua-compatible.elem =
321 element meta { meta.inner & meta.http-equiv.x-ua-compatible.attrs }
322 meta.http-equiv.x-ua-compatible.attrs =
323 ( common.attrs.basic
324 & common.attrs.i18n
325 & common.attrs.present
326 & common.attrs.other
327 & meta.http-equiv.attrs.http-equiv.x-ua-compatible
328 & meta.http-equiv.attrs.content.x-ua-compatible
329 & ( common.attrs.aria.role.presentation
330 | common.attrs.aria.role.menuitem
331 )?
332 )
333 meta.http-equiv.attrs.http-equiv.x-ua-compatible =
334 attribute http-equiv {
335 w:string "x-ua-compatible"
336 }
337 meta.http-equiv.attrs.content.x-ua-compatible =
338 attribute content {
339 common.data.x-ua-compatible
340 }
341 common.elem.metadata |= meta.http-equiv.x-ua-compatible.elem
342
343 ## Inline Character Encoding Statement for HTML: <meta charset>
344
345 meta.charset.elem =
346 element meta { meta.inner & meta.charset.attrs }
347 meta.charset.attrs =
348 ( common.attrs.basic
349 & common.attrs.i18n
350 & common.attrs.present
351 & common.attrs.other
352 & meta.charset.attrs.charset
353 & ( common.attrs.aria.role.presentation
354 | common.attrs.aria.role.menuitem
355 )?
356 )
357 meta.charset.attrs.charset =
358 attribute charset {
359 (common.data.charset & HTMLonly)
360 | (xsd:string {
361 pattern = "[uU][tT][fF]-8"
362 } & XMLonly )
363 }
364
365 ## Inline Character Encoding Statement for HTML: <meta http-equiv='content-type'>
366
367 meta.http-equiv.content-type.elem =
368 element meta { meta.inner & meta.http-equiv.content-type.attrs }
369 & HTMLonly
370 meta.http-equiv.content-type.attrs =
371 ( common.attrs.basic
372 & common.attrs.i18n
373 & common.attrs.present
374 & common.attrs.other
375 & meta.http-equiv.attrs.http-equiv.content-type
376 & meta.http-equiv.attrs.content.content-type
377 & ( common.attrs.aria.role.presentation
378 | common.attrs.aria.role.menuitem
379 )?
380 )
381 meta.http-equiv.attrs.http-equiv.content-type =
382 attribute http-equiv {
383 w:string "content-type"
384 }
385 meta.http-equiv.attrs.content.content-type =
386 attribute content {
387 common.data.meta-charset
388 }
389
390 common.elem.metadata |= ( meta.charset.elem | meta.http-equiv.content-type.elem )