metanorma-csa 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/macos.yml +38 -0
  3. data/.github/workflows/ubuntu.yml +38 -0
  4. data/.github/workflows/windows.yml +41 -0
  5. data/.gitignore +8 -0
  6. data/.hound.yml +3 -0
  7. data/.rubocop.yml +10 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +11 -0
  10. data/LICENSE +25 -0
  11. data/README.adoc +83 -0
  12. data/Rakefile +6 -0
  13. data/bin/console +14 -0
  14. data/bin/rspec +18 -0
  15. data/bin/setup +8 -0
  16. data/lib/asciidoctor/csa.rb +5 -0
  17. data/lib/asciidoctor/csa/basicdoc.rng +1045 -0
  18. data/lib/asciidoctor/csa/biblio.rng +1142 -0
  19. data/lib/asciidoctor/csa/converter.rb +150 -0
  20. data/lib/asciidoctor/csa/csa.rng +101 -0
  21. data/lib/asciidoctor/csa/isodoc.rng +514 -0
  22. data/lib/asciidoctor/csa/isostandard.rng +860 -0
  23. data/lib/asciidoctor/csa/reqt.rng +171 -0
  24. data/lib/asciidoctor/csa/validate.rb +21 -0
  25. data/lib/isodoc/csa/base_convert.rb +43 -0
  26. data/lib/isodoc/csa/html/csa-logo-white.png +0 -0
  27. data/lib/isodoc/csa/html/csa.png +0 -0
  28. data/lib/isodoc/csa/html/csa.scss +700 -0
  29. data/lib/isodoc/csa/html/dots-w@2x.png +0 -0
  30. data/lib/isodoc/csa/html/dots@2x.png +0 -0
  31. data/lib/isodoc/csa/html/header.html +186 -0
  32. data/lib/isodoc/csa/html/html_csa_intro.html +8 -0
  33. data/lib/isodoc/csa/html/html_csa_titlepage.html +89 -0
  34. data/lib/isodoc/csa/html/htmlstyle.scss +1129 -0
  35. data/lib/isodoc/csa/html/scripts.html +74 -0
  36. data/lib/isodoc/csa/html/scripts.pdf.html +72 -0
  37. data/lib/isodoc/csa/html/word_csa_intro.html +33 -0
  38. data/lib/isodoc/csa/html/word_csa_titlepage.html +76 -0
  39. data/lib/isodoc/csa/html/wordstyle.scss +1136 -0
  40. data/lib/isodoc/csa/html_convert.rb +58 -0
  41. data/lib/isodoc/csa/metadata.rb +50 -0
  42. data/lib/isodoc/csa/pdf_convert.rb +63 -0
  43. data/lib/isodoc/csa/word_convert.rb +41 -0
  44. data/lib/metanorma-csa.rb +11 -0
  45. data/lib/metanorma/csa.rb +7 -0
  46. data/lib/metanorma/csa/processor.rb +46 -0
  47. data/lib/metanorma/csa/version.rb +7 -0
  48. data/metanorma-csa.gemspec +52 -0
  49. metadata +348 -0
@@ -0,0 +1,1142 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ instantiations of this grammar may replace leaf strings
4
+ with more elaborated types; e.g. title (text) replaced with
5
+ title-main, title-intro, title-part; type replaced with
6
+ enum.
7
+
8
+ some renaming at leaf nodes is permissible
9
+
10
+ obligations can change both from optional to mandatory,
11
+ and from mandatory to optional; optional elements may
12
+ be omitted; freely positioned alternatives may be replaced
13
+ with strict ordering
14
+
15
+ DO NOT introduce a namespace here. We do not want a distinct namespace
16
+ for these elements, and a distinct namespace for any grammar inheriting
17
+ these elements; we just want one namespace for any child grammars
18
+ of this.
19
+ -->
20
+ <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
21
+ <!--
22
+ https://www.myintervals.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
23
+ iso8601date = xsd:string { pattern = "([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?" }
24
+ Somewhat dumbed down for XSD regex:
25
+ -->
26
+ <define name="ISO8601DateTime">
27
+ <data type="string">
28
+ <param name="pattern">([\+\-]?\d{4})((-?)((0[1-9]|1[0-2])((-?)([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+)?)?((:?)[0-5]\d([.,]\d+)?)?([zZ]|([\+\-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?</param>
29
+ </data>
30
+ </define>
31
+ <define name="ISO8601Date">
32
+ <data type="string">
33
+ <param name="pattern">([\+\-]?\d{4})((-?)((0[1-9]|1[0-2])((-?)([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6]))))?</param>
34
+ </data>
35
+ </define>
36
+ <start>
37
+ <ref name="bibitem"/>
38
+ </start>
39
+ <define name="status">
40
+ <element name="status">
41
+ <ref name="stage"/>
42
+ <optional>
43
+ <ref name="substage"/>
44
+ </optional>
45
+ <optional>
46
+ <ref name="iteration"/>
47
+ </optional>
48
+ </element>
49
+ </define>
50
+ <define name="stage">
51
+ <element name="stage">
52
+ <text/>
53
+ </element>
54
+ </define>
55
+ <define name="substage">
56
+ <element name="substage">
57
+ <text/>
58
+ </element>
59
+ </define>
60
+ <define name="iteration">
61
+ <element name="iteration">
62
+ <text/>
63
+ </element>
64
+ </define>
65
+ <define name="language">
66
+ <element name="language">
67
+ <text/>
68
+ </element>
69
+ </define>
70
+ <define name="script">
71
+ <a:documentation>ISO-639</a:documentation>
72
+ <element name="script">
73
+ <text/>
74
+ </element>
75
+ </define>
76
+ <define name="edition">
77
+ <a:documentation>ISO-15924: Latn</a:documentation>
78
+ <element name="edition">
79
+ <optional>
80
+ <attribute name="number"/>
81
+ </optional>
82
+ <text/>
83
+ </element>
84
+ </define>
85
+ <define name="LocalizedString">
86
+ <optional>
87
+ <!-- multiple languages and scripts possible: comma delimit them if so -->
88
+ <attribute name="language"/>
89
+ </optional>
90
+ <optional>
91
+ <attribute name="script"/>
92
+ </optional>
93
+ <text/>
94
+ </define>
95
+ <!--
96
+ Unlike UML, change type to format: type is overloaded
97
+ Would be need if plain were default value and could omit the attribute
98
+ Added LocalizedStringOrXsAny
99
+ -->
100
+ <define name="FormattedString">
101
+ <optional>
102
+ <!-- attribute format { ( "plain" | "html" | "docbook" | "tei" | "asciidoc" | "markdown" ) }?, -->
103
+ <attribute name="format">
104
+ <choice>
105
+ <value>text/plain</value>
106
+ <value>text/html</value>
107
+ <value>application/docbook+xml</value>
108
+ <value>application/tei+xml</value>
109
+ <value>text/x-asciidoc</value>
110
+ <value>text/markdown</value>
111
+ <value>application/x-isodoc+xml</value>
112
+ <text/>
113
+ </choice>
114
+ </attribute>
115
+ </optional>
116
+ <ref name="LocalizedStringOrXsAny"/>
117
+ </define>
118
+ <define name="LocalizedStringOrXsAny">
119
+ <optional>
120
+ <!-- multiple languages and scripts possible: comma delimit them if so -->
121
+ <attribute name="language"/>
122
+ </optional>
123
+ <optional>
124
+ <attribute name="script"/>
125
+ </optional>
126
+ <oneOrMore>
127
+ <choice>
128
+ <text/>
129
+ <ref name="AnyElement"/>
130
+ </choice>
131
+ </oneOrMore>
132
+ </define>
133
+ <define name="contributor">
134
+ <element name="contributor">
135
+ <zeroOrMore>
136
+ <ref name="role"/>
137
+ </zeroOrMore>
138
+ <ref name="ContributorInfo"/>
139
+ </element>
140
+ </define>
141
+ <define name="role">
142
+ <element name="role">
143
+ <optional>
144
+ <attribute name="type">
145
+ <choice>
146
+ <value>author</value>
147
+ <value>performer</value>
148
+ <value>publisher</value>
149
+ <value>editor</value>
150
+ <value>adapter</value>
151
+ <value>translator</value>
152
+ <value>distributor</value>
153
+ </choice>
154
+ </attribute>
155
+ </optional>
156
+ <zeroOrMore>
157
+ <ref name="roledescription"/>
158
+ </zeroOrMore>
159
+ </element>
160
+ </define>
161
+ <define name="ContributorInfo">
162
+ <choice>
163
+ <ref name="person"/>
164
+ <ref name="organization"/>
165
+ </choice>
166
+ </define>
167
+ <define name="roledescription">
168
+ <element name="description">
169
+ <ref name="FormattedString"/>
170
+ </element>
171
+ </define>
172
+ <define name="person">
173
+ <element name="person">
174
+ <optional>
175
+ <ref name="fullname"/>
176
+ </optional>
177
+ <zeroOrMore>
178
+ <ref name="affiliation"/>
179
+ </zeroOrMore>
180
+ <zeroOrMore>
181
+ <ref name="person-identifier"/>
182
+ </zeroOrMore>
183
+ <zeroOrMore>
184
+ <ref name="contact"/>
185
+ </zeroOrMore>
186
+ <zeroOrMore>
187
+ <ref name="uri"/>
188
+ </zeroOrMore>
189
+ </element>
190
+ </define>
191
+ <define name="fullname">
192
+ <element name="name">
193
+ <ref name="FullNameType"/>
194
+ </element>
195
+ </define>
196
+ <define name="FullNameType">
197
+ <choice>
198
+ <group>
199
+ <zeroOrMore>
200
+ <ref name="prefix"/>
201
+ </zeroOrMore>
202
+ <zeroOrMore>
203
+ <ref name="forename"/>
204
+ </zeroOrMore>
205
+ <zeroOrMore>
206
+ <ref name="initial"/>
207
+ </zeroOrMore>
208
+ <ref name="surname"/>
209
+ <zeroOrMore>
210
+ <ref name="addition"/>
211
+ </zeroOrMore>
212
+ </group>
213
+ <ref name="completeName"/>
214
+ </choice>
215
+ <zeroOrMore>
216
+ <ref name="biblionote"/>
217
+ </zeroOrMore>
218
+ <zeroOrMore>
219
+ <ref name="variantname"/>
220
+ </zeroOrMore>
221
+ </define>
222
+ <define name="prefix">
223
+ <element name="prefix">
224
+ <ref name="LocalizedString"/>
225
+ </element>
226
+ </define>
227
+ <define name="initial">
228
+ <element name="initial">
229
+ <ref name="LocalizedString"/>
230
+ </element>
231
+ </define>
232
+ <define name="addition">
233
+ <element name="addition">
234
+ <ref name="LocalizedString"/>
235
+ </element>
236
+ </define>
237
+ <define name="surname">
238
+ <element name="surname">
239
+ <ref name="LocalizedString"/>
240
+ </element>
241
+ </define>
242
+ <define name="forename">
243
+ <element name="forename">
244
+ <ref name="LocalizedString"/>
245
+ </element>
246
+ </define>
247
+ <define name="completeName">
248
+ <element name="completename">
249
+ <ref name="LocalizedString"/>
250
+ </element>
251
+ </define>
252
+ <define name="variantname">
253
+ <element name="variant">
254
+ <attribute name="type"/>
255
+ <ref name="FullNameType"/>
256
+ </element>
257
+ </define>
258
+ <define name="affiliation">
259
+ <element name="affiliation">
260
+ <optional>
261
+ <ref name="affiliationname"/>
262
+ </optional>
263
+ <zeroOrMore>
264
+ <ref name="affiliationdescription"/>
265
+ </zeroOrMore>
266
+ <ref name="organization"/>
267
+ </element>
268
+ </define>
269
+ <define name="affiliationname">
270
+ <element name="name">
271
+ <ref name="LocalizedString"/>
272
+ </element>
273
+ </define>
274
+ <define name="affiliationdescription">
275
+ <element name="description">
276
+ <ref name="FormattedString"/>
277
+ </element>
278
+ </define>
279
+ <define name="organization">
280
+ <element name="organization">
281
+ <oneOrMore>
282
+ <ref name="orgname"/>
283
+ </oneOrMore>
284
+ <zeroOrMore>
285
+ <ref name="subdivision"/>
286
+ </zeroOrMore>
287
+ <optional>
288
+ <ref name="abbreviation"/>
289
+ </optional>
290
+ <zeroOrMore>
291
+ <ref name="uri"/>
292
+ </zeroOrMore>
293
+ <zeroOrMore>
294
+ <ref name="org-identifier"/>
295
+ </zeroOrMore>
296
+ <zeroOrMore>
297
+ <ref name="contact"/>
298
+ </zeroOrMore>
299
+ </element>
300
+ </define>
301
+ <define name="orgname">
302
+ <element name="name">
303
+ <choice>
304
+ <ref name="LocalizedString"/>
305
+ <ref name="NameWithVariants"/>
306
+ </choice>
307
+ </element>
308
+ </define>
309
+ <define name="subdivision">
310
+ <element name="subdivision">
311
+ <choice>
312
+ <ref name="LocalizedString"/>
313
+ <ref name="NameWithVariants"/>
314
+ </choice>
315
+ </element>
316
+ </define>
317
+ <define name="NameWithVariants">
318
+ <element name="primary">
319
+ <ref name="LocalizedString"/>
320
+ </element>
321
+ <zeroOrMore>
322
+ <element name="variant">
323
+ <ref name="NameWithVariants1"/>
324
+ </element>
325
+ </zeroOrMore>
326
+ </define>
327
+ <define name="NameWithVariants1">
328
+ <attribute name="type"/>
329
+ <element name="primary">
330
+ <ref name="LocalizedString"/>
331
+ </element>
332
+ <zeroOrMore>
333
+ <element name="variant">
334
+ <ref name="NameWithVariants1"/>
335
+ </element>
336
+ </zeroOrMore>
337
+ </define>
338
+ <define name="abbreviation">
339
+ <element name="abbreviation">
340
+ <ref name="LocalizedString"/>
341
+ </element>
342
+ </define>
343
+ <define name="uri">
344
+ <element name="uri">
345
+ <optional>
346
+ <attribute name="type"/>
347
+ </optional>
348
+ <data type="anyURI"/>
349
+ </element>
350
+ </define>
351
+ <!-- TODO may change -->
352
+ <define name="contact">
353
+ <choice>
354
+ <ref name="address"/>
355
+ <ref name="phone"/>
356
+ <ref name="email"/>
357
+ <ref name="uri"/>
358
+ </choice>
359
+ </define>
360
+ <define name="phone">
361
+ <element name="phone">
362
+ <optional>
363
+ <attribute name="type"/>
364
+ </optional>
365
+ <text/>
366
+ </element>
367
+ </define>
368
+ <define name="email">
369
+ <element name="email">
370
+ <text/>
371
+ </element>
372
+ </define>
373
+ <define name="address">
374
+ <element name="address">
375
+ <choice>
376
+ <!-- iso191606 TODO -->
377
+ <group>
378
+ <oneOrMore>
379
+ <ref name="street"/>
380
+ </oneOrMore>
381
+ <ref name="city"/>
382
+ <optional>
383
+ <ref name="state"/>
384
+ </optional>
385
+ <ref name="country"/>
386
+ <optional>
387
+ <ref name="postcode"/>
388
+ </optional>
389
+ </group>
390
+ <ref name="formattedAddress"/>
391
+ </choice>
392
+ </element>
393
+ </define>
394
+ <define name="street">
395
+ <element name="street">
396
+ <text/>
397
+ </element>
398
+ </define>
399
+ <define name="city">
400
+ <element name="city">
401
+ <text/>
402
+ </element>
403
+ </define>
404
+ <define name="state">
405
+ <element name="state">
406
+ <text/>
407
+ </element>
408
+ </define>
409
+ <define name="country">
410
+ <element name="country">
411
+ <text/>
412
+ </element>
413
+ </define>
414
+ <define name="postcode">
415
+ <element name="postcode">
416
+ <text/>
417
+ </element>
418
+ </define>
419
+ <define name="formattedAddress">
420
+ <element name="formattedAddress">
421
+ <text/>
422
+ </element>
423
+ </define>
424
+ <define name="person-identifier">
425
+ <element name="identifier">
426
+ <attribute name="type">
427
+ <choice>
428
+ <value>isni</value>
429
+ <value>uri</value>
430
+ </choice>
431
+ </attribute>
432
+ <text/>
433
+ </element>
434
+ </define>
435
+ <define name="org-identifier">
436
+ <element name="identifier">
437
+ <attribute name="type">
438
+ <choice>
439
+ <value>orcid</value>
440
+ <value>uri</value>
441
+ </choice>
442
+ </attribute>
443
+ <text/>
444
+ </element>
445
+ </define>
446
+ <define name="citation">
447
+ <element name="citation">
448
+ <ref name="CitationType"/>
449
+ </element>
450
+ </define>
451
+ <define name="CitationType">
452
+ <attribute name="bibitemid">
453
+ <data type="IDREF"/>
454
+ </attribute>
455
+ <zeroOrMore>
456
+ <ref name="locality"/>
457
+ </zeroOrMore>
458
+ <optional>
459
+ <ref name="date"/>
460
+ </optional>
461
+ </define>
462
+ <define name="date">
463
+ <element name="date">
464
+ <ref name="ISO8601Date"/>
465
+ </element>
466
+ </define>
467
+ <define name="locality">
468
+ <element name="locality">
469
+ <ref name="BibItemLocality"/>
470
+ </element>
471
+ </define>
472
+ <define name="BibItemLocality">
473
+ <attribute name="type">
474
+ <ref name="LocalityType"/>
475
+ </attribute>
476
+ <optional>
477
+ <ref name="referenceFrom"/>
478
+ </optional>
479
+ <optional>
480
+ <ref name="referenceTo"/>
481
+ </optional>
482
+ </define>
483
+ <define name="LocalityType">
484
+ <data type="string">
485
+ <param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|locality:[a-zA-Z0-9_]+</param>
486
+ </data>
487
+ </define>
488
+ <define name="referenceFrom">
489
+ <element name="referenceFrom">
490
+ <text/>
491
+ </element>
492
+ </define>
493
+ <define name="referenceTo">
494
+ <element name="referenceTo">
495
+ <text/>
496
+ </element>
497
+ </define>
498
+ <!-- unlike UML, has id attribute; that results from including bibitem in a docmodel -->
499
+ <define name="bibitem">
500
+ <element name="bibitem">
501
+ <attribute name="id">
502
+ <data type="ID"/>
503
+ </attribute>
504
+ <ref name="BibliographicItem"/>
505
+ </element>
506
+ </define>
507
+ <define name="bibitem_no_id">
508
+ <element name="bibitem">
509
+ <ref name="BibliographicItem"/>
510
+ </element>
511
+ </define>
512
+ <define name="relaton_collection">
513
+ <element name="relaton-collection">
514
+ <optional>
515
+ <attribute name="type"/>
516
+ </optional>
517
+ <ref name="btitle"/>
518
+ <zeroOrMore>
519
+ <ref name="contributor"/>
520
+ </zeroOrMore>
521
+ <zeroOrMore>
522
+ <ref name="docrelation"/>
523
+ </zeroOrMore>
524
+ </element>
525
+ </define>
526
+ <define name="BibItemType" combine="choice">
527
+ <choice>
528
+ <value>article</value>
529
+ <value>book</value>
530
+ <value>booklet</value>
531
+ <value>manual</value>
532
+ <value>proceedings</value>
533
+ <value>presentation</value>
534
+ <value>thesis</value>
535
+ <value>techreport</value>
536
+ <value>standard</value>
537
+ <value>unpublished</value>
538
+ <value>map</value>
539
+ <value>electronic resource</value>
540
+ <value>audiovisual</value>
541
+ <value>film</value>
542
+ <value>video</value>
543
+ <value>broadcast</value>
544
+ <value>software</value>
545
+ <value>graphic_work</value>
546
+ <value>music</value>
547
+ <value>patent</value>
548
+ <value>inbook</value>
549
+ <value>incollection</value>
550
+ <value>inproceedings</value>
551
+ <value>journal</value>
552
+ <value>website</value>
553
+ <value>webresource</value>
554
+ <value>dataset</value>
555
+ <value>archival</value>
556
+ <value>social_media</value>
557
+ <value>alert</value>
558
+ <value>message</value>
559
+ <value>conversation</value>
560
+ <value>misc</value>
561
+ </choice>
562
+ </define>
563
+ <define name="BibliographicItem">
564
+ <optional>
565
+ <attribute name="type">
566
+ <ref name="BibItemType"/>
567
+ </attribute>
568
+ </optional>
569
+ <optional>
570
+ <ref name="fetched"/>
571
+ </optional>
572
+ <choice>
573
+ <oneOrMore>
574
+ <ref name="btitle"/>
575
+ </oneOrMore>
576
+ <ref name="formattedref"/>
577
+ </choice>
578
+ <zeroOrMore>
579
+ <ref name="bsource"/>
580
+ </zeroOrMore>
581
+ <zeroOrMore>
582
+ <ref name="docidentifier"/>
583
+ </zeroOrMore>
584
+ <optional>
585
+ <ref name="docnumber"/>
586
+ </optional>
587
+ <zeroOrMore>
588
+ <ref name="bdate"/>
589
+ </zeroOrMore>
590
+ <zeroOrMore>
591
+ <ref name="contributor"/>
592
+ </zeroOrMore>
593
+ <optional>
594
+ <ref name="edition"/>
595
+ </optional>
596
+ <optional>
597
+ <ref name="version"/>
598
+ </optional>
599
+ <zeroOrMore>
600
+ <ref name="biblionote"/>
601
+ </zeroOrMore>
602
+ <zeroOrMore>
603
+ <ref name="language"/>
604
+ </zeroOrMore>
605
+ <zeroOrMore>
606
+ <ref name="script"/>
607
+ </zeroOrMore>
608
+ <zeroOrMore>
609
+ <ref name="bibabstract"/>
610
+ </zeroOrMore>
611
+ <optional>
612
+ <ref name="status"/>
613
+ </optional>
614
+ <optional>
615
+ <ref name="copyright"/>
616
+ </optional>
617
+ <zeroOrMore>
618
+ <ref name="docrelation"/>
619
+ </zeroOrMore>
620
+ <zeroOrMore>
621
+ <ref name="series"/>
622
+ </zeroOrMore>
623
+ <optional>
624
+ <ref name="medium"/>
625
+ </optional>
626
+ <zeroOrMore>
627
+ <ref name="bplace"/>
628
+ </zeroOrMore>
629
+ <zeroOrMore>
630
+ <ref name="bprice"/>
631
+ </zeroOrMore>
632
+ <zeroOrMore>
633
+ <ref name="extent"/>
634
+ </zeroOrMore>
635
+ <zeroOrMore>
636
+ <ref name="accesslocation"/>
637
+ </zeroOrMore>
638
+ <zeroOrMore>
639
+ <ref name="license"/>
640
+ </zeroOrMore>
641
+ <zeroOrMore>
642
+ <ref name="bclassification"/>
643
+ </zeroOrMore>
644
+ <zeroOrMore>
645
+ <ref name="bkeyword"/>
646
+ </zeroOrMore>
647
+ <optional>
648
+ <ref name="validity"/>
649
+ </optional>
650
+ </define>
651
+ <define name="btitle">
652
+ <element name="title">
653
+ <ref name="TypedTitleString"/>
654
+ </element>
655
+ </define>
656
+ <define name="bsource">
657
+ <element name="uri">
658
+ <ref name="TypedUri"/>
659
+ </element>
660
+ </define>
661
+ <define name="formattedref">
662
+ <element name="formattedref">
663
+ <ref name="FormattedString"/>
664
+ </element>
665
+ </define>
666
+ <define name="license">
667
+ <element name="license">
668
+ <text/>
669
+ </element>
670
+ </define>
671
+ <define name="fetched">
672
+ <element name="fetched">
673
+ <ref name="ISO8601DateTime"/>
674
+ </element>
675
+ </define>
676
+ <define name="validity">
677
+ <element name="validity">
678
+ <optional>
679
+ <ref name="validityBegins"/>
680
+ </optional>
681
+ <optional>
682
+ <ref name="validityEnds"/>
683
+ </optional>
684
+ <optional>
685
+ <ref name="validityRevision"/>
686
+ </optional>
687
+ </element>
688
+ </define>
689
+ <define name="validityBegins">
690
+ <element name="validityBegins">
691
+ <ref name="ISO8601DateTime"/>
692
+ </element>
693
+ </define>
694
+ <define name="validityEnds">
695
+ <element name="validityEnds">
696
+ <ref name="ISO8601DateTime"/>
697
+ </element>
698
+ </define>
699
+ <define name="validityRevision">
700
+ <element name="revision">
701
+ <ref name="ISO8601DateTime"/>
702
+ </element>
703
+ </define>
704
+ <define name="TypedTitleString">
705
+ <optional>
706
+ <attribute name="type">
707
+ <ref name="TitleType"/>
708
+ </attribute>
709
+ </optional>
710
+ <ref name="FormattedString"/>
711
+ </define>
712
+ <define name="TitleType">
713
+ <choice>
714
+ <value>alternative</value>
715
+ <value>original</value>
716
+ <value>unofficial</value>
717
+ <value>subtitle</value>
718
+ <value>main</value>
719
+ </choice>
720
+ </define>
721
+ <define name="TypedUri">
722
+ <optional>
723
+ <attribute name="type"/>
724
+ </optional>
725
+ <data type="anyURI"/>
726
+ </define>
727
+ <define name="DateType">
728
+ <optional>
729
+ <attribute name="text"/>
730
+ </optional>
731
+ <optional>
732
+ <ref name="ISO8601Date"/>
733
+ </optional>
734
+ </define>
735
+ <define name="BibliographicDateType">
736
+ <choice>
737
+ <value>published</value>
738
+ <value>accessed</value>
739
+ <value>created</value>
740
+ <value>implemented</value>
741
+ <value>obsoleted</value>
742
+ <value>confirmed</value>
743
+ <value>updated</value>
744
+ <value>issued</value>
745
+ <value>transmitted</value>
746
+ <value>copied</value>
747
+ <value>unchanged</value>
748
+ <value>circulated</value>
749
+ <value>adapted</value>
750
+ </choice>
751
+ </define>
752
+ <define name="bdate">
753
+ <element name="date">
754
+ <attribute name="type">
755
+ <choice>
756
+ <ref name="BibliographicDateType"/>
757
+ <text/>
758
+ </choice>
759
+ </attribute>
760
+ <optional>
761
+ <attribute name="text"/>
762
+ </optional>
763
+ <optional>
764
+ <choice>
765
+ <group>
766
+ <element name="from">
767
+ <ref name="ISO8601Date"/>
768
+ </element>
769
+ <optional>
770
+ <element name="to">
771
+ <ref name="ISO8601Date"/>
772
+ </element>
773
+ </optional>
774
+ </group>
775
+ <element name="on">
776
+ <ref name="ISO8601Date"/>
777
+ </element>
778
+ </choice>
779
+ </optional>
780
+ </element>
781
+ </define>
782
+ <define name="docidentifier">
783
+ <element name="docidentifier">
784
+ <optional>
785
+ <attribute name="type"/>
786
+ </optional>
787
+ <optional>
788
+ <attribute name="scope"/>
789
+ </optional>
790
+ <text/>
791
+ </element>
792
+ </define>
793
+ <define name="docnumber">
794
+ <element name="docnumber">
795
+ <text/>
796
+ </element>
797
+ </define>
798
+ <define name="bclassification">
799
+ <element name="classification">
800
+ <optional>
801
+ <attribute name="type"/>
802
+ </optional>
803
+ <text/>
804
+ </element>
805
+ </define>
806
+ <define name="bplace">
807
+ <element name="place">
808
+ <optional>
809
+ <attribute name="uri">
810
+ <data type="anyURI"/>
811
+ </attribute>
812
+ </optional>
813
+ <optional>
814
+ <attribute name="region"/>
815
+ </optional>
816
+ <text/>
817
+ </element>
818
+ </define>
819
+ <define name="bprice">
820
+ <element name="price">
821
+ <attribute name="currency"/>
822
+ <text/>
823
+ </element>
824
+ </define>
825
+ <define name="medium">
826
+ <element name="medium">
827
+ <optional>
828
+ <ref name="bcontent"/>
829
+ </optional>
830
+ <optional>
831
+ <ref name="genre"/>
832
+ </optional>
833
+ <optional>
834
+ <ref name="form"/>
835
+ </optional>
836
+ <optional>
837
+ <ref name="carrier"/>
838
+ </optional>
839
+ <optional>
840
+ <ref name="size"/>
841
+ </optional>
842
+ <optional>
843
+ <ref name="scale"/>
844
+ </optional>
845
+ </element>
846
+ </define>
847
+ <define name="bcontent">
848
+ <element name="content">
849
+ <text/>
850
+ </element>
851
+ </define>
852
+ <define name="genre">
853
+ <element name="genre">
854
+ <text/>
855
+ </element>
856
+ </define>
857
+ <define name="form">
858
+ <element name="form">
859
+ <text/>
860
+ </element>
861
+ </define>
862
+ <define name="carrier">
863
+ <element name="carrier">
864
+ <text/>
865
+ </element>
866
+ </define>
867
+ <define name="size">
868
+ <element name="size">
869
+ <text/>
870
+ </element>
871
+ </define>
872
+ <define name="scale">
873
+ <element name="scale">
874
+ <text/>
875
+ </element>
876
+ </define>
877
+ <define name="accesslocation">
878
+ <element name="accesslocation">
879
+ <text/>
880
+ </element>
881
+ </define>
882
+ <define name="extent">
883
+ <element name="extent">
884
+ <ref name="BibItemLocality"/>
885
+ </element>
886
+ </define>
887
+ <define name="series">
888
+ <element name="series">
889
+ <optional>
890
+ <attribute name="type">
891
+ <ref name="SeriesType"/>
892
+ </attribute>
893
+ </optional>
894
+ <choice>
895
+ <ref name="formattedref"/>
896
+ <group>
897
+ <ref name="btitle"/>
898
+ <optional>
899
+ <ref name="bplace"/>
900
+ </optional>
901
+ <optional>
902
+ <ref name="seriesorganization"/>
903
+ </optional>
904
+ <optional>
905
+ <ref name="abbreviation"/>
906
+ </optional>
907
+ <optional>
908
+ <ref name="seriesfrom"/>
909
+ </optional>
910
+ <optional>
911
+ <ref name="seriesto"/>
912
+ </optional>
913
+ <optional>
914
+ <ref name="seriesnumber"/>
915
+ </optional>
916
+ <optional>
917
+ <ref name="seriespartnumber"/>
918
+ </optional>
919
+ <optional>
920
+ <ref name="seriesrun"/>
921
+ </optional>
922
+ </group>
923
+ </choice>
924
+ </element>
925
+ </define>
926
+ <define name="SeriesType">
927
+ <choice>
928
+ <value>main</value>
929
+ <value>alt</value>
930
+ <text/>
931
+ </choice>
932
+ </define>
933
+ <define name="seriesorganization">
934
+ <element name="organization">
935
+ <text/>
936
+ </element>
937
+ </define>
938
+ <define name="seriesfrom">
939
+ <element name="from">
940
+ <ref name="ISO8601Date"/>
941
+ </element>
942
+ </define>
943
+ <define name="seriesto">
944
+ <element name="to">
945
+ <ref name="ISO8601Date"/>
946
+ </element>
947
+ </define>
948
+ <define name="seriesnumber">
949
+ <element name="number">
950
+ <text/>
951
+ </element>
952
+ </define>
953
+ <define name="seriespartnumber">
954
+ <element name="partnumber">
955
+ <text/>
956
+ </element>
957
+ </define>
958
+ <define name="seriesrun">
959
+ <element name="run">
960
+ <text/>
961
+ </element>
962
+ </define>
963
+ <define name="biblionote">
964
+ <element name="note">
965
+ <optional>
966
+ <attribute name="type"/>
967
+ </optional>
968
+ <ref name="FormattedString"/>
969
+ </element>
970
+ </define>
971
+ <define name="bibabstract">
972
+ <element name="abstract">
973
+ <ref name="FormattedString"/>
974
+ </element>
975
+ </define>
976
+ <define name="copyright">
977
+ <element name="copyright">
978
+ <ref name="from"/>
979
+ <optional>
980
+ <ref name="to"/>
981
+ </optional>
982
+ <ref name="owner"/>
983
+ </element>
984
+ </define>
985
+ <define name="from">
986
+ <element name="from">
987
+ <data type="gYear"/>
988
+ </element>
989
+ </define>
990
+ <define name="to">
991
+ <element name="to">
992
+ <data type="gYear"/>
993
+ </element>
994
+ </define>
995
+ <define name="owner">
996
+ <element name="owner">
997
+ <ref name="ContributorInfo"/>
998
+ </element>
999
+ </define>
1000
+ <define name="DocRelationType">
1001
+ <choice>
1002
+ <value>obsoletes</value>
1003
+ <value>obsoletedBy</value>
1004
+ <value>supersedes</value>
1005
+ <value>supersededBy</value>
1006
+ <value>updates</value>
1007
+ <value>updatedBy</value>
1008
+ <value>complements</value>
1009
+ <value>derivedFrom</value>
1010
+ <value>translatedFrom</value>
1011
+ <value>hasTranslation</value>
1012
+ <value>adoptedFrom</value>
1013
+ <value>equivalent</value>
1014
+ <value>identical</value>
1015
+ <value>nonequivalent</value>
1016
+ <value>includedIn</value>
1017
+ <value>includes</value>
1018
+ <value>instance</value>
1019
+ <value>instanceOf</value>
1020
+ <value>partOf</value>
1021
+ <value>hasPart</value>
1022
+ <value>hasDraft</value>
1023
+ <value>draftOf</value>
1024
+ <value>merges</value>
1025
+ <value>splits</value>
1026
+ <value>amends</value>
1027
+ <value>amendedBy</value>
1028
+ <value>corrects</value>
1029
+ <value>correctedBy</value>
1030
+ <value>revises</value>
1031
+ <value>revisedBy</value>
1032
+ <value>describes</value>
1033
+ <value>describedBy</value>
1034
+ </choice>
1035
+ </define>
1036
+ <define name="docrelation">
1037
+ <element name="relation">
1038
+ <attribute name="type">
1039
+ <ref name="DocRelationType"/>
1040
+ </attribute>
1041
+ <element name="bibitem">
1042
+ <ref name="BibliographicItem"/>
1043
+ </element>
1044
+ <zeroOrMore>
1045
+ <ref name="locality"/>
1046
+ </zeroOrMore>
1047
+ </element>
1048
+ </define>
1049
+ <define name="version">
1050
+ <element name="version">
1051
+ <optional>
1052
+ <ref name="revision-date"/>
1053
+ </optional>
1054
+ <zeroOrMore>
1055
+ <ref name="draft"/>
1056
+ </zeroOrMore>
1057
+ </element>
1058
+ </define>
1059
+ <define name="vedition">
1060
+ <element name="edition">
1061
+ <data type="int"/>
1062
+ </element>
1063
+ </define>
1064
+ <define name="revision-date">
1065
+ <element name="revision-date">
1066
+ <ref name="ISO8601Date"/>
1067
+ </element>
1068
+ </define>
1069
+ <define name="draft">
1070
+ <element name="draft">
1071
+ <text/>
1072
+ </element>
1073
+ </define>
1074
+ <define name="bkeyword">
1075
+ <element name="keyword">
1076
+ <choice>
1077
+ <ref name="LocalizedString"/>
1078
+ <group>
1079
+ <element name="vocab">
1080
+ <ref name="LocalizedString"/>
1081
+ </element>
1082
+ <oneOrMore>
1083
+ <ref name="vocabid"/>
1084
+ </oneOrMore>
1085
+ </group>
1086
+ <group>
1087
+ <oneOrMore>
1088
+ <element name="taxon">
1089
+ <ref name="LocalizedString"/>
1090
+ </element>
1091
+ </oneOrMore>
1092
+ <oneOrMore>
1093
+ <ref name="vocabid"/>
1094
+ </oneOrMore>
1095
+ </group>
1096
+ </choice>
1097
+ </element>
1098
+ </define>
1099
+ <define name="vocabid">
1100
+ <element name="vocabid">
1101
+ <attribute name="type"/>
1102
+ <optional>
1103
+ <attribute name="uri">
1104
+ <data type="anyURI"/>
1105
+ </attribute>
1106
+ </optional>
1107
+ <optional>
1108
+ <element name="code">
1109
+ <text/>
1110
+ </element>
1111
+ </optional>
1112
+ <optional>
1113
+ <element name="term">
1114
+ <text/>
1115
+ </element>
1116
+ </optional>
1117
+ </element>
1118
+ </define>
1119
+ <!--
1120
+ Anycontents = mixed {
1121
+ https://github.com/relaxng/jing-trang/issues/211
1122
+ https://lists.oasis-open.org/archives/office/200808/msg00024.html
1123
+ https://lists.oasis-open.org/archives/office/200808/msg00099.html
1124
+ For this to work, we will actually strip any attributes in the Anycontents before
1125
+ passing it for validation. Horrible I know, but there are no good alternatives
1126
+ that also allow us to do grammar inheritance
1127
+ (attribute * { text } | Any)*
1128
+ Any*
1129
+ }
1130
+ -->
1131
+ <define name="AnyElement">
1132
+ <element>
1133
+ <anyName/>
1134
+ <oneOrMore>
1135
+ <choice>
1136
+ <text/>
1137
+ <ref name="AnyElement"/>
1138
+ </choice>
1139
+ </oneOrMore>
1140
+ </element>
1141
+ </define>
1142
+ </grammar>