asciidoctor-csd 0.1.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59f1e4a9b8ad8b5a0b407b01f8d47d0b8040b6c3
4
- data.tar.gz: 876d61939b829cc455a7d399327c5654cf6eab73
3
+ metadata.gz: 6bbc752bb7ab3ed73ebbb46311b2da24189f5859
4
+ data.tar.gz: a21a1f8442b3559d50c7bd37bb6cd64ebc5c4284
5
5
  SHA512:
6
- metadata.gz: e30368e08af5dd62da89ab1684e452ee5192f82de05c2a393fbe29635231583469e6d0361af76a845557aba195f2430925f767837fc107b59feb39082ee03077
7
- data.tar.gz: 24f0e6f82f9dd31970d0957859fa6d074fd7a21fd5e73bccacbbd6ac16f4de7c439e47ceee54f36a08de1462e0f7d5fe2c123334c06f86217f1ecae107709bc8
6
+ metadata.gz: 4067b2367a1ef9d642366768d7de1fe6d943c7c00c240292da1578dc44aaff157e2cd58e002420bb67e3d5836694916573d3f5ca57b56bd78485d31a9b74bbeb
7
+ data.tar.gz: a842520dfa75adc7b41beca66934d44a37d6ccaa140e7d536b1cb9bbe98d87650a490fb32ab0ccd864be35cd72fdf044e8fd033ce7c70a3069c54aa7de3d633c
data/Gemfile CHANGED
@@ -1,5 +1,10 @@
1
1
  source "https://rubygems.org"
2
2
 
3
+ # Specify your gem's dependencies in ribose.gemspec
4
+ gem "isodoc",
5
+ git: "https://github.com/riboseinc/isodoc.git"
6
+ gem "asciidoctor-iso",
7
+ git: "https://github.com/riboseinc/asciidoctor-iso.git"
3
8
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
9
 
5
10
  # Specify your gem's dependencies in asciidoctor-csd.gemspec
data/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2018, Ribose
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.adoc CHANGED
@@ -9,8 +9,13 @@ WARNING: This gem is still under development.
9
9
  == Functionality
10
10
 
11
11
  This gem processes http://asciidoctor.org/[Asciidoctor] documents following
12
- a template for generating CSD International Standards. The following
13
- outputs are generated.
12
+ a template for generating CSD International Standards.
13
+
14
+ The gem currently inherits from the https://github.com/riboseinc/asciidoctor-iso
15
+ gem, and aligns closely to it. Refer to the ISO gem
16
+ for guidance, including https://github.com/riboseinc/asciidoctor-iso/wiki/Guidance-for-authoring
17
+
18
+ The following outputs are generated.
14
19
 
15
20
  * (Optional) An HTML preview generated directly from the Asciidoctor document,
16
21
  using native Asciidocot formatting.
@@ -227,7 +232,19 @@ the document was issued
227
232
  introduced with `=`, is ignored)
228
233
 
229
234
  `:doctype:`:: The document type (see CSD deliverables: The different types of
230
- CSD publications) (mandatory). The permitted types are: `standard, governance`.
235
+ CSD publications) (mandatory). The permitted types are:
236
+ +
237
+ --
238
+ code:: Code Artifact
239
+ presentation:: Presentation
240
+ proposal:: Proposal; includes IETF DRAFT
241
+ standard:: Recommendation; includes IETF RFC
242
+ report:: report
243
+ --
244
+
245
+ `:status:``:: The document status. The permitted types are: `proposal`,
246
+ `working-draft`, `committee-draft`, `draft-standard`, `final-draft`,
247
+ `published`, `withdrawn`.
231
248
 
232
249
  `:technical-committee:`:: The name of the relevant CSD technical committee
233
250
  (mandatory)
@@ -238,17 +255,21 @@ CSD publications) (mandatory). The permitted types are: `standard, governance`.
238
255
  The attribute `:draft:`, if present, includes review notes in the XML output;
239
256
  these are otherwise suppressed.
240
257
 
258
+ == AsciiCSD features not also present in AsciiISO
259
+
260
+ * `+[keyword]#...#+`: encodes keywords, such as "MUST", "MUST NOT". (Encoded as
261
+ `<span class="keyword">...</span>`.
241
262
 
242
263
  == Data Models
243
264
 
244
265
  The CSD Standard Document format is an instance of the
245
266
  https://github.com/riboseinc/isodoc-models[StandardDocument model]. Details of
246
- this general model can be found on its page.
247
-
248
- === CSD Document Model
249
-
250
- image::models/standard-document.png[]
251
-
267
+ this general model can be found on its page. Details of the CSD modifications
268
+ to this general model can be found on the https://github.com/riboseinc/csd[CSD model]
269
+ repository.
252
270
 
253
271
  == Examples
254
272
 
273
+ * link:spec/examples/rfc6350.adoc[] is an AsciiCSD version of https://tools.ietf.org/html/rfc6350[RFC 6350].
274
+ * link:spec/examples/rfc6350.html[] is an HTML file generated from the AsciiCSD.
275
+ * link:spec/examples/rfc6350.doc[] is a Word document generated from the AsciiCSD.
@@ -1,4 +1,3 @@
1
-
2
1
  lib = File.expand_path("../lib", __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require "asciidoctor/csd/version"
@@ -31,11 +30,13 @@ Gem::Specification.new do |spec|
31
30
  spec.add_dependency "htmlentities", "~> 4.3.4"
32
31
  spec.add_dependency "image_size"
33
32
  spec.add_dependency "mime-types"
34
- spec.add_dependency "nokogiri", "~> 1.8.1"
33
+ spec.add_dependency "nokogiri"
35
34
  spec.add_dependency "ruby-jing"
36
35
  spec.add_dependency "ruby-xslt"
37
36
  spec.add_dependency "thread_safe"
38
37
  spec.add_dependency "uuidtools"
38
+ spec.add_dependency "asciidoctor-iso"
39
+ spec.add_dependency "isodoc"
39
40
 
40
41
  spec.add_development_dependency "bundler", "~> 1.15"
41
42
  spec.add_development_dependency "byebug", "~> 9.1"
data/bin/rspec ADDED
@@ -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,4 @@
1
+ require "asciidoctor" unless defined? Asciidoctor::Converter
2
+ require_relative "asciidoctor/csd/converter"
3
+ require_relative "asciidoctor/csd/csdconvert"
4
+ require_relative "asciidoctor/csd/version"
@@ -0,0 +1,597 @@
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
+ <data type="int"/>
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>edition</value>
106
+ <value>publisher</value>
107
+ <text/>
108
+ </choice>
109
+ </attribute>
110
+ </optional>
111
+ <zeroOrMore>
112
+ <ref name="roledescription"/>
113
+ </zeroOrMore>
114
+ </element>
115
+ </define>
116
+ <define name="ContributorInfo">
117
+ <choice>
118
+ <ref name="person"/>
119
+ <ref name="organization"/>
120
+ </choice>
121
+ </define>
122
+ <define name="roledescription">
123
+ <element name="description">
124
+ <ref name="FormattedString"/>
125
+ </element>
126
+ </define>
127
+ <define name="person">
128
+ <element name="person">
129
+ <optional>
130
+ <ref name="fullname"/>
131
+ </optional>
132
+ <zeroOrMore>
133
+ <ref name="affiliation"/>
134
+ </zeroOrMore>
135
+ <zeroOrMore>
136
+ <ref name="person-identifier"/>
137
+ </zeroOrMore>
138
+ <zeroOrMore>
139
+ <ref name="contact"/>
140
+ </zeroOrMore>
141
+ <optional>
142
+ <ref name="uri"/>
143
+ </optional>
144
+ </element>
145
+ </define>
146
+ <define name="fullname">
147
+ <element name="name">
148
+ <zeroOrMore>
149
+ <ref name="prefix"/>
150
+ </zeroOrMore>
151
+ <zeroOrMore>
152
+ <ref name="forename"/>
153
+ </zeroOrMore>
154
+ <zeroOrMore>
155
+ <ref name="initial"/>
156
+ </zeroOrMore>
157
+ <ref name="surname"/>
158
+ <zeroOrMore>
159
+ <ref name="addition"/>
160
+ </zeroOrMore>
161
+ </element>
162
+ </define>
163
+ <define name="prefix">
164
+ <element name="prefix">
165
+ <ref name="LocalizedString"/>
166
+ </element>
167
+ </define>
168
+ <define name="initial">
169
+ <element name="initial">
170
+ <ref name="LocalizedString"/>
171
+ </element>
172
+ </define>
173
+ <define name="addition">
174
+ <element name="addition">
175
+ <ref name="LocalizedString"/>
176
+ </element>
177
+ </define>
178
+ <define name="surname">
179
+ <element name="surname">
180
+ <ref name="LocalizedString"/>
181
+ </element>
182
+ </define>
183
+ <define name="forename">
184
+ <element name="forename">
185
+ <ref name="LocalizedString"/>
186
+ </element>
187
+ </define>
188
+ <define name="affiliation">
189
+ <element name="affiliation">
190
+ <optional>
191
+ <ref name="affiliationname"/>
192
+ </optional>
193
+ <zeroOrMore>
194
+ <ref name="affiliationdescription"/>
195
+ </zeroOrMore>
196
+ <ref name="organization"/>
197
+ </element>
198
+ </define>
199
+ <define name="affiliationname">
200
+ <element name="name">
201
+ <ref name="LocalizedString"/>
202
+ </element>
203
+ </define>
204
+ <define name="affiliationdescription">
205
+ <element name="description">
206
+ <ref name="FormattedString"/>
207
+ </element>
208
+ </define>
209
+ <define name="organization">
210
+ <element name="organization">
211
+ <ref name="orgname"/>
212
+ <optional>
213
+ <ref name="abbreviation"/>
214
+ </optional>
215
+ <optional>
216
+ <ref name="uri"/>
217
+ </optional>
218
+ <zeroOrMore>
219
+ <ref name="org-identifier"/>
220
+ </zeroOrMore>
221
+ <zeroOrMore>
222
+ <ref name="contact"/>
223
+ </zeroOrMore>
224
+ </element>
225
+ </define>
226
+ <define name="orgname">
227
+ <element name="name">
228
+ <ref name="LocalizedString"/>
229
+ </element>
230
+ </define>
231
+ <define name="abbreviation">
232
+ <element name="abbreviation">
233
+ <ref name="LocalizedString"/>
234
+ </element>
235
+ </define>
236
+ <define name="uri">
237
+ <element name="uri">
238
+ <data type="anyURI"/>
239
+ </element>
240
+ </define>
241
+ <!-- TODO may change -->
242
+ <define name="contact">
243
+ <choice>
244
+ <ref name="address"/>
245
+ <ref name="phone"/>
246
+ <ref name="email"/>
247
+ <ref name="uri"/>
248
+ </choice>
249
+ </define>
250
+ <define name="phone">
251
+ <element name="phone">
252
+ <text/>
253
+ </element>
254
+ </define>
255
+ <define name="email">
256
+ <element name="email">
257
+ <text/>
258
+ </element>
259
+ </define>
260
+ <define name="address">
261
+ <element name="address">
262
+ <oneOrMore>
263
+ <!-- iso191606 TODO -->
264
+ <ref name="street"/>
265
+ </oneOrMore>
266
+ <ref name="city"/>
267
+ <optional>
268
+ <ref name="state"/>
269
+ </optional>
270
+ <ref name="country"/>
271
+ <optional>
272
+ <ref name="postcode"/>
273
+ </optional>
274
+ </element>
275
+ </define>
276
+ <define name="street">
277
+ <element name="street">
278
+ <text/>
279
+ </element>
280
+ </define>
281
+ <define name="city">
282
+ <element name="city">
283
+ <text/>
284
+ </element>
285
+ </define>
286
+ <define name="state">
287
+ <element name="state">
288
+ <text/>
289
+ </element>
290
+ </define>
291
+ <define name="country">
292
+ <element name="country">
293
+ <text/>
294
+ </element>
295
+ </define>
296
+ <define name="postcode">
297
+ <element name="postcode">
298
+ <text/>
299
+ </element>
300
+ </define>
301
+ <define name="person-identifier">
302
+ <element name="identifier">
303
+ <attribute name="type">
304
+ <choice>
305
+ <value>isni</value>
306
+ <value>uri</value>
307
+ </choice>
308
+ </attribute>
309
+ <text/>
310
+ </element>
311
+ </define>
312
+ <define name="org-identifier">
313
+ <element name="identifier">
314
+ <attribute name="type">
315
+ <choice>
316
+ <value>orcid</value>
317
+ <value>uri</value>
318
+ </choice>
319
+ </attribute>
320
+ <text/>
321
+ </element>
322
+ </define>
323
+ <define name="citation">
324
+ <element name="citation">
325
+ <ref name="CitationType"/>
326
+ </element>
327
+ </define>
328
+ <define name="CitationType">
329
+ <attribute name="bibitemid">
330
+ <data type="IDREF"/>
331
+ </attribute>
332
+ <zeroOrMore>
333
+ <ref name="locality"/>
334
+ </zeroOrMore>
335
+ <optional>
336
+ <ref name="date"/>
337
+ </optional>
338
+ </define>
339
+ <define name="date">
340
+ <element name="date">
341
+ <choice>
342
+ <data type="gYear"/>
343
+ <data type="date"/>
344
+ </choice>
345
+ </element>
346
+ </define>
347
+ <define name="locality">
348
+ <element name="locality">
349
+ <!-- attribute type { ( "section" | "clause" | "part" | "paragraph" | "chapter" | "page" | "whole" | "table" | "annex" | "figure" | "note" | "example" | ("locality:", text) ) }, -->
350
+ <attribute name="type">
351
+ <ref name="LocalityType"/>
352
+ </attribute>
353
+ <ref name="referenceFrom"/>
354
+ <optional>
355
+ <ref name="referenceTo"/>
356
+ </optional>
357
+ </element>
358
+ </define>
359
+ <define name="LocalityType">
360
+ <data type="string">
361
+ <param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|example|locality:[a-zA-Z0-9_]+</param>
362
+ </data>
363
+ </define>
364
+ <define name="referenceFrom">
365
+ <element name="referenceFrom">
366
+ <text/>
367
+ </element>
368
+ </define>
369
+ <define name="referenceTo">
370
+ <element name="referenceTo">
371
+ <text/>
372
+ </element>
373
+ </define>
374
+ <!-- unlike UML, has id attribute; that results from including bibitem in a docmodel -->
375
+ <define name="bibitem">
376
+ <element name="bibitem">
377
+ <attribute name="id">
378
+ <data type="ID"/>
379
+ </attribute>
380
+ <ref name="BibliographicItem"/>
381
+ </element>
382
+ </define>
383
+ <define name="bibitem_no_id">
384
+ <element name="bibitem">
385
+ <ref name="BibliographicItem"/>
386
+ </element>
387
+ </define>
388
+ <define name="BibItemType" combine="choice">
389
+ <choice>
390
+ <value>article</value>
391
+ <value>book</value>
392
+ <value>booklet</value>
393
+ <value>conference</value>
394
+ <value>manual</value>
395
+ <value>proceedings</value>
396
+ <value>presentation</value>
397
+ <value>thesis</value>
398
+ <value>techreport</value>
399
+ <value>standard</value>
400
+ <value>unpublished</value>
401
+ </choice>
402
+ </define>
403
+ <define name="BibliographicItem">
404
+ <optional>
405
+ <attribute name="type">
406
+ <ref name="BibItemType"/>
407
+ </attribute>
408
+ </optional>
409
+ <choice>
410
+ <oneOrMore>
411
+ <ref name="btitle"/>
412
+ </oneOrMore>
413
+ <ref name="formattedref"/>
414
+ </choice>
415
+ <zeroOrMore>
416
+ <ref name="source"/>
417
+ </zeroOrMore>
418
+ <zeroOrMore>
419
+ <ref name="docidentifier"/>
420
+ </zeroOrMore>
421
+ <zeroOrMore>
422
+ <ref name="bdate"/>
423
+ </zeroOrMore>
424
+ <zeroOrMore>
425
+ <ref name="contributor"/>
426
+ </zeroOrMore>
427
+ <optional>
428
+ <ref name="edition"/>
429
+ </optional>
430
+ <zeroOrMore>
431
+ <ref name="biblionote"/>
432
+ </zeroOrMore>
433
+ <zeroOrMore>
434
+ <ref name="language"/>
435
+ </zeroOrMore>
436
+ <zeroOrMore>
437
+ <ref name="script"/>
438
+ </zeroOrMore>
439
+ <optional>
440
+ <ref name="abstract"/>
441
+ </optional>
442
+ <optional>
443
+ <ref name="status"/>
444
+ </optional>
445
+ <optional>
446
+ <ref name="copyright"/>
447
+ </optional>
448
+ <zeroOrMore>
449
+ <ref name="docrelation"/>
450
+ </zeroOrMore>
451
+ </define>
452
+ <define name="btitle">
453
+ <element name="title">
454
+ <ref name="FormattedString"/>
455
+ </element>
456
+ </define>
457
+ <define name="formattedref">
458
+ <element name="formattedref">
459
+ <ref name="FormattedString"/>
460
+ </element>
461
+ </define>
462
+ <define name="link">
463
+ <element name="link">
464
+ <ref name="TypedUri"/>
465
+ </element>
466
+ </define>
467
+ <define name="TypedUri">
468
+ <optional>
469
+ <attribute name="type"/>
470
+ </optional>
471
+ <data type="anyURI"/>
472
+ </define>
473
+ <define name="bdate">
474
+ <element name="date">
475
+ <attribute name="type">
476
+ <choice>
477
+ <value>published</value>
478
+ <value>accessed</value>
479
+ <value>created</value>
480
+ <value>implemented</value>
481
+ <value>obsoleted</value>
482
+ <value>confirmed</value>
483
+ <value>updated</value>
484
+ <value>issued</value>
485
+ </choice>
486
+ </attribute>
487
+ <ref name="bfrom"/>
488
+ <optional>
489
+ <ref name="bto"/>
490
+ </optional>
491
+ </element>
492
+ </define>
493
+ <define name="bfrom">
494
+ <element name="from">
495
+ <choice>
496
+ <data type="gYear"/>
497
+ <data type="date"/>
498
+ </choice>
499
+ </element>
500
+ </define>
501
+ <define name="bto">
502
+ <element name="to">
503
+ <choice>
504
+ <data type="gYear"/>
505
+ <data type="date"/>
506
+ </choice>
507
+ </element>
508
+ </define>
509
+ <define name="docidentifier">
510
+ <element name="docidentifier">
511
+ <optional>
512
+ <attribute name="type"/>
513
+ </optional>
514
+ <text/>
515
+ </element>
516
+ </define>
517
+ <define name="biblionote">
518
+ <element name="note">
519
+ <ref name="FormattedString"/>
520
+ </element>
521
+ </define>
522
+ <define name="abstract">
523
+ <element name="abstract">
524
+ <ref name="FormattedString"/>
525
+ </element>
526
+ </define>
527
+ <define name="copyright">
528
+ <element name="copyright">
529
+ <ref name="from"/>
530
+ <optional>
531
+ <ref name="to"/>
532
+ </optional>
533
+ <ref name="owner"/>
534
+ </element>
535
+ </define>
536
+ <define name="from">
537
+ <element name="from">
538
+ <data type="gYear"/>
539
+ </element>
540
+ </define>
541
+ <define name="to">
542
+ <element name="to">
543
+ <data type="gYear"/>
544
+ </element>
545
+ </define>
546
+ <define name="owner">
547
+ <element name="owner">
548
+ <ref name="ContributorInfo"/>
549
+ </element>
550
+ </define>
551
+ <define name="docrelation">
552
+ <element name="relation">
553
+ <attribute name="type">
554
+ <choice>
555
+ <value>parent</value>
556
+ <value>child</value>
557
+ <value>obsoletes</value>
558
+ <value>updates</value>
559
+ <value>updatedBy</value>
560
+ <value>complements</value>
561
+ <value>derivedFrom</value>
562
+ <value>adoptedFrom</value>
563
+ <value>equivalent</value>
564
+ <value>identical</value>
565
+ <value>nonequivalent</value>
566
+ </choice>
567
+ </attribute>
568
+ <element name="bibitem">
569
+ <ref name="BibliographicItem"/>
570
+ </element>
571
+ <zeroOrMore>
572
+ <ref name="locality"/>
573
+ </zeroOrMore>
574
+ </element>
575
+ </define>
576
+ <!--
577
+ Anycontents = mixed {
578
+ https://github.com/relaxng/jing-trang/issues/211
579
+ https://lists.oasis-open.org/archives/office/200808/msg00024.html
580
+ https://lists.oasis-open.org/archives/office/200808/msg00099.html
581
+ For this to work, we will actually strip any attributes in the Anycontents before
582
+ passing it for validation. Horrible I know, but there are no good alternatives
583
+ that also allow us to do grammar inheritance
584
+ (attribute * { text } | Any)*
585
+ Any*
586
+ }
587
+ -->
588
+ <define name="AnyElement">
589
+ <element>
590
+ <anyName/>
591
+ <choice>
592
+ <text/>
593
+ <ref name="AnyElement"/>
594
+ </choice>
595
+ </element>
596
+ </define>
597
+ </grammar>