]> code.delx.au - gnu-emacs-elpa/blob - meta.rnc
ad5e2f1030aa5a0b65ca48d2dbe552e945393ae1
[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.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.title included in common.attrs
203 & ( common.attrs.aria.role.presentation
204 | common.attrs.aria.role.menuitem
205 )?
206 )
207 style.attrs.type =
208 attribute type {
209 common.data.mimetype
210 }
211 style.attrs.media =
212 attribute media {
213 common.data.mediaquery
214 }
215 style.inner =
216 ( common.inner.anything )
217
218 common.elem.metadata |= style.elem
219
220 ## Scoped Style: <style scoped>
221
222 style.elem.scoped =
223 element style { style.inner & style.scoped.attrs }
224 style.scoped.attrs =
225 ( common.attrs
226 & style.attrs.type?
227 & style.attrs.media?
228 & style.attrs.scoped
229 # style.attrs.title included in common.attrs
230 & ( common.attrs.aria.role.presentation
231 | common.attrs.aria.role.menuitem
232 )?
233 )
234 style.attrs.scoped =
235 attribute scoped {
236 w:string "scoped" | w:string ""
237 }
238
239 ## Name-Value Metadata: <meta name>
240
241 meta.name.elem =
242 element meta { meta.inner & meta.name.attrs }
243 meta.name.attrs =
244 ( common.attrs.basic
245 & common.attrs.i18n
246 & common.attrs.present
247 & common.attrs.other
248 & meta.name.attrs.name
249 & meta.name.attrs.content
250 & ( common.attrs.aria.role.presentation
251 | common.attrs.aria.role.menuitem
252 )?
253 )
254 meta.name.attrs.name =
255 attribute name {
256 w:non-empty-string
257 }
258 meta.name.attrs.content =
259 attribute content {
260 string
261 }
262 meta.inner =
263 ( empty )
264
265 common.elem.metadata |= meta.name.elem
266
267 ## "refresh" pragma directive: <meta http-equiv='refresh'>
268
269 meta.http-equiv.refresh.elem =
270 element meta { meta.inner & meta.http-equiv.refresh.attrs }
271 meta.http-equiv.refresh.attrs =
272 ( common.attrs.basic
273 & common.attrs.i18n
274 & common.attrs.present
275 & common.attrs.other
276 & meta.http-equiv.attrs.http-equiv.refresh
277 & meta.http-equiv.attrs.content.refresh
278 & ( common.attrs.aria.role.presentation
279 | common.attrs.aria.role.menuitem
280 )?
281 )
282 meta.http-equiv.attrs.http-equiv.refresh =
283 attribute http-equiv {
284 w:string "refresh"
285 }
286 meta.http-equiv.attrs.content.refresh =
287 attribute content {
288 common.data.refresh
289 }
290 common.elem.metadata |= meta.http-equiv.refresh.elem # not quite right per spec
291 # if the definition is
292 # reused in another language
293
294 ## "default-style" pragma directive: <meta http-equiv='default-style'>
295
296 meta.http-equiv.default-style.elem =
297 element meta { meta.inner & meta.http-equiv.default-style.attrs }
298 meta.http-equiv.default-style.attrs =
299 ( common.attrs.basic
300 & common.attrs.i18n
301 & common.attrs.present
302 & common.attrs.other
303 & meta.http-equiv.attrs.http-equiv.default-style
304 & meta.http-equiv.attrs.content.default-style
305 & ( common.attrs.aria.role.presentation
306 | common.attrs.aria.role.menuitem
307 )?
308 )
309 meta.http-equiv.attrs.http-equiv.default-style =
310 attribute http-equiv {
311 w:string "default-style"
312 }
313 meta.http-equiv.attrs.content.default-style =
314 attribute content {
315 common.data.default-style
316 }
317
318 common.elem.metadata |= meta.http-equiv.default-style.elem # not quite right per spec
319 # if the definition is
320 # reused in another language
321
322 ## "x-ua-compatible" pragma directive: <meta http-equiv='x-ua-compatible'>
323
324 meta.http-equiv.x-ua-compatible.elem =
325 element meta { meta.inner & meta.http-equiv.x-ua-compatible.attrs }
326 meta.http-equiv.x-ua-compatible.attrs =
327 ( common.attrs.basic
328 & common.attrs.i18n
329 & common.attrs.present
330 & common.attrs.other
331 & meta.http-equiv.attrs.http-equiv.x-ua-compatible
332 & meta.http-equiv.attrs.content.x-ua-compatible
333 & ( common.attrs.aria.role.presentation
334 | common.attrs.aria.role.menuitem
335 )?
336 )
337 meta.http-equiv.attrs.http-equiv.x-ua-compatible =
338 attribute http-equiv {
339 w:string "x-ua-compatible"
340 }
341 meta.http-equiv.attrs.content.x-ua-compatible =
342 attribute content {
343 common.data.x-ua-compatible
344 }
345 common.elem.metadata |= meta.http-equiv.x-ua-compatible.elem
346
347 ## Inline Character Encoding Statement for HTML: <meta charset>
348
349 meta.charset.elem =
350 element meta { meta.inner & meta.charset.attrs }
351 meta.charset.attrs =
352 ( common.attrs.basic
353 & common.attrs.i18n
354 & common.attrs.present
355 & common.attrs.other
356 & meta.charset.attrs.charset
357 & ( common.attrs.aria.role.presentation
358 | common.attrs.aria.role.menuitem
359 )?
360 )
361 meta.charset.attrs.charset =
362 attribute charset {
363 (common.data.charset & HTMLonly)
364 | (xsd:string {
365 pattern = "[uU][tT][fF]-8"
366 } & XMLonly )
367 }
368
369 ## Inline Character Encoding Statement for HTML: <meta http-equiv='content-type'>
370
371 meta.http-equiv.content-type.elem =
372 element meta { meta.inner & meta.http-equiv.content-type.attrs }
373 & HTMLonly
374 meta.http-equiv.content-type.attrs =
375 ( common.attrs.basic
376 & common.attrs.i18n
377 & common.attrs.present
378 & common.attrs.other
379 & meta.http-equiv.attrs.http-equiv.content-type
380 & meta.http-equiv.attrs.content.content-type
381 & ( common.attrs.aria.role.presentation
382 | common.attrs.aria.role.menuitem
383 )?
384 )
385 meta.http-equiv.attrs.http-equiv.content-type =
386 attribute http-equiv {
387 w:string "content-type"
388 }
389 meta.http-equiv.attrs.content.content-type =
390 attribute content {
391 common.data.meta-charset
392 }
393
394 common.elem.metadata |= ( meta.charset.elem | meta.http-equiv.content-type.elem )