metanorma-iec 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/bin/rspec +18 -0
  4. data/lib/asciidoctor/iec/biblio.rng +949 -0
  5. data/lib/asciidoctor/iec/converter.rb +68 -0
  6. data/lib/asciidoctor/iec/iec_intro_en.xml +15 -0
  7. data/lib/asciidoctor/iec/iec_intro_fr.xml +15 -0
  8. data/lib/asciidoctor/iec/isodoc.rng +1132 -0
  9. data/lib/asciidoctor/iec/isostandard.rng +789 -0
  10. data/lib/asciidoctor/iec/reqt.rng +162 -0
  11. data/lib/isodoc/iec/base_convert.rb +69 -0
  12. data/lib/isodoc/iec/html/header.html +160 -0
  13. data/lib/isodoc/iec/html/html_iec_intro.html +34 -0
  14. data/lib/isodoc/iec/html/html_iec_titlepage.html +62 -0
  15. data/lib/isodoc/iec/html/htmlstyle.scss +840 -0
  16. data/lib/isodoc/iec/html/isodoc.scss +785 -0
  17. data/lib/isodoc/iec/html/scripts.html +176 -0
  18. data/lib/isodoc/iec/html/word_iec_intro.html +72 -0
  19. data/lib/isodoc/iec/html/word_iec_titlepage.html +92 -0
  20. data/lib/isodoc/iec/html/wordstyle.scss +1849 -0
  21. data/lib/isodoc/iec/html_convert.rb +33 -0
  22. data/lib/isodoc/iec/i18n-en.yaml +3 -0
  23. data/lib/isodoc/iec/i18n-fr.yaml +3 -0
  24. data/lib/isodoc/iec/i18n-zh-Hans.yaml +3 -0
  25. data/lib/isodoc/iec/metadata.rb +20 -0
  26. data/lib/isodoc/iec/word_convert.rb +165 -0
  27. data/lib/metanorma-iec.rb +12 -0
  28. data/lib/metanorma/iec.rb +8 -0
  29. data/lib/metanorma/iec/processor.rb +40 -0
  30. data/lib/metanorma/iec/version.rb +6 -0
  31. data/metanorma-iec.gemspec +47 -0
  32. data/spec/asciidoctor-iec/base_spec.rb +609 -0
  33. data/spec/asciidoctor-iec/blocks_spec.rb +467 -0
  34. data/spec/asciidoctor-iec/cleanup_spec.rb +766 -0
  35. data/spec/asciidoctor-iec/inline_spec.rb +162 -0
  36. data/spec/asciidoctor-iec/lists_spec.rb +190 -0
  37. data/spec/asciidoctor-iec/macros_spec.rb +21 -0
  38. data/spec/asciidoctor-iec/refs_spec.rb +268 -0
  39. data/spec/asciidoctor-iec/section_spec.rb +341 -0
  40. data/spec/asciidoctor-iec/table_spec.rb +307 -0
  41. data/spec/asciidoctor-iec/validate_spec.rb +132 -0
  42. data/spec/examples/rice.adoc +723 -0
  43. data/spec/examples/rice.doc +19162 -0
  44. data/spec/examples/rice.html +1787 -0
  45. data/spec/examples/rice.xml +1951 -0
  46. data/spec/isodoc/i18n_spec.rb +642 -0
  47. data/spec/isodoc/inline_spec.rb +265 -0
  48. data/spec/isodoc/iso_spec.rb +319 -0
  49. data/spec/isodoc/metadata_spec.rb +153 -0
  50. data/spec/isodoc/postproc_spec.rb +569 -0
  51. data/spec/isodoc/section_spec.rb +686 -0
  52. data/spec/isodoc/terms_spec.rb +206 -0
  53. data/spec/isodoc/xref_spec.rb +1323 -0
  54. data/spec/metanorma/processor_spec.rb +88 -0
  55. data/spec/spec_helper.rb +253 -0
  56. metadata +325 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 414aa89ce9de053ae746f6664fa171a340102be1f038ebaf87ed8e81018d481c
4
+ data.tar.gz: 3e61d7efac5c2ed2fbad25da2aa5a8493baa4a30f03128d579b239ce6e347369
5
+ SHA512:
6
+ metadata.gz: 869bc3cd40a2611a8689aa8ef47219f67750a7517e04f4d377ab90443f3534f3918cb50ad519c9f0cb25804597669a318fb3abb2a7d4801a7435db739b74c200
7
+ data.tar.gz: 597fcd166cb08e14ddb8dc57d1da9ea98b01aa8f561abfceda6ba4907d548ca58ece08d451fe0fd57701ecffd4873a211d5d5d79afdb6690978ca4c06445c766
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ Encoding.default_external = Encoding::UTF_8
2
+ Encoding.default_internal = Encoding::UTF_8
3
+
4
+ source "https://rubygems.org"
5
+
6
+ # Specify your gem's dependencies in gemspec
7
+ gemspec
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path(
11
+ "../../Gemfile", Pathname.new(__FILE__).realpath
12
+ )
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("rspec-core", "rspec")
18
+
@@ -0,0 +1,949 @@
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
+ <define name="status">
37
+ <element name="status">
38
+ <ref name="stage"/>
39
+ <optional>
40
+ <ref name="substage"/>
41
+ </optional>
42
+ <optional>
43
+ <ref name="iteration"/>
44
+ </optional>
45
+ </element>
46
+ </define>
47
+ <define name="stage">
48
+ <element name="stage">
49
+ <text/>
50
+ </element>
51
+ </define>
52
+ <define name="substage">
53
+ <element name="substage">
54
+ <text/>
55
+ </element>
56
+ </define>
57
+ <define name="iteration">
58
+ <element name="iteration">
59
+ <text/>
60
+ </element>
61
+ </define>
62
+ <define name="language">
63
+ <element name="language">
64
+ <text/>
65
+ </element>
66
+ </define>
67
+ <define name="script">
68
+ <a:documentation>ISO-639</a:documentation>
69
+ <element name="script">
70
+ <text/>
71
+ </element>
72
+ </define>
73
+ <define name="edition">
74
+ <a:documentation>ISO-15924: Latn</a:documentation>
75
+ <element name="edition">
76
+ <text/>
77
+ </element>
78
+ </define>
79
+ <define name="LocalizedString">
80
+ <optional>
81
+ <!-- multiple languages and scripts possible: comma delimit them if so -->
82
+ <attribute name="language"/>
83
+ </optional>
84
+ <optional>
85
+ <attribute name="script"/>
86
+ </optional>
87
+ <text/>
88
+ </define>
89
+ <!--
90
+ Unlike UML, change type to format: type is overloaded
91
+ Would be need if plain were default value and could omit the attribute
92
+ Added LocalizedStringOrXsAny
93
+ -->
94
+ <define name="FormattedString">
95
+ <optional>
96
+ <!-- attribute format { ( "plain" | "html" | "docbook" | "tei" | "asciidoc" | "markdown" ) }?, -->
97
+ <attribute name="format">
98
+ <choice>
99
+ <value>text/plain</value>
100
+ <value>text/html</value>
101
+ <value>application/docbook+xml</value>
102
+ <value>application/tei+xml</value>
103
+ <value>text/x-asciidoc</value>
104
+ <value>text/markdown</value>
105
+ <value>application/x-isodoc+xml</value>
106
+ <text/>
107
+ </choice>
108
+ </attribute>
109
+ </optional>
110
+ <ref name="LocalizedStringOrXsAny"/>
111
+ </define>
112
+ <define name="LocalizedStringOrXsAny">
113
+ <optional>
114
+ <!-- multiple languages and scripts possible: comma delimit them if so -->
115
+ <attribute name="language"/>
116
+ </optional>
117
+ <optional>
118
+ <attribute name="script"/>
119
+ </optional>
120
+ <oneOrMore>
121
+ <choice>
122
+ <text/>
123
+ <ref name="AnyElement"/>
124
+ </choice>
125
+ </oneOrMore>
126
+ </define>
127
+ <define name="contributor">
128
+ <element name="contributor">
129
+ <zeroOrMore>
130
+ <ref name="role"/>
131
+ </zeroOrMore>
132
+ <ref name="ContributorInfo"/>
133
+ </element>
134
+ </define>
135
+ <define name="role">
136
+ <element name="role">
137
+ <optional>
138
+ <attribute name="type">
139
+ <choice>
140
+ <value>author</value>
141
+ <value>performer</value>
142
+ <value>publisher</value>
143
+ <value>editor</value>
144
+ <value>adapter</value>
145
+ <value>translator</value>
146
+ <value>distributor</value>
147
+ </choice>
148
+ </attribute>
149
+ </optional>
150
+ <zeroOrMore>
151
+ <ref name="roledescription"/>
152
+ </zeroOrMore>
153
+ </element>
154
+ </define>
155
+ <define name="ContributorInfo">
156
+ <choice>
157
+ <ref name="person"/>
158
+ <ref name="organization"/>
159
+ </choice>
160
+ </define>
161
+ <define name="roledescription">
162
+ <element name="description">
163
+ <ref name="FormattedString"/>
164
+ </element>
165
+ </define>
166
+ <define name="person">
167
+ <element name="person">
168
+ <optional>
169
+ <ref name="fullname"/>
170
+ </optional>
171
+ <zeroOrMore>
172
+ <ref name="affiliation"/>
173
+ </zeroOrMore>
174
+ <zeroOrMore>
175
+ <ref name="person-identifier"/>
176
+ </zeroOrMore>
177
+ <zeroOrMore>
178
+ <ref name="contact"/>
179
+ </zeroOrMore>
180
+ <zeroOrMore>
181
+ <ref name="uri"/>
182
+ </zeroOrMore>
183
+ </element>
184
+ </define>
185
+ <define name="fullname">
186
+ <element name="name">
187
+ <choice>
188
+ <group>
189
+ <zeroOrMore>
190
+ <ref name="prefix"/>
191
+ </zeroOrMore>
192
+ <zeroOrMore>
193
+ <ref name="forename"/>
194
+ </zeroOrMore>
195
+ <zeroOrMore>
196
+ <ref name="initial"/>
197
+ </zeroOrMore>
198
+ <ref name="surname"/>
199
+ <zeroOrMore>
200
+ <ref name="addition"/>
201
+ </zeroOrMore>
202
+ </group>
203
+ <ref name="completeName"/>
204
+ </choice>
205
+ <zeroOrMore>
206
+ <ref name="biblionote"/>
207
+ </zeroOrMore>
208
+ </element>
209
+ </define>
210
+ <define name="prefix">
211
+ <element name="prefix">
212
+ <ref name="LocalizedString"/>
213
+ </element>
214
+ </define>
215
+ <define name="initial">
216
+ <element name="initial">
217
+ <ref name="LocalizedString"/>
218
+ </element>
219
+ </define>
220
+ <define name="addition">
221
+ <element name="addition">
222
+ <ref name="LocalizedString"/>
223
+ </element>
224
+ </define>
225
+ <define name="surname">
226
+ <element name="surname">
227
+ <ref name="LocalizedString"/>
228
+ </element>
229
+ </define>
230
+ <define name="forename">
231
+ <element name="forename">
232
+ <ref name="LocalizedString"/>
233
+ </element>
234
+ </define>
235
+ <define name="completeName">
236
+ <element name="completename">
237
+ <ref name="LocalizedString"/>
238
+ </element>
239
+ </define>
240
+ <define name="affiliation">
241
+ <element name="affiliation">
242
+ <optional>
243
+ <ref name="affiliationname"/>
244
+ </optional>
245
+ <zeroOrMore>
246
+ <ref name="affiliationdescription"/>
247
+ </zeroOrMore>
248
+ <ref name="organization"/>
249
+ </element>
250
+ </define>
251
+ <define name="affiliationname">
252
+ <element name="name">
253
+ <ref name="LocalizedString"/>
254
+ </element>
255
+ </define>
256
+ <define name="affiliationdescription">
257
+ <element name="description">
258
+ <ref name="FormattedString"/>
259
+ </element>
260
+ </define>
261
+ <define name="organization">
262
+ <element name="organization">
263
+ <ref name="orgname"/>
264
+ <optional>
265
+ <ref name="subdivision"/>
266
+ </optional>
267
+ <optional>
268
+ <ref name="abbreviation"/>
269
+ </optional>
270
+ <zeroOrMore>
271
+ <ref name="uri"/>
272
+ </zeroOrMore>
273
+ <zeroOrMore>
274
+ <ref name="org-identifier"/>
275
+ </zeroOrMore>
276
+ <zeroOrMore>
277
+ <ref name="contact"/>
278
+ </zeroOrMore>
279
+ </element>
280
+ </define>
281
+ <define name="orgname">
282
+ <element name="name">
283
+ <ref name="LocalizedString"/>
284
+ </element>
285
+ </define>
286
+ <define name="subdivision">
287
+ <element name="subdivision">
288
+ <ref name="LocalizedString"/>
289
+ </element>
290
+ </define>
291
+ <define name="abbreviation">
292
+ <element name="abbreviation">
293
+ <ref name="LocalizedString"/>
294
+ </element>
295
+ </define>
296
+ <define name="uri">
297
+ <element name="uri">
298
+ <optional>
299
+ <attribute name="type"/>
300
+ </optional>
301
+ <data type="anyURI"/>
302
+ </element>
303
+ </define>
304
+ <!-- TODO may change -->
305
+ <define name="contact">
306
+ <choice>
307
+ <ref name="address"/>
308
+ <ref name="phone"/>
309
+ <ref name="email"/>
310
+ <ref name="uri"/>
311
+ </choice>
312
+ </define>
313
+ <define name="phone">
314
+ <element name="phone">
315
+ <text/>
316
+ </element>
317
+ </define>
318
+ <define name="email">
319
+ <element name="email">
320
+ <text/>
321
+ </element>
322
+ </define>
323
+ <define name="address">
324
+ <element name="address">
325
+ <choice>
326
+ <!-- iso191606 TODO -->
327
+ <group>
328
+ <oneOrMore>
329
+ <ref name="street"/>
330
+ </oneOrMore>
331
+ <ref name="city"/>
332
+ <optional>
333
+ <ref name="state"/>
334
+ </optional>
335
+ <ref name="country"/>
336
+ <optional>
337
+ <ref name="postcode"/>
338
+ </optional>
339
+ </group>
340
+ <ref name="formattedAddress"/>
341
+ </choice>
342
+ </element>
343
+ </define>
344
+ <define name="street">
345
+ <element name="street">
346
+ <text/>
347
+ </element>
348
+ </define>
349
+ <define name="city">
350
+ <element name="city">
351
+ <text/>
352
+ </element>
353
+ </define>
354
+ <define name="state">
355
+ <element name="state">
356
+ <text/>
357
+ </element>
358
+ </define>
359
+ <define name="country">
360
+ <element name="country">
361
+ <text/>
362
+ </element>
363
+ </define>
364
+ <define name="postcode">
365
+ <element name="postcode">
366
+ <text/>
367
+ </element>
368
+ </define>
369
+ <define name="formattedAddress">
370
+ <element name="formattedAddress">
371
+ <text/>
372
+ </element>
373
+ </define>
374
+ <define name="person-identifier">
375
+ <element name="identifier">
376
+ <attribute name="type">
377
+ <choice>
378
+ <value>isni</value>
379
+ <value>uri</value>
380
+ </choice>
381
+ </attribute>
382
+ <text/>
383
+ </element>
384
+ </define>
385
+ <define name="org-identifier">
386
+ <element name="identifier">
387
+ <attribute name="type">
388
+ <choice>
389
+ <value>orcid</value>
390
+ <value>uri</value>
391
+ </choice>
392
+ </attribute>
393
+ <text/>
394
+ </element>
395
+ </define>
396
+ <define name="citation">
397
+ <element name="citation">
398
+ <ref name="CitationType"/>
399
+ </element>
400
+ </define>
401
+ <define name="CitationType">
402
+ <attribute name="bibitemid">
403
+ <data type="IDREF"/>
404
+ </attribute>
405
+ <zeroOrMore>
406
+ <ref name="locality"/>
407
+ </zeroOrMore>
408
+ <optional>
409
+ <ref name="date"/>
410
+ </optional>
411
+ </define>
412
+ <define name="date">
413
+ <element name="date">
414
+ <ref name="ISO8601Date"/>
415
+ </element>
416
+ </define>
417
+ <define name="locality">
418
+ <element name="locality">
419
+ <ref name="BibItemLocality"/>
420
+ </element>
421
+ </define>
422
+ <define name="BibItemLocality">
423
+ <attribute name="type">
424
+ <ref name="LocalityType"/>
425
+ </attribute>
426
+ <ref name="referenceFrom"/>
427
+ <optional>
428
+ <ref name="referenceTo"/>
429
+ </optional>
430
+ </define>
431
+ <define name="LocalityType">
432
+ <data type="string">
433
+ <param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|locality:[a-zA-Z0-9_]+</param>
434
+ </data>
435
+ </define>
436
+ <define name="referenceFrom">
437
+ <element name="referenceFrom">
438
+ <text/>
439
+ </element>
440
+ </define>
441
+ <define name="referenceTo">
442
+ <element name="referenceTo">
443
+ <text/>
444
+ </element>
445
+ </define>
446
+ <!-- unlike UML, has id attribute; that results from including bibitem in a docmodel -->
447
+ <define name="bibitem">
448
+ <element name="bibitem">
449
+ <attribute name="id">
450
+ <data type="ID"/>
451
+ </attribute>
452
+ <ref name="BibliographicItem"/>
453
+ </element>
454
+ </define>
455
+ <define name="bibitem_no_id">
456
+ <element name="bibitem">
457
+ <ref name="BibliographicItem"/>
458
+ </element>
459
+ </define>
460
+ <define name="relaton_collection">
461
+ <element name="relaton-collection">
462
+ <optional>
463
+ <attribute name="type"/>
464
+ </optional>
465
+ <ref name="btitle"/>
466
+ <zeroOrMore>
467
+ <ref name="contributor"/>
468
+ </zeroOrMore>
469
+ <zeroOrMore>
470
+ <ref name="docrelation"/>
471
+ </zeroOrMore>
472
+ </element>
473
+ </define>
474
+ <define name="BibItemType" combine="choice">
475
+ <choice>
476
+ <value>article</value>
477
+ <value>book</value>
478
+ <value>booklet</value>
479
+ <value>conference</value>
480
+ <value>manual</value>
481
+ <value>proceedings</value>
482
+ <value>presentation</value>
483
+ <value>thesis</value>
484
+ <value>techreport</value>
485
+ <value>standard</value>
486
+ <value>unpublished</value>
487
+ <value>map</value>
488
+ <value>electronic resource</value>
489
+ <value>audiovisual</value>
490
+ <value>film</value>
491
+ <value>video</value>
492
+ <value>broadcast</value>
493
+ <value>graphic_work</value>
494
+ <value>music</value>
495
+ <value>patent</value>
496
+ <value>inbook</value>
497
+ <value>incollection</value>
498
+ <value>inproceedings</value>
499
+ <value>journal</value>
500
+ </choice>
501
+ </define>
502
+ <define name="BibliographicItem">
503
+ <optional>
504
+ <attribute name="type">
505
+ <ref name="BibItemType"/>
506
+ </attribute>
507
+ </optional>
508
+ <optional>
509
+ <ref name="fetched"/>
510
+ </optional>
511
+ <choice>
512
+ <oneOrMore>
513
+ <ref name="btitle"/>
514
+ </oneOrMore>
515
+ <ref name="formattedref"/>
516
+ </choice>
517
+ <zeroOrMore>
518
+ <ref name="bsource"/>
519
+ </zeroOrMore>
520
+ <zeroOrMore>
521
+ <ref name="docidentifier"/>
522
+ </zeroOrMore>
523
+ <optional>
524
+ <ref name="docnumber"/>
525
+ </optional>
526
+ <zeroOrMore>
527
+ <ref name="bdate"/>
528
+ </zeroOrMore>
529
+ <zeroOrMore>
530
+ <ref name="contributor"/>
531
+ </zeroOrMore>
532
+ <optional>
533
+ <ref name="edition"/>
534
+ </optional>
535
+ <optional>
536
+ <ref name="version"/>
537
+ </optional>
538
+ <zeroOrMore>
539
+ <ref name="biblionote"/>
540
+ </zeroOrMore>
541
+ <zeroOrMore>
542
+ <ref name="language"/>
543
+ </zeroOrMore>
544
+ <zeroOrMore>
545
+ <ref name="script"/>
546
+ </zeroOrMore>
547
+ <zeroOrMore>
548
+ <ref name="abstract"/>
549
+ </zeroOrMore>
550
+ <optional>
551
+ <ref name="status"/>
552
+ </optional>
553
+ <optional>
554
+ <ref name="copyright"/>
555
+ </optional>
556
+ <zeroOrMore>
557
+ <ref name="docrelation"/>
558
+ </zeroOrMore>
559
+ <zeroOrMore>
560
+ <ref name="series"/>
561
+ </zeroOrMore>
562
+ <optional>
563
+ <ref name="medium"/>
564
+ </optional>
565
+ <zeroOrMore>
566
+ <ref name="bplace"/>
567
+ </zeroOrMore>
568
+ <zeroOrMore>
569
+ <ref name="extent"/>
570
+ </zeroOrMore>
571
+ <zeroOrMore>
572
+ <ref name="accesslocation"/>
573
+ </zeroOrMore>
574
+ <optional>
575
+ <ref name="bclassification"/>
576
+ </optional>
577
+ <optional>
578
+ <ref name="validity"/>
579
+ </optional>
580
+ </define>
581
+ <define name="btitle">
582
+ <element name="title">
583
+ <ref name="TypedTitleString"/>
584
+ </element>
585
+ </define>
586
+ <define name="bsource">
587
+ <element name="uri">
588
+ <ref name="TypedUri"/>
589
+ </element>
590
+ </define>
591
+ <define name="formattedref">
592
+ <element name="formattedref">
593
+ <ref name="FormattedString"/>
594
+ </element>
595
+ </define>
596
+ <define name="fetched">
597
+ <element name="fetched">
598
+ <ref name="ISO8601DateTime"/>
599
+ </element>
600
+ </define>
601
+ <define name="validity">
602
+ <element name="validity">
603
+ <optional>
604
+ <ref name="validityBegins"/>
605
+ </optional>
606
+ <optional>
607
+ <ref name="validityEnds"/>
608
+ </optional>
609
+ <optional>
610
+ <ref name="validityRevision"/>
611
+ </optional>
612
+ </element>
613
+ </define>
614
+ <define name="validityBegins">
615
+ <element name="validityBegins">
616
+ <ref name="ISO8601DateTime"/>
617
+ </element>
618
+ </define>
619
+ <define name="validityEnds">
620
+ <element name="validityEnds">
621
+ <ref name="ISO8601DateTime"/>
622
+ </element>
623
+ </define>
624
+ <define name="validityRevision">
625
+ <element name="revision">
626
+ <ref name="ISO8601DateTime"/>
627
+ </element>
628
+ </define>
629
+ <define name="TypedTitleString">
630
+ <optional>
631
+ <attribute name="type">
632
+ <ref name="TitleType"/>
633
+ </attribute>
634
+ </optional>
635
+ <ref name="FormattedString"/>
636
+ </define>
637
+ <define name="TitleType">
638
+ <choice>
639
+ <value>alternative</value>
640
+ <value>original</value>
641
+ <value>unofficial</value>
642
+ <value>subtitle</value>
643
+ <value>main</value>
644
+ </choice>
645
+ </define>
646
+ <define name="TypedUri">
647
+ <optional>
648
+ <attribute name="type"/>
649
+ </optional>
650
+ <data type="anyURI"/>
651
+ </define>
652
+ <define name="DateType">
653
+ <optional>
654
+ <attribute name="text"/>
655
+ </optional>
656
+ <optional>
657
+ <ref name="ISO8601Date"/>
658
+ </optional>
659
+ </define>
660
+ <define name="BibliographicDateType">
661
+ <choice>
662
+ <value>published</value>
663
+ <value>accessed</value>
664
+ <value>created</value>
665
+ <value>implemented</value>
666
+ <value>obsoleted</value>
667
+ <value>confirmed</value>
668
+ <value>updated</value>
669
+ <value>issued</value>
670
+ <value>transmitted</value>
671
+ <value>copied</value>
672
+ <value>unchanged</value>
673
+ <value>circulated</value>
674
+ </choice>
675
+ </define>
676
+ <define name="bdate">
677
+ <element name="date">
678
+ <attribute name="type">
679
+ <choice>
680
+ <ref name="BibliographicDateType"/>
681
+ <text/>
682
+ </choice>
683
+ </attribute>
684
+ <choice>
685
+ <group>
686
+ <element name="from">
687
+ <ref name="ISO8601Date"/>
688
+ </element>
689
+ <optional>
690
+ <element name="to">
691
+ <ref name="ISO8601Date"/>
692
+ </element>
693
+ </optional>
694
+ </group>
695
+ <element name="on">
696
+ <ref name="ISO8601Date"/>
697
+ </element>
698
+ </choice>
699
+ </element>
700
+ </define>
701
+ <define name="docidentifier">
702
+ <element name="docidentifier">
703
+ <optional>
704
+ <attribute name="type"/>
705
+ </optional>
706
+ <text/>
707
+ </element>
708
+ </define>
709
+ <define name="docnumber">
710
+ <element name="docnumber">
711
+ <text/>
712
+ </element>
713
+ </define>
714
+ <define name="bclassification">
715
+ <element name="classification">
716
+ <optional>
717
+ <attribute name="type"/>
718
+ </optional>
719
+ <text/>
720
+ </element>
721
+ </define>
722
+ <define name="bplace">
723
+ <element name="place">
724
+ <text/>
725
+ </element>
726
+ </define>
727
+ <define name="medium">
728
+ <element name="medium">
729
+ <optional>
730
+ <ref name="form"/>
731
+ </optional>
732
+ <optional>
733
+ <ref name="size"/>
734
+ </optional>
735
+ <optional>
736
+ <ref name="scale"/>
737
+ </optional>
738
+ </element>
739
+ </define>
740
+ <define name="form">
741
+ <element name="form">
742
+ <text/>
743
+ </element>
744
+ </define>
745
+ <define name="size">
746
+ <element name="size">
747
+ <text/>
748
+ </element>
749
+ </define>
750
+ <define name="scale">
751
+ <element name="scale">
752
+ <text/>
753
+ </element>
754
+ </define>
755
+ <define name="accesslocation">
756
+ <element name="accesslocation">
757
+ <text/>
758
+ </element>
759
+ </define>
760
+ <define name="extent">
761
+ <element name="extent">
762
+ <ref name="BibItemLocality"/>
763
+ </element>
764
+ </define>
765
+ <define name="series">
766
+ <element name="series">
767
+ <optional>
768
+ <attribute name="type">
769
+ <ref name="SeriesType"/>
770
+ </attribute>
771
+ </optional>
772
+ <choice>
773
+ <ref name="formattedref"/>
774
+ <group>
775
+ <ref name="btitle"/>
776
+ <optional>
777
+ <ref name="bplace"/>
778
+ </optional>
779
+ <optional>
780
+ <ref name="seriesorganization"/>
781
+ </optional>
782
+ <optional>
783
+ <ref name="abbreviation"/>
784
+ </optional>
785
+ <optional>
786
+ <ref name="seriesfrom"/>
787
+ </optional>
788
+ <optional>
789
+ <ref name="seriesto"/>
790
+ </optional>
791
+ <optional>
792
+ <ref name="seriesnumber"/>
793
+ </optional>
794
+ <optional>
795
+ <ref name="seriespartnumber"/>
796
+ </optional>
797
+ </group>
798
+ </choice>
799
+ </element>
800
+ </define>
801
+ <define name="SeriesType">
802
+ <choice>
803
+ <value>main</value>
804
+ <value>alt</value>
805
+ </choice>
806
+ </define>
807
+ <define name="seriesorganization">
808
+ <element name="organization">
809
+ <text/>
810
+ </element>
811
+ </define>
812
+ <define name="seriesfrom">
813
+ <element name="from">
814
+ <ref name="ISO8601Date"/>
815
+ </element>
816
+ </define>
817
+ <define name="seriesto">
818
+ <element name="to">
819
+ <ref name="ISO8601Date"/>
820
+ </element>
821
+ </define>
822
+ <define name="seriesnumber">
823
+ <element name="number">
824
+ <text/>
825
+ </element>
826
+ </define>
827
+ <define name="seriespartnumber">
828
+ <element name="partnumber">
829
+ <text/>
830
+ </element>
831
+ </define>
832
+ <define name="biblionote">
833
+ <element name="note">
834
+ <optional>
835
+ <attribute name="type"/>
836
+ </optional>
837
+ <ref name="FormattedString"/>
838
+ </element>
839
+ </define>
840
+ <define name="abstract">
841
+ <element name="abstract">
842
+ <ref name="FormattedString"/>
843
+ </element>
844
+ </define>
845
+ <define name="copyright">
846
+ <element name="copyright">
847
+ <ref name="from"/>
848
+ <optional>
849
+ <ref name="to"/>
850
+ </optional>
851
+ <ref name="owner"/>
852
+ </element>
853
+ </define>
854
+ <define name="from">
855
+ <element name="from">
856
+ <data type="gYear"/>
857
+ </element>
858
+ </define>
859
+ <define name="to">
860
+ <element name="to">
861
+ <data type="gYear"/>
862
+ </element>
863
+ </define>
864
+ <define name="owner">
865
+ <element name="owner">
866
+ <ref name="ContributorInfo"/>
867
+ </element>
868
+ </define>
869
+ <define name="DocRelationType">
870
+ <choice>
871
+ <value>obsoletes</value>
872
+ <value>updates</value>
873
+ <value>updatedBy</value>
874
+ <value>complements</value>
875
+ <value>derivedFrom</value>
876
+ <value>translatedFrom</value>
877
+ <value>adoptedFrom</value>
878
+ <value>equivalent</value>
879
+ <value>identical</value>
880
+ <value>nonequivalent</value>
881
+ <value>includedIn</value>
882
+ <value>includes</value>
883
+ <value>instance</value>
884
+ <value>partOf</value>
885
+ <value>hasDraft</value>
886
+ </choice>
887
+ </define>
888
+ <define name="docrelation">
889
+ <element name="relation">
890
+ <attribute name="type">
891
+ <ref name="DocRelationType"/>
892
+ </attribute>
893
+ <element name="bibitem">
894
+ <ref name="BibliographicItem"/>
895
+ </element>
896
+ <zeroOrMore>
897
+ <ref name="locality"/>
898
+ </zeroOrMore>
899
+ </element>
900
+ </define>
901
+ <define name="version">
902
+ <element name="version">
903
+ <optional>
904
+ <ref name="revision-date"/>
905
+ </optional>
906
+ <zeroOrMore>
907
+ <ref name="draft"/>
908
+ </zeroOrMore>
909
+ </element>
910
+ </define>
911
+ <define name="vedition">
912
+ <element name="edition">
913
+ <data type="int"/>
914
+ </element>
915
+ </define>
916
+ <define name="revision-date">
917
+ <element name="revision-date">
918
+ <ref name="ISO8601Date"/>
919
+ </element>
920
+ </define>
921
+ <define name="draft">
922
+ <element name="draft">
923
+ <text/>
924
+ </element>
925
+ </define>
926
+ <!--
927
+ Anycontents = mixed {
928
+ https://github.com/relaxng/jing-trang/issues/211
929
+ https://lists.oasis-open.org/archives/office/200808/msg00024.html
930
+ https://lists.oasis-open.org/archives/office/200808/msg00099.html
931
+ For this to work, we will actually strip any attributes in the Anycontents before
932
+ passing it for validation. Horrible I know, but there are no good alternatives
933
+ that also allow us to do grammar inheritance
934
+ (attribute * { text } | Any)*
935
+ Any*
936
+ }
937
+ -->
938
+ <define name="AnyElement">
939
+ <element>
940
+ <anyName/>
941
+ <oneOrMore>
942
+ <choice>
943
+ <text/>
944
+ <ref name="AnyElement"/>
945
+ </choice>
946
+ </oneOrMore>
947
+ </element>
948
+ </define>
949
+ </grammar>