]> code.delx.au - gnu-emacs-elpa/blob - packages/html5-schema/common.rnc
Add 'packages/html5-schema/' from commit '6e7c7c331e7f6692be6c7d39fb9485792f0d3513'
[gnu-emacs-elpa] / packages / html5-schema / common.rnc
1 datatypes w = "http://whattf.org/datatype-draft"
2
3 # #####################################################################
4 ## RELAX NG Schema for HTML 5: Common Definitions #
5 # #####################################################################
6
7
8 # #####################################################################
9 ## Language Parameters - redefine in inclusion block as necessary #
10 # #####################################################################
11
12 ## HTML vs. XHTML restrictions
13
14 XMLonly = empty
15 HTMLonly = notAllowed
16
17 ## HTML 4 Compatibility - set to notAllowed to disallow markup introduced in HTML 5
18 # (This only affects mixed-version modules; wholly HTML5
19 # modules should simply be left out of the inclusion list.)
20
21 v5only = empty
22
23 ## HTML Compatibility Switches - set to notAllowed to disallow
24
25 ## XML features that can't be roundtripped HTML <-> XHTML
26 # (xml:base on elements other than <html>)
27 nonRoundtrippable = empty
28
29 ## XML features that can't be serialized as HTML
30 nonHTMLizable = empty
31
32 ## features that are not part of the W3C HTML spec
33 nonW3C = empty
34
35 # #####################################################################
36 ## Wildcards #
37 # #####################################################################
38
39 ## Any attribute from any namespace
40
41 common.attr.anything =
42 attribute * { text }*
43
44 ## Any element from any namespace
45
46 common.elem.anything =
47 element * { common.inner.anything & common.attr.anything }
48
49 ## Any content from any namespace
50
51 common.inner.anything =
52 ( text
53 & common.elem.anything*
54 )
55
56 # #####################################################################
57 ## Common Element Classes #
58 # #####################################################################
59
60 ## Metadata Elements
61
62 common.elem.metadata =
63 ( notAllowed )
64
65 ## Phrase Elements
66
67 common.elem.phrasing =
68 ( notAllowed )
69
70 ## Prose Elements
71
72 common.elem.flow =
73 ( common.elem.phrasing )
74
75
76 # #####################################################################
77 ## Common Content Models #
78 # #####################################################################
79
80 ## Metadata Content
81
82 common.inner.metadata =
83 ( common.elem.metadata* )
84
85 ## Phrase Content
86
87 common.inner.phrasing =
88 ( text & common.elem.phrasing* )
89
90 ## Prose Content
91
92 common.inner.transparent.flow =
93 ( text & common.elem.flow* )
94
95 common.inner.flow =
96 ( style.elem.scoped*,
97 ( text
98 & common.elem.flow*
99 )
100 )
101
102 # #####################################################################
103 ## Common Attributes #
104 # #####################################################################
105
106 # When updating, check <bdo> definition too
107
108 common.attrs =
109 ( common.attrs.basic
110 & common.attrs.i18n
111 & common.attrs.present
112 & common.attrs.other
113 )
114
115 common.attrs.basic =
116 ( common.attrs.id?
117 & common.attrs.class?
118 & common.attrs.title?
119 & common.attrs.base?
120 & common.attrs.space?
121 )
122 common.attrs.id =
123 attribute id {
124 common.data.id
125 }
126 common.attrs.class =
127 attribute class {
128 common.data.tokens
129 }
130 common.attrs.title =
131 attribute title {
132 text
133 }
134 common.attrs.base =
135 common.attrs.xmlbase
136 & nonRoundtrippable
137 common.attrs.xmlbase =
138 attribute xml:base {
139 common.data.uri
140 } & XMLonly
141 common.attrs.space =
142 common.attrs.xmlspace
143 common.attrs.xmlspace =
144 attribute xml:space {
145 string "preserve" | string "default"
146 } & XMLonly
147
148 common.attrs.i18n =
149 ( common.attrs.dir?
150 & common.attrs.language?
151 & common.attrs.translate?
152 )
153 common.attrs.dir =
154 attribute dir {
155 w:string "ltr" | w:string "rtl" | w:string "auto"
156 }
157 # This lang definition is a hack for enviroments where
158 # the HTML5 parser maps lang to xml:lang.
159 # Sameness check left to Schematron
160 common.attrs.language =
161 ( common.attrs.xmllang?
162 & common.attrs.lang?
163 )
164 common.attrs.lang =
165 attribute lang {
166 common.data.langcode
167 } & XMLonly
168 common.attrs.xmllang =
169 attribute xml:lang {
170 common.data.langcode
171 }
172 # common.attrs.language =
173 # ( common.attrs.lang
174 # | common.attrs.xmllang
175 # )
176 # common.attrs.lang =
177 # attribute lang {
178 # common.data.langcode
179 # } & HTMLonly
180 # common.attrs.xmllang =
181 # attribute xml:lang {
182 # common.data.langcode
183 # } & XMLonly
184 common.attrs.translate =
185 attribute translate {
186 w:string "" | w:string "yes" | w:string "no"
187 }
188
189 common.attrs.present =
190 ( common.attrs.style?
191 & common.attrs.tabindex?
192 & common.attrs.accesskey?
193 )
194 common.attrs.style =
195 attribute style {
196 string
197 }
198 common.attrs.tabindex =
199 attribute tabindex {
200 common.data.integer
201 }
202 # REVISIT move style to a module and bundle tabindex with ARIA
203 common.attrs.accesskey =
204 attribute accesskey {
205 common.data.keylabellist
206 }
207
208 common.attrs.other =
209 empty
210
211 # #####################################################################
212 ## Common Datatypes #
213 # #####################################################################
214
215 ## Names and Tokens
216
217 common.data.tokens =
218 list { token* }
219
220 common.data.browsing-context =
221 w:browsing-context
222
223 common.data.browsing-context-or-keyword =
224 w:browsing-context-or-keyword
225 # xsd:string {
226 # pattern = "()|([^_].*)|(_[bB][lL][aA][nN][kK])|(_[sS][eE][lL][fF])|(_[pP][aA][rR][eE][nN][tT])|(_[tT][oO][pP])"
227 # }
228
229
230 ## IDs and IDREFs
231
232 common.data.id =
233 w:ID
234 # xsd:string {
235 # pattern = "\S+"
236 # }
237
238 common.data.idref =
239 w:IDREF
240
241 common.data.idrefs =
242 w:IDREFS
243
244 common.data.name =
245 w:ID #FIXME
246
247 common.data.hash-name =
248 w:hash-name
249 # xsd:string {
250 # pattern = "#.+"
251 # }
252
253 ## Numerical
254
255 common.data.integer =
256 w:integer
257 # xsd:string {
258 # pattern = "-?[0-9]+"
259 # }
260
261 common.data.integer.positive =
262 w:integer-positive
263 # xsd:string {
264 # pattern = "0*[1-9][0-9]*"
265 # }
266
267 common.data.integer.non-negative =
268 w:integer-non-negative
269 # xsd:string {
270 # pattern = "[0-9]+"
271 # }
272
273 # common.data.percent =
274 # xsd:string {
275 # pattern = "(100)|([1-9]?[0-9](\.[0-9]+)?)%"
276 # }
277
278 common.data.float =
279 w:float
280 # xsd:string {
281 # pattern = "-?[0-9]+(\.[0-9]+)?([eE]-?[0-9]+)?"
282 # }
283
284 common.data.float.positive =
285 w:float-positive
286 # xsd:string {
287 # pattern = "(0*[1-9][0-9]*(\.[0-9]+)?)|([0-9]+(\.0*[1-9][0-9]*)?)([eE]-?[0-9]+)?"
288 # }
289
290 common.data.float.non-negative =
291 w:float-non-negative
292 # xsd:string {
293 # pattern = "[0-9]+(\.[0-9]+)?([eE]-?[0-9]+)?"
294 # }
295
296 ## Temporal
297
298 common.data.datetime =
299 w:datetime-tz
300
301 common.data.date-or-time =
302 w:date-or-time
303
304 common.data.date =
305 w:date
306
307 common.data.time-datetime =
308 w:time-datetime
309
310 ## IRIs
311
312 common.data.uri =
313 # allow either a non-empty IRI ref or zero or more HTML
314 # space characters (which are: space, tab, LF, FF, CR)
315 ( w:iri-ref
316 | xsd:string {
317 pattern = "[ \x{0A}-\x{0D}]*"
318 # NOTE The range above incorrectly allows U+000B
319 # in addition to the HTML space characters; but
320 # that's not a problem in practice because HTML
321 # and XML parsers will both catch any U+000B
322 # and report an error for it before that pattern
323 # ever gets evaluated.
324 }
325 )
326
327 common.data.uri.non-empty =
328 w:iri-ref
329
330 common.data.uris =
331 list { w:iri-ref* }
332
333 common.data.uri.absolute =
334 w:iri
335
336 ## <link type='icon'> sizes
337
338 common.data.sizes =
339 # list { w:sizes }
340 list {
341 xsd:string {
342 pattern = "[1-9][0-9]*x[1-9][0-9]*"
343 }+
344 }
345
346 ## MIME types
347
348 common.data.mimetype =
349 w:mime-type
350
351 ## Encodings
352
353 common.data.charset =
354 w:charset
355
356 common.data.meta-charset =
357 w:meta-charset
358
359 ## Refresh
360
361 common.data.refresh =
362 w:refresh
363
364 ## Default style
365
366 common.data.default-style =
367 string
368 # w:default-style
369
370 ## X-UA-Compatible
371
372 common.data.x-ua-compatible =
373 string
374
375 ## Media Queries
376
377 common.data.mediaquery =
378 w:media-query
379
380 ## Language Codes
381
382 common.data.langcode =
383 w:string "" | w:language
384
385 ## List of Key Labels
386 common.data.keylabellist =
387 w:keylabellist
388
389 ## List of Source Sizes
390 common.data.source.size.list =
391 w:source-size-list
392
393 ## Subresource Integrity
394 common.data.integrity =
395 w:integrity-metadata
396
397 ## Content Security Policy
398 common.data.content-security-policy =
399 w:content-security-policy
400
401 ## List of sandbox keywords
402 common.data.sandbox-allow-list =
403 w:string "" | w:sandbox-allow-list
404
405 ## Microdata Properties
406 common.data.microdata-properties =
407 list { w:microdata-property+ }
408
409 ## Zero
410 common.data.zero =
411 w:zero
412
413 ## ECMAScript FunctionBody
414 common.data.functionbody =
415 w:functionbody
416
417 # #####################################################################
418 ## WF2 Module Hook #
419 # #####################################################################
420
421 common-form.attrs.form = ( notAllowed )
422
423 # #####################################################################
424 ## Script-supporting elements
425 # #####################################################################
426
427 common.elem.script-supporting = ( notAllowed )
428
429 # #####################################################################
430 ## ARIA Module Hooks #
431 # #####################################################################
432
433 common.attrs.aria = ( notAllowed )
434 common.attrs.aria.role.alert = ( notAllowed )
435 common.attrs.aria.role.alertdialog = ( notAllowed )
436 common.attrs.aria.role.application = ( notAllowed )
437 common.attrs.aria.role.article = ( notAllowed )
438 common.attrs.aria.role.banner = ( notAllowed )
439 common.attrs.aria.role.button = ( notAllowed )
440 common.attrs.aria.role.checkbox = ( notAllowed )
441 common.attrs.aria.role.combobox = ( notAllowed )
442 common.attrs.aria.role.complementary = ( notAllowed )
443 common.attrs.aria.role.contentinfo = ( notAllowed )
444 common.attrs.aria.role.dialog = ( notAllowed )
445 common.attrs.aria.role.directory = ( notAllowed )
446 common.attrs.aria.role.document = ( notAllowed )
447 common.attrs.aria.role.group = ( notAllowed )
448 common.attrs.aria.role.heading = ( notAllowed )
449 common.attrs.aria.role.img = ( notAllowed )
450 common.attrs.aria.role.link = ( notAllowed )
451 common.attrs.aria.role.list = ( notAllowed )
452 common.attrs.aria.role.listitem = ( notAllowed )
453 common.attrs.aria.role.log = ( notAllowed )
454 common.attrs.aria.role.listbox = ( notAllowed )
455 common.attrs.aria.role.main = ( notAllowed )
456 common.attrs.aria.role.marquee = ( notAllowed )
457 common.attrs.aria.role.menu = ( notAllowed )
458 common.attrs.aria.role.menubar = ( notAllowed )
459 common.attrs.aria.role.menuitem = ( notAllowed )
460 common.attrs.aria.role.menuitemcheckbox = ( notAllowed )
461 common.attrs.aria.role.menuitemradio = ( notAllowed )
462 common.attrs.aria.role.note = ( notAllowed )
463 common.attrs.aria.role.option = ( notAllowed )
464 common.attrs.aria.role.presentation = ( notAllowed )
465 common.attrs.aria.role.progressbar = ( notAllowed )
466 common.attrs.aria.role.radio = ( notAllowed )
467 common.attrs.aria.role.region = ( notAllowed )
468 common.attrs.aria.role.search = ( notAllowed )
469 common.attrs.aria.role.separator = ( notAllowed )
470 common.attrs.aria.role.slider = ( notAllowed )
471 common.attrs.aria.role.spinbutton = ( notAllowed )
472 common.attrs.aria.role.status = ( notAllowed )
473 common.attrs.aria.role.switch = ( notAllowed )
474 common.attrs.aria.role.tab = ( notAllowed )
475 common.attrs.aria.role.tablist = ( notAllowed )
476 common.attrs.aria.role.tabpanel = ( notAllowed )
477 common.attrs.aria.role.textbox = ( notAllowed )
478 common.attrs.aria.role.toolbar = ( notAllowed )
479 common.attrs.aria.role.tree = ( notAllowed )
480 common.attrs.aria.role.treeitem = ( notAllowed )
481 common.attrs.aria.implicit.article = ( notAllowed )
482 common.attrs.aria.implicit.banner = ( notAllowed )
483 common.attrs.aria.implicit.button = ( notAllowed )
484 common.attrs.aria.implicit.checkbox = ( notAllowed )
485 common.attrs.aria.implicit.column-or-row-header = ( notAllowed )
486 common.attrs.aria.implicit.combobox = ( notAllowed )
487 common.attrs.aria.implicit.complementary = ( notAllowed )
488 common.attrs.aria.implicit.contentinfo = ( notAllowed )
489 common.attrs.aria.implicit.dialog = ( notAllowed )
490 common.attrs.aria.implicit.document = ( notAllowed )
491 common.attrs.aria.implicit.form = ( notAllowed )
492 common.attrs.aria.implicit.group = ( notAllowed )
493 common.attrs.aria.implicit.heading = ( notAllowed )
494 common.attrs.aria.implicit.img = ( notAllowed )
495 common.attrs.aria.implicit.landmark = ( notAllowed )
496 common.attrs.aria.implicit.link = ( notAllowed )
497 common.attrs.aria.implicit.list = ( notAllowed )
498 common.attrs.aria.implicit.listbox = ( notAllowed )
499 common.attrs.aria.implicit.listitem = ( notAllowed )
500 common.attrs.aria.implicit.main = ( notAllowed )
501 common.attrs.aria.implicit.navigation = ( notAllowed )
502 common.attrs.aria.implicit.option = ( notAllowed )
503 common.attrs.aria.implicit.progressbar = ( notAllowed )
504 common.attrs.aria.implicit.radio = ( notAllowed )
505 common.attrs.aria.implicit.region = ( notAllowed )
506 common.attrs.aria.implicit.section = ( notAllowed )
507 common.attrs.aria.implicit.select = ( notAllowed )
508 common.attrs.aria.implicit.slider = ( notAllowed )
509 common.attrs.aria.implicit.spinbutton = ( notAllowed )
510 common.attrs.aria.implicit.status = ( notAllowed )
511 common.attrs.aria.implicit.structure = ( notAllowed )
512 common.attrs.aria.implicit.textbox = ( notAllowed )
513 common.attrs.aria.implicit.toolbar = ( notAllowed )
514 common.attrs.aria.prop.readonly = ( notAllowed )
515 common.attrs.aria.landmark.application = ( notAllowed )
516 common.attrs.aria.landmark.banner = ( notAllowed )
517 common.attrs.aria.landmark.complementary = ( notAllowed )
518 common.attrs.aria.landmark.contentinfo = ( notAllowed )
519 common.attrs.aria.landmark.form = ( notAllowed )
520 common.attrs.aria.landmark.main = ( notAllowed )
521 common.attrs.aria.landmark.navigation = ( notAllowed )
522 common.attrs.aria.landmark.search = ( notAllowed )
523 # per ARIA spec: article, document, and note are not actually landmarks
524 common.attrs.aria.landmark.article = ( notAllowed )
525 common.attrs.aria.landmark.document = ( notAllowed )
526 common.attrs.aria.landmark.note = ( notAllowed )