metanorma-nist 0.0.1

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