]> code.delx.au - gnu-emacs-elpa/blob - packages/html5-schema/meta.rnc
Add 'packages/html5-schema/' from commit '6e7c7c331e7f6692be6c7d39fb9485792f0d3513'
[gnu-emacs-elpa] / packages / html5-schema / 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.onstorage?
72 & body.attrs.onunload?
73 )
74 body.inner =
75 ( common.inner.flow )
76
77 body.attrs.onafterprint =
78 attribute onafterprint { common.data.functionbody }
79 body.attrs.onbeforeprint =
80 attribute onbeforeprint { common.data.functionbody }
81 body.attrs.onbeforeunload =
82 attribute onbeforeunload { common.data.functionbody }
83 body.attrs.onhashchange =
84 attribute onhashchange { common.data.functionbody }
85 body.attrs.onmessage =
86 attribute onmessage { common.data.functionbody }
87 body.attrs.onoffline =
88 attribute onoffline { common.data.functionbody }
89 body.attrs.ononline =
90 attribute ononline { common.data.functionbody }
91 body.attrs.onpopstate =
92 attribute onpopstate { common.data.functionbody }
93 body.attrs.onpagehide =
94 attribute onpagehide { common.data.functionbody }
95 body.attrs.onpageshow =
96 attribute onpageshow { common.data.functionbody }
97 body.attrs.onredo =
98 attribute onredo { common.data.functionbody }
99 body.attrs.onresize =
100 attribute onresize { common.data.functionbody }
101 body.attrs.onstorage =
102 attribute onstorage { common.data.functionbody }
103 body.attrs.onundo =
104 attribute onundo { common.data.functionbody }
105 body.attrs.onunload =
106 attribute onunload { common.data.functionbody }
107
108 ## Document Title: <title>
109
110 title.elem =
111 element title { title.inner & title.attrs }
112 title.attrs =
113 ( common.attrs
114 & ( common.attrs.aria.role.presentation
115 | common.attrs.aria.role.menuitem
116 )?
117 )
118 title.inner =
119 ( text )
120
121 ## Base URI: <base>
122
123 base.elem =
124 element base { base.inner & base.attrs }
125 base.attrs =
126 ( common.attrs.basic
127 & common.attrs.i18n
128 & common.attrs.present
129 & common.attrs.other
130 & ( ( base.attrs.href
131 & base.attrs.target?
132 )
133 | base.attrs.target
134 )
135 & ( common.attrs.aria.role.presentation
136 | common.attrs.aria.role.menuitem
137 )?
138 )
139 base.attrs.href =
140 attribute href {
141 common.data.uri
142 }
143 base.attrs.target =
144 attribute target {
145 common.data.browsing-context-or-keyword
146 }
147 base.inner =
148 ( empty )
149
150 ## Global Relationships: <link>
151
152 link.elem =
153 element link { link.inner & link.attrs }
154 link.attrs =
155 ( common.attrs.basic
156 & common.attrs.i18n
157 & common.attrs.present
158 & common.attrs.other
159 & link.attrs.href
160 & link.attrs.rel
161 & link.attrs.integrity?
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.integrity =
182 attribute integrity {
183 common.data.integrity
184 }
185 link.attrs.sizes =
186 attribute sizes {
187 w:string "any" | common.data.sizes
188 }
189 link.inner =
190 ( empty )
191
192 common.elem.metadata |= link.elem
193
194 ## Global Style: <style>
195
196 style.elem =
197 element style { style.inner & style.attrs }
198 style.attrs =
199 ( common.attrs
200 & style.attrs.type?
201 & style.attrs.media?
202 & style.attrs.nonce?
203 # style.attrs.title included in common.attrs
204 & ( common.attrs.aria.role.presentation
205 | common.attrs.aria.role.menuitem
206 )?
207 )
208 style.attrs.type =
209 attribute type {
210 common.data.mimetype
211 }
212 style.attrs.media =
213 attribute media {
214 common.data.mediaquery
215 }
216 style.attrs.nonce =
217 attribute nonce{
218 string
219 }
220 style.inner =
221 ( common.inner.anything )
222
223 common.elem.metadata |= style.elem
224
225 ## Scoped Style: <style scoped>
226
227 style.elem.scoped =
228 element style { style.inner & style.scoped.attrs }
229 style.scoped.attrs =
230 ( common.attrs
231 & style.attrs.type?
232 & style.attrs.media?
233 & style.attrs.scoped
234 # style.attrs.title included in common.attrs
235 & ( common.attrs.aria.role.presentation
236 | common.attrs.aria.role.menuitem
237 )?
238 )
239 style.attrs.scoped =
240 attribute scoped {
241 w:string "scoped" | w:string ""
242 }
243
244 ## Name-Value Metadata: <meta name>
245
246 meta.name.elem =
247 element meta { meta.inner & meta.name.attrs }
248 meta.name.attrs =
249 ( common.attrs.basic
250 & common.attrs.i18n
251 & common.attrs.present
252 & common.attrs.other
253 & meta.name.attrs.name
254 & meta.name.attrs.content
255 & ( common.attrs.aria.role.presentation
256 | common.attrs.aria.role.menuitem
257 )?
258 )
259 meta.name.attrs.name =
260 attribute name {
261 w:non-empty-string
262 }
263 meta.name.attrs.content =
264 attribute content {
265 string
266 }
267 meta.inner =
268 ( empty )
269
270 common.elem.metadata |= meta.name.elem
271
272 ## "refresh" pragma directive: <meta http-equiv='refresh'>
273
274 meta.http-equiv.refresh.elem =
275 element meta { meta.inner & meta.http-equiv.refresh.attrs }
276 meta.http-equiv.refresh.attrs =
277 ( common.attrs.basic
278 & common.attrs.i18n
279 & common.attrs.present
280 & common.attrs.other
281 & meta.http-equiv.attrs.http-equiv.refresh
282 & meta.http-equiv.attrs.content.refresh
283 & ( common.attrs.aria.role.presentation
284 | common.attrs.aria.role.menuitem
285 )?
286 )
287 meta.http-equiv.attrs.http-equiv.refresh =
288 attribute http-equiv {
289 w:string "refresh"
290 }
291 meta.http-equiv.attrs.content.refresh =
292 attribute content {
293 common.data.refresh
294 }
295 common.elem.metadata |= meta.http-equiv.refresh.elem # not quite right per spec
296 # if the definition is
297 # reused in another language
298
299 ## "default-style" pragma directive: <meta http-equiv='default-style'>
300
301 meta.http-equiv.default-style.elem =
302 element meta { meta.inner & meta.http-equiv.default-style.attrs }
303 meta.http-equiv.default-style.attrs =
304 ( common.attrs.basic
305 & common.attrs.i18n
306 & common.attrs.present
307 & common.attrs.other
308 & meta.http-equiv.attrs.http-equiv.default-style
309 & meta.http-equiv.attrs.content.default-style
310 & ( common.attrs.aria.role.presentation
311 | common.attrs.aria.role.menuitem
312 )?
313 )
314 meta.http-equiv.attrs.http-equiv.default-style =
315 attribute http-equiv {
316 w:string "default-style"
317 }
318 meta.http-equiv.attrs.content.default-style =
319 attribute content {
320 common.data.default-style
321 }
322
323 common.elem.metadata |= meta.http-equiv.default-style.elem # not quite right per spec
324 # if the definition is
325 # reused in another language
326
327 ## Content Security Policy pragma directive: <meta http-equiv='content-security-policy'>
328
329 meta.http-equiv.content-security-policy.elem =
330 element meta { meta.inner & meta.http-equiv.content-security-policy.attrs }
331 meta.http-equiv.content-security-policy.attrs =
332 ( common.attrs.basic
333 & common.attrs.i18n
334 & common.attrs.present
335 & common.attrs.other
336 & meta.http-equiv.attrs.http-equiv.content-security-policy
337 & meta.http-equiv.attrs.content.content-security-policy
338 & ( common.attrs.aria.role.presentation
339 | common.attrs.aria.role.menuitem
340 )?
341 )
342 meta.http-equiv.attrs.http-equiv.content-security-policy =
343 attribute http-equiv {
344 w:string "content-security-policy"
345 }
346 meta.http-equiv.attrs.content.content-security-policy =
347 attribute content {
348 common.data.content-security-policy
349 }
350 common.elem.metadata |= meta.http-equiv.content-security-policy.elem
351
352 ## "x-ua-compatible" pragma directive: <meta http-equiv='x-ua-compatible'>
353
354 meta.http-equiv.x-ua-compatible.elem =
355 element meta { meta.inner & meta.http-equiv.x-ua-compatible.attrs }
356 meta.http-equiv.x-ua-compatible.attrs =
357 ( common.attrs.basic
358 & common.attrs.i18n
359 & common.attrs.present
360 & common.attrs.other
361 & meta.http-equiv.attrs.http-equiv.x-ua-compatible
362 & meta.http-equiv.attrs.content.x-ua-compatible
363 & ( common.attrs.aria.role.presentation
364 | common.attrs.aria.role.menuitem
365 )?
366 )
367 meta.http-equiv.attrs.http-equiv.x-ua-compatible =
368 attribute http-equiv {
369 w:string "x-ua-compatible"
370 }
371 meta.http-equiv.attrs.content.x-ua-compatible =
372 attribute content {
373 common.data.x-ua-compatible
374 }
375 common.elem.metadata |= meta.http-equiv.x-ua-compatible.elem
376
377 ## Inline Character Encoding Statement for HTML: <meta charset>
378
379 meta.charset.elem =
380 element meta { meta.inner & meta.charset.attrs }
381 meta.charset.attrs =
382 ( common.attrs.basic
383 & common.attrs.i18n
384 & common.attrs.present
385 & common.attrs.other
386 & meta.charset.attrs.charset
387 & ( common.attrs.aria.role.presentation
388 | common.attrs.aria.role.menuitem
389 )?
390 )
391 meta.charset.attrs.charset =
392 attribute charset {
393 (common.data.charset & HTMLonly)
394 | (xsd:string {
395 pattern = "[uU][tT][fF]-8"
396 } & XMLonly )
397 }
398
399 ## Inline Character Encoding Statement for HTML: <meta http-equiv='content-type'>
400
401 meta.http-equiv.content-type.elem =
402 element meta { meta.inner & meta.http-equiv.content-type.attrs }
403 & HTMLonly
404 meta.http-equiv.content-type.attrs =
405 ( common.attrs.basic
406 & common.attrs.i18n
407 & common.attrs.present
408 & common.attrs.other
409 & meta.http-equiv.attrs.http-equiv.content-type
410 & meta.http-equiv.attrs.content.content-type
411 & ( common.attrs.aria.role.presentation
412 | common.attrs.aria.role.menuitem
413 )?
414 )
415 meta.http-equiv.attrs.http-equiv.content-type =
416 attribute http-equiv {
417 w:string "content-type"
418 }
419 meta.http-equiv.attrs.content.content-type =
420 attribute content {
421 common.data.meta-charset
422 }
423
424 common.elem.metadata |= ( meta.charset.elem | meta.http-equiv.content-type.elem )