metanorma-bipm 0.0.1

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