metanorma-ogc 0.0.2

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/.gitignore +1 -0
  3. data/.hound.yml +3 -0
  4. data/.rubocop.yml +10 -0
  5. data/.travis.yml +16 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE +25 -0
  9. data/README.adoc +323 -0
  10. data/Rakefile +6 -0
  11. data/bin/console +14 -0
  12. data/bin/rspec +17 -0
  13. data/bin/setup +8 -0
  14. data/lib/asciidoctor/ogc.rb +7 -0
  15. data/lib/asciidoctor/ogc/biblio.rng +890 -0
  16. data/lib/asciidoctor/ogc/converter.rb +253 -0
  17. data/lib/asciidoctor/ogc/front.rb +163 -0
  18. data/lib/asciidoctor/ogc/isodoc.rng +1091 -0
  19. data/lib/asciidoctor/ogc/isostandard.rng +1068 -0
  20. data/lib/asciidoctor/ogc/ogc.rng +210 -0
  21. data/lib/isodoc/ogc.rb +10 -0
  22. data/lib/isodoc/ogc/html/header.html +181 -0
  23. data/lib/isodoc/ogc/html/html_ogc_intro.html +85 -0
  24. data/lib/isodoc/ogc/html/html_ogc_titlepage.html +172 -0
  25. data/lib/isodoc/ogc/html/htmlstyle.scss +1054 -0
  26. data/lib/isodoc/ogc/html/ogc.scss +644 -0
  27. data/lib/isodoc/ogc/html/scripts.html +82 -0
  28. data/lib/isodoc/ogc/html/scripts.pdf.html +70 -0
  29. data/lib/isodoc/ogc/html/word_ogc_intro.html +92 -0
  30. data/lib/isodoc/ogc/html/word_ogc_titlepage.html +194 -0
  31. data/lib/isodoc/ogc/html/wordstyle.scss +1104 -0
  32. data/lib/isodoc/ogc/html_convert.rb +355 -0
  33. data/lib/isodoc/ogc/i18n-en.yaml +1 -0
  34. data/lib/isodoc/ogc/metadata.rb +102 -0
  35. data/lib/isodoc/ogc/pdf_convert.rb +357 -0
  36. data/lib/isodoc/ogc/word_convert.rb +345 -0
  37. data/lib/metanorma-ogc.rb +8 -0
  38. data/lib/metanorma/ogc.rb +11 -0
  39. data/lib/metanorma/ogc/processor.rb +43 -0
  40. data/lib/metanorma/ogc/version.rb +5 -0
  41. data/metanorma-ogc.gemspec +45 -0
  42. metadata +338 -0
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "metanorma/ogc"
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__)
data/bin/rspec ADDED
@@ -0,0 +1,17 @@
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")
data/bin/setup ADDED
@@ -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
+ require "asciidoctor/ogc/converter"
2
+
3
+ module Asciidoctor
4
+ module Ogc
5
+
6
+ end
7
+ end
@@ -0,0 +1,890 @@
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
+ <zeroOrMore>
492
+ <ref name="biblionote"/>
493
+ </zeroOrMore>
494
+ <zeroOrMore>
495
+ <ref name="language"/>
496
+ </zeroOrMore>
497
+ <zeroOrMore>
498
+ <ref name="script"/>
499
+ </zeroOrMore>
500
+ <optional>
501
+ <ref name="abstract"/>
502
+ </optional>
503
+ <optional>
504
+ <ref name="status"/>
505
+ </optional>
506
+ <optional>
507
+ <ref name="copyright"/>
508
+ </optional>
509
+ <zeroOrMore>
510
+ <ref name="docrelation"/>
511
+ </zeroOrMore>
512
+ <zeroOrMore>
513
+ <ref name="series"/>
514
+ </zeroOrMore>
515
+ <optional>
516
+ <ref name="medium"/>
517
+ </optional>
518
+ <zeroOrMore>
519
+ <ref name="bplace"/>
520
+ </zeroOrMore>
521
+ <zeroOrMore>
522
+ <ref name="extent"/>
523
+ </zeroOrMore>
524
+ <zeroOrMore>
525
+ <ref name="accesslocation"/>
526
+ </zeroOrMore>
527
+ <optional>
528
+ <ref name="bclassification"/>
529
+ </optional>
530
+ <optional>
531
+ <ref name="validity"/>
532
+ </optional>
533
+ </define>
534
+ <define name="btitle">
535
+ <element name="title">
536
+ <ref name="TypedTitleString"/>
537
+ </element>
538
+ </define>
539
+ <define name="bsource">
540
+ <element name="uri">
541
+ <ref name="TypedUri"/>
542
+ </element>
543
+ </define>
544
+ <define name="formattedref">
545
+ <element name="formattedref">
546
+ <ref name="FormattedString"/>
547
+ </element>
548
+ </define>
549
+ <define name="fetched">
550
+ <element name="fetched">
551
+ <choice>
552
+ <data type="dateTime"/>
553
+ <data type="date"/>
554
+ </choice>
555
+ </element>
556
+ </define>
557
+ <define name="validity">
558
+ <element name="validity">
559
+ <optional>
560
+ <ref name="validityBegins"/>
561
+ </optional>
562
+ <optional>
563
+ <ref name="validityEnds"/>
564
+ </optional>
565
+ <optional>
566
+ <ref name="validityRevision"/>
567
+ </optional>
568
+ </element>
569
+ </define>
570
+ <define name="validityBegins">
571
+ <element name="validityBegins">
572
+ <choice>
573
+ <data type="dateTime"/>
574
+ <data type="date"/>
575
+ </choice>
576
+ </element>
577
+ </define>
578
+ <define name="validityEnds">
579
+ <element name="validityEnds">
580
+ <choice>
581
+ <data type="dateTime"/>
582
+ <data type="date"/>
583
+ </choice>
584
+ </element>
585
+ </define>
586
+ <define name="validityRevision">
587
+ <element name="revision">
588
+ <choice>
589
+ <data type="dateTime"/>
590
+ <data type="date"/>
591
+ </choice>
592
+ </element>
593
+ </define>
594
+ <define name="TypedTitleString">
595
+ <optional>
596
+ <attribute name="type">
597
+ <ref name="TitleType"/>
598
+ </attribute>
599
+ </optional>
600
+ <ref name="FormattedString"/>
601
+ </define>
602
+ <define name="TitleType">
603
+ <choice>
604
+ <value>alternative</value>
605
+ <value>original</value>
606
+ <value>unofficial</value>
607
+ <value>subtitle</value>
608
+ <value>main</value>
609
+ </choice>
610
+ </define>
611
+ <define name="TypedUri">
612
+ <optional>
613
+ <attribute name="type"/>
614
+ </optional>
615
+ <data type="anyURI"/>
616
+ </define>
617
+ <define name="DateType">
618
+ <optional>
619
+ <attribute name="text"/>
620
+ </optional>
621
+ <optional>
622
+ <choice>
623
+ <data type="gYear"/>
624
+ <data type="date"/>
625
+ </choice>
626
+ </optional>
627
+ </define>
628
+ <define name="bdate">
629
+ <element name="date">
630
+ <attribute name="type">
631
+ <choice>
632
+ <value>published</value>
633
+ <value>accessed</value>
634
+ <value>created</value>
635
+ <value>implemented</value>
636
+ <value>obsoleted</value>
637
+ <value>confirmed</value>
638
+ <value>updated</value>
639
+ <value>issued</value>
640
+ <value>transmitted</value>
641
+ <value>copied</value>
642
+ <value>unchanged</value>
643
+ <value>circulated</value>
644
+ <text/>
645
+ </choice>
646
+ </attribute>
647
+ <choice>
648
+ <group>
649
+ <element name="from">
650
+ <choice>
651
+ <data type="gYear"/>
652
+ <data type="date"/>
653
+ </choice>
654
+ </element>
655
+ <optional>
656
+ <element name="to">
657
+ <choice>
658
+ <data type="gYear"/>
659
+ <data type="date"/>
660
+ </choice>
661
+ </element>
662
+ </optional>
663
+ </group>
664
+ <element name="on">
665
+ <choice>
666
+ <data type="gYear"/>
667
+ <data type="date"/>
668
+ </choice>
669
+ </element>
670
+ </choice>
671
+ </element>
672
+ </define>
673
+ <define name="docidentifier">
674
+ <element name="docidentifier">
675
+ <optional>
676
+ <attribute name="type"/>
677
+ </optional>
678
+ <text/>
679
+ </element>
680
+ </define>
681
+ <define name="docnumber">
682
+ <element name="docnumber">
683
+ <text/>
684
+ </element>
685
+ </define>
686
+ <define name="bclassification">
687
+ <element name="classification">
688
+ <optional>
689
+ <attribute name="type"/>
690
+ </optional>
691
+ <text/>
692
+ </element>
693
+ </define>
694
+ <define name="bplace">
695
+ <element name="place">
696
+ <text/>
697
+ </element>
698
+ </define>
699
+ <define name="medium">
700
+ <element name="medium">
701
+ <optional>
702
+ <ref name="form"/>
703
+ </optional>
704
+ <optional>
705
+ <ref name="size"/>
706
+ </optional>
707
+ <optional>
708
+ <ref name="scale"/>
709
+ </optional>
710
+ </element>
711
+ </define>
712
+ <define name="form">
713
+ <element name="form">
714
+ <text/>
715
+ </element>
716
+ </define>
717
+ <define name="size">
718
+ <element name="size">
719
+ <text/>
720
+ </element>
721
+ </define>
722
+ <define name="scale">
723
+ <element name="scale">
724
+ <text/>
725
+ </element>
726
+ </define>
727
+ <define name="accesslocation">
728
+ <element name="accesslocation">
729
+ <text/>
730
+ </element>
731
+ </define>
732
+ <define name="extent">
733
+ <element name="extent">
734
+ <ref name="BibItemLocality"/>
735
+ </element>
736
+ </define>
737
+ <define name="series">
738
+ <element name="series">
739
+ <optional>
740
+ <attribute name="type">
741
+ <choice>
742
+ <value>main</value>
743
+ <value>alt</value>
744
+ </choice>
745
+ </attribute>
746
+ </optional>
747
+ <choice>
748
+ <ref name="btitle"/>
749
+ <ref name="formattedref"/>
750
+ </choice>
751
+ <optional>
752
+ <ref name="bplace"/>
753
+ </optional>
754
+ <optional>
755
+ <ref name="seriesorganization"/>
756
+ </optional>
757
+ <optional>
758
+ <ref name="abbreviation"/>
759
+ </optional>
760
+ <optional>
761
+ <ref name="seriesfrom"/>
762
+ </optional>
763
+ <optional>
764
+ <ref name="seriesto"/>
765
+ </optional>
766
+ <optional>
767
+ <ref name="seriesnumber"/>
768
+ </optional>
769
+ <optional>
770
+ <ref name="seriespartnumber"/>
771
+ </optional>
772
+ </element>
773
+ </define>
774
+ <define name="seriesorganization">
775
+ <element name="organization">
776
+ <text/>
777
+ </element>
778
+ </define>
779
+ <define name="seriesfrom">
780
+ <element name="from">
781
+ <choice>
782
+ <data type="dateTime"/>
783
+ <data type="date"/>
784
+ <data type="gYear"/>
785
+ </choice>
786
+ </element>
787
+ </define>
788
+ <define name="seriesto">
789
+ <element name="to">
790
+ <choice>
791
+ <data type="dateTime"/>
792
+ <data type="date"/>
793
+ <data type="gYear"/>
794
+ </choice>
795
+ </element>
796
+ </define>
797
+ <define name="seriesnumber">
798
+ <element name="number">
799
+ <text/>
800
+ </element>
801
+ </define>
802
+ <define name="seriespartnumber">
803
+ <element name="partnumber">
804
+ <text/>
805
+ </element>
806
+ </define>
807
+ <define name="biblionote">
808
+ <element name="note">
809
+ <ref name="FormattedString"/>
810
+ </element>
811
+ </define>
812
+ <define name="abstract">
813
+ <element name="abstract">
814
+ <ref name="FormattedString"/>
815
+ </element>
816
+ </define>
817
+ <define name="copyright">
818
+ <element name="copyright">
819
+ <ref name="from"/>
820
+ <optional>
821
+ <ref name="to"/>
822
+ </optional>
823
+ <ref name="owner"/>
824
+ </element>
825
+ </define>
826
+ <define name="from">
827
+ <element name="from">
828
+ <data type="gYear"/>
829
+ </element>
830
+ </define>
831
+ <define name="to">
832
+ <element name="to">
833
+ <data type="gYear"/>
834
+ </element>
835
+ </define>
836
+ <define name="owner">
837
+ <element name="owner">
838
+ <ref name="ContributorInfo"/>
839
+ </element>
840
+ </define>
841
+ <define name="docrelation">
842
+ <element name="relation">
843
+ <attribute name="type">
844
+ <choice>
845
+ <value>obsoletes</value>
846
+ <value>updates</value>
847
+ <value>updatedBy</value>
848
+ <value>complements</value>
849
+ <value>derivedFrom</value>
850
+ <value>translatedFrom</value>
851
+ <value>adoptedFrom</value>
852
+ <value>equivalent</value>
853
+ <value>identical</value>
854
+ <value>nonequivalent</value>
855
+ <value>includedIn</value>
856
+ <value>includes</value>
857
+ <value>instance</value>
858
+ <value>partOf</value>
859
+ </choice>
860
+ </attribute>
861
+ <element name="bibitem">
862
+ <ref name="BibliographicItem"/>
863
+ </element>
864
+ <zeroOrMore>
865
+ <ref name="locality"/>
866
+ </zeroOrMore>
867
+ </element>
868
+ </define>
869
+ <!--
870
+ Anycontents = mixed {
871
+ https://github.com/relaxng/jing-trang/issues/211
872
+ https://lists.oasis-open.org/archives/office/200808/msg00024.html
873
+ https://lists.oasis-open.org/archives/office/200808/msg00099.html
874
+ For this to work, we will actually strip any attributes in the Anycontents before
875
+ passing it for validation. Horrible I know, but there are no good alternatives
876
+ that also allow us to do grammar inheritance
877
+ (attribute * { text } | Any)*
878
+ Any*
879
+ }
880
+ -->
881
+ <define name="AnyElement">
882
+ <element>
883
+ <anyName/>
884
+ <choice>
885
+ <text/>
886
+ <ref name="AnyElement"/>
887
+ </choice>
888
+ </element>
889
+ </define>
890
+ </grammar>