asciidoctor-iso 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +7 -10
  3. data/README.adoc +118 -6
  4. data/asciidoctor-iso.gemspec +1 -4
  5. data/lib/asciidoctor-iso.rb +2 -0
  6. data/lib/asciidoctor/iso/base.rb +20 -95
  7. data/lib/asciidoctor/iso/blocks.rb +47 -39
  8. data/lib/asciidoctor/iso/cleanup.rb +25 -97
  9. data/lib/asciidoctor/iso/cleanup_block.rb +10 -1
  10. data/lib/asciidoctor/iso/cleanup_ref.rb +100 -0
  11. data/lib/asciidoctor/iso/converter.rb +5 -2
  12. data/lib/asciidoctor/iso/front.rb +52 -24
  13. data/lib/asciidoctor/iso/html/header.html +10 -10
  14. data/lib/asciidoctor/iso/html/html_iso_intro.html +1 -1
  15. data/lib/asciidoctor/iso/html/html_iso_titlepage.html +5 -5
  16. data/lib/asciidoctor/iso/html/htmlstyle.css +0 -21
  17. data/lib/asciidoctor/iso/html/isodoc.css +13 -28
  18. data/lib/asciidoctor/iso/html/word_iso_intro.html +2 -2
  19. data/lib/asciidoctor/iso/html/word_iso_titlepage.html +7 -7
  20. data/lib/asciidoctor/iso/html/wordstyle.css +998 -0
  21. data/lib/asciidoctor/iso/inline.rb +128 -0
  22. data/lib/asciidoctor/iso/isodoc.rng +1516 -0
  23. data/lib/asciidoctor/iso/isostandard.rnc +38 -39
  24. data/lib/asciidoctor/iso/isostandard.rng +529 -1276
  25. data/lib/asciidoctor/iso/isostandard_diff.rnc +40 -56
  26. data/lib/asciidoctor/iso/lists.rb +30 -28
  27. data/lib/asciidoctor/iso/macros.rb +37 -0
  28. data/lib/asciidoctor/iso/section.rb +1 -1
  29. data/lib/asciidoctor/iso/utils.rb +9 -0
  30. data/lib/asciidoctor/iso/validate.rb +41 -120
  31. data/lib/asciidoctor/iso/validate_section.rb +117 -0
  32. data/lib/asciidoctor/iso/validate_style.rb +5 -7
  33. data/lib/asciidoctor/iso/version.rb +1 -1
  34. data/spec/examples/rice.adoc +41 -8
  35. data/spec/examples/rice.doc +2885 -2859
  36. data/spec/examples/rice.html +316 -649
  37. data/spec/examples/rice.preview.html +51 -10
  38. data/spec/examples/rice.xml +418 -343
  39. metadata +12 -50
  40. data/lib/asciidoctor/iso/inline_anchor.rb +0 -59
  41. data/lib/asciidoctor/iso/validate.make.sh +0 -8
@@ -0,0 +1,128 @@
1
+ require 'asciidoctor/extensions'
2
+
3
+ module Asciidoctor
4
+ module ISO
5
+ module Inline
6
+
7
+ def is_refid?(x)
8
+ @refids.include? x
9
+ end
10
+
11
+ def inline_anchor(node)
12
+ case node.type
13
+ when :ref
14
+ inline_anchor_ref node
15
+ when :xref
16
+ inline_anchor_xref node
17
+ when :link
18
+ inline_anchor_link node
19
+ when :bibref
20
+ inline_anchor_bibref node
21
+ else
22
+ warning(node, "unknown anchor type", node.type.inspect)
23
+ end
24
+ end
25
+
26
+ def inline_anchor_ref(node)
27
+ noko do |xml|
28
+ xml.bookmark nil, **attr_code(id: node.id)
29
+ end.join
30
+ end
31
+
32
+ def inline_anchor_xref(node)
33
+ matched = /^fn(: (?<text>.*))?$/.match node.text
34
+ f = matched.nil? ? "inline" : "footnote"
35
+ c = matched.nil? ? node.text : matched[:text]
36
+ t = node.target.gsub(/^#/, "").gsub(%r{(.)(\.xml)?#.*$}, "\\1")
37
+ noko do |xml|
38
+ xml.xref c, **attr_code(target: t, type: f)
39
+ end.join
40
+ end
41
+
42
+ def inline_anchor_link(node)
43
+ contents = node.text
44
+ contents = nil if node.target.gsub(%r{^mailto:}, "") == node.text
45
+ attributes = { "target": node.target }
46
+ noko do |xml|
47
+ xml.link contents, **attr_code(attributes)
48
+ end.join
49
+ end
50
+
51
+ def inline_anchor_bibref(node)
52
+ eref_contents = node.target == node.text ? nil : node.text
53
+ eref_attributes = { id: node.target }
54
+ @refids << node.target
55
+ noko do |xml|
56
+ xml.ref eref_contents, **attr_code(eref_attributes)
57
+ end.join
58
+ end
59
+
60
+ def inline_callout(node)
61
+ noko do |xml|
62
+ xml.callout node.text
63
+ end.join
64
+ end
65
+
66
+ def inline_footnote(node)
67
+ noko do |xml|
68
+ @fn_number += 1
69
+ xml.fn **{reference: @fn_number} do |fn|
70
+ fn.p { |p| p << node.text }
71
+ footnote_style(node, node.text)
72
+ end
73
+ end.join("\n")
74
+ end
75
+
76
+ def inline_break(node)
77
+ noko do |xml|
78
+ xml << node.text
79
+ xml.br
80
+ end.join("\n")
81
+ end
82
+
83
+ def page_break(node)
84
+ noko do |xml|
85
+ xml << node.text
86
+ xml.pagebreak
87
+ end.join("\n")
88
+ end
89
+
90
+ def thematic_break(node)
91
+ noko do |xml|
92
+ xml << node.text
93
+ xml.hr
94
+ end.join("\n")
95
+ end
96
+
97
+
98
+
99
+ def inline_quoted(node)
100
+ noko do |xml|
101
+ case node.type
102
+ when :emphasis then xml.em node.text
103
+ when :strong then xml.strong node.text
104
+ when :monospaced then xml.tt node.text
105
+ when :double then xml << "\"#{node.text}\""
106
+ when :single then xml << "'#{node.text}'"
107
+ when :superscript then xml.sup node.text
108
+ when :subscript then xml.sub node.text
109
+ when :asciimath then xml.stem node.text, **{ type: "AsciiMath" }
110
+ else
111
+ case node.role
112
+ # the following three are legacy, they are now handled by macros
113
+ when "alt" then xml.admitted { |a| a << node.text }
114
+ when "deprecated" then xml.deprecates { |a| a << node.text }
115
+ when "domain" then xml.domain { |a| a << node.text }
116
+
117
+ when "strike" then xml.strike node.text
118
+ when "smallcap" then xml.smallcap node.text
119
+ else
120
+ xml << node.text
121
+ end
122
+ end
123
+ end.join
124
+ end
125
+
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,1516 @@
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
+ <start>
22
+ <ref name="standard-document"/>
23
+ </start>
24
+ <define name="standard-document">
25
+ <element name="standard-document">
26
+ <ref name="bibdata"/>
27
+ <zeroOrMore>
28
+ <ref name="docrelation"/>
29
+ </zeroOrMore>
30
+ <optional>
31
+ <ref name="version"/>
32
+ </optional>
33
+ <oneOrMore>
34
+ <ref name="sections"/>
35
+ </oneOrMore>
36
+ <zeroOrMore>
37
+ <ref name="annex"/>
38
+ </zeroOrMore>
39
+ <zeroOrMore>
40
+ <ref name="references"/>
41
+ </zeroOrMore>
42
+ </element>
43
+ </define>
44
+ <define name="bibdata">
45
+ <element name="bibdata">
46
+ <ref name="BibData"/>
47
+ </element>
48
+ </define>
49
+ <define name="docrelation">
50
+ <element name="docrelation">
51
+ <attribute name="type">
52
+ <choice>
53
+ <value>obsoletes</value>
54
+ <value>updates</value>
55
+ <value>complements</value>
56
+ </choice>
57
+ </attribute>
58
+ <ref name="eref"/>
59
+ </element>
60
+ </define>
61
+ <define name="status">
62
+ <element name="status">
63
+ <ref name="FormattedString"/>
64
+ </element>
65
+ </define>
66
+ <define name="language">
67
+ <element name="language">
68
+ <text/>
69
+ </element>
70
+ </define>
71
+ <define name="script">
72
+ <a:documentation>ISO-639</a:documentation>
73
+ <element name="script">
74
+ <text/>
75
+ </element>
76
+ </define>
77
+ <define name="version">
78
+ <a:documentation>ISO-15924: Latn</a:documentation>
79
+ <element name="version">
80
+ <optional>
81
+ <ref name="edition"/>
82
+ </optional>
83
+ <optional>
84
+ <ref name="revision-date"/>
85
+ </optional>
86
+ <zeroOrMore>
87
+ <ref name="version"/>
88
+ </zeroOrMore>
89
+ </element>
90
+ </define>
91
+ <define name="edition">
92
+ <element name="edition">
93
+ <data type="int"/>
94
+ </element>
95
+ </define>
96
+ <define name="revision-date">
97
+ <element name="revision-date">
98
+ <data type="date"/>
99
+ </element>
100
+ </define>
101
+ <define name="version">
102
+ <element name="version">
103
+ <text/>
104
+ </element>
105
+ </define>
106
+ <define name="sections">
107
+ <element name="sections">
108
+ <oneOrMore>
109
+ <choice>
110
+ <ref name="content"/>
111
+ <ref name="clause"/>
112
+ <ref name="terms"/>
113
+ </choice>
114
+ </oneOrMore>
115
+ </element>
116
+ </define>
117
+ <define name="section-title">
118
+ <element name="title">
119
+ <text/>
120
+ </element>
121
+ </define>
122
+ <define name="content">
123
+ <element name="content">
124
+ <ref name="Content-Section"/>
125
+ </element>
126
+ </define>
127
+ <define name="content-subsection">
128
+ <element name="subsection">
129
+ <ref name="Content-Section"/>
130
+ </element>
131
+ </define>
132
+ <define name="Content-Section">
133
+ <optional>
134
+ <attribute name="id">
135
+ <data type="ID"/>
136
+ </attribute>
137
+ </optional>
138
+ <optional>
139
+ <ref name="section-title"/>
140
+ </optional>
141
+ <choice>
142
+ <group>
143
+ <oneOrMore>
144
+ <ref name="BasicBlock"/>
145
+ </oneOrMore>
146
+ <zeroOrMore>
147
+ <ref name="note"/>
148
+ </zeroOrMore>
149
+ </group>
150
+ <oneOrMore>
151
+ <ref name="content-subsection"/>
152
+ </oneOrMore>
153
+ </choice>
154
+ </define>
155
+ <define name="clause">
156
+ <element name="clause">
157
+ <ref name="Clause-Section"/>
158
+ </element>
159
+ </define>
160
+ <define name="Clause-Section">
161
+ <optional>
162
+ <attribute name="id">
163
+ <data type="ID"/>
164
+ </attribute>
165
+ </optional>
166
+ <optional>
167
+ <ref name="section-title"/>
168
+ </optional>
169
+ <choice>
170
+ <group>
171
+ <oneOrMore>
172
+ <ref name="BasicBlock"/>
173
+ </oneOrMore>
174
+ <zeroOrMore>
175
+ <ref name="note"/>
176
+ </zeroOrMore>
177
+ </group>
178
+ <oneOrMore>
179
+ <ref name="clause-subsection"/>
180
+ </oneOrMore>
181
+ </choice>
182
+ </define>
183
+ <define name="clause-subsection">
184
+ <element name="subsection">
185
+ <ref name="Clause-Section"/>
186
+ </element>
187
+ </define>
188
+ <define name="annex">
189
+ <element name="annex">
190
+ <optional>
191
+ <attribute name="id">
192
+ <data type="ID"/>
193
+ </attribute>
194
+ </optional>
195
+ <attribute name="type">
196
+ <choice>
197
+ <value>normative</value>
198
+ <value>informative</value>
199
+ </choice>
200
+ </attribute>
201
+ <optional>
202
+ <ref name="section-title"/>
203
+ </optional>
204
+ <choice>
205
+ <group>
206
+ <oneOrMore>
207
+ <ref name="BasicBlock"/>
208
+ </oneOrMore>
209
+ <zeroOrMore>
210
+ <ref name="note"/>
211
+ </zeroOrMore>
212
+ </group>
213
+ <oneOrMore>
214
+ <ref name="clause-subsection"/>
215
+ </oneOrMore>
216
+ </choice>
217
+ </element>
218
+ </define>
219
+ <define name="references">
220
+ <element name="references">
221
+ <optional>
222
+ <attribute name="id">
223
+ <data type="ID"/>
224
+ </attribute>
225
+ </optional>
226
+ <optional>
227
+ <ref name="section-title"/>
228
+ </optional>
229
+ <zeroOrMore>
230
+ <ref name="bibitem"/>
231
+ </zeroOrMore>
232
+ </element>
233
+ </define>
234
+ <define name="terms">
235
+ <element name="terms">
236
+ <optional>
237
+ <attribute name="id">
238
+ <data type="ID"/>
239
+ </attribute>
240
+ </optional>
241
+ <oneOrMore>
242
+ <ref name="term"/>
243
+ </oneOrMore>
244
+ </element>
245
+ </define>
246
+ <define name="term">
247
+ <element name="term">
248
+ <optional>
249
+ <attribute name="id">
250
+ <data type="ID"/>
251
+ </attribute>
252
+ </optional>
253
+ <oneOrMore>
254
+ <ref name="preferred"/>
255
+ </oneOrMore>
256
+ <zeroOrMore>
257
+ <ref name="admitted"/>
258
+ </zeroOrMore>
259
+ <zeroOrMore>
260
+ <ref name="deprecates"/>
261
+ </zeroOrMore>
262
+ <optional>
263
+ <ref name="termdomain"/>
264
+ </optional>
265
+ <ref name="definition"/>
266
+ <zeroOrMore>
267
+ <ref name="termnote"/>
268
+ </zeroOrMore>
269
+ <zeroOrMore>
270
+ <ref name="termexample"/>
271
+ </zeroOrMore>
272
+ <zeroOrMore>
273
+ <ref name="termsource"/>
274
+ </zeroOrMore>
275
+ </element>
276
+ </define>
277
+ <define name="preferred">
278
+ <element name="preferred">
279
+ <oneOrMore>
280
+ <ref name="TextElement"/>
281
+ </oneOrMore>
282
+ </element>
283
+ </define>
284
+ <define name="admitted">
285
+ <element name="admitted">
286
+ <oneOrMore>
287
+ <ref name="TextElement"/>
288
+ </oneOrMore>
289
+ </element>
290
+ </define>
291
+ <define name="deprecates">
292
+ <element name="deprecates">
293
+ <oneOrMore>
294
+ <ref name="TextElement"/>
295
+ </oneOrMore>
296
+ </element>
297
+ </define>
298
+ <define name="termdomain">
299
+ <element name="domain">
300
+ <oneOrMore>
301
+ <ref name="TextElement"/>
302
+ </oneOrMore>
303
+ </element>
304
+ </define>
305
+ <define name="definition">
306
+ <element name="definition">
307
+ <ref name="paragraph"/>
308
+ </element>
309
+ </define>
310
+ <define name="termnote">
311
+ <element name="termnote">
312
+ <attribute name="id">
313
+ <data type="ID"/>
314
+ </attribute>
315
+ <ref name="paragraph"/>
316
+ </element>
317
+ </define>
318
+ <define name="termexample">
319
+ <element name="termexample">
320
+ <attribute name="id">
321
+ <data type="ID"/>
322
+ </attribute>
323
+ <ref name="BasicBlock"/>
324
+ </element>
325
+ </define>
326
+ <define name="termsource">
327
+ <element name="termsource">
328
+ <attribute name="status">
329
+ <choice>
330
+ <value>identical</value>
331
+ <value>modified</value>
332
+ </choice>
333
+ </attribute>
334
+ <ref name="origin"/>
335
+ <optional>
336
+ <ref name="modification"/>
337
+ </optional>
338
+ </element>
339
+ </define>
340
+ <define name="origin">
341
+ <element name="origin">
342
+ <ref name="erefType"/>
343
+ </element>
344
+ </define>
345
+ <define name="modification">
346
+ <element name="modification">
347
+ <ref name="paragraph"/>
348
+ </element>
349
+ </define>
350
+ <define name="BasicBlock">
351
+ <choice>
352
+ <ref name="paragraph-with-footnote"/>
353
+ <ref name="table"/>
354
+ <ref name="formula"/>
355
+ <ref name="admonition"/>
356
+ <ref name="ol"/>
357
+ <ref name="ul"/>
358
+ <ref name="dl"/>
359
+ <ref name="figure"/>
360
+ <ref name="quote"/>
361
+ <ref name="sourcecode"/>
362
+ <ref name="example"/>
363
+ <ref name="review"/>
364
+ </choice>
365
+ </define>
366
+ <define name="paragraph">
367
+ <element name="p">
368
+ <ref name="ParagraphType"/>
369
+ </element>
370
+ </define>
371
+ <define name="Alignments">
372
+ <choice>
373
+ <value>left</value>
374
+ <value>right</value>
375
+ <value>center</value>
376
+ <value>justified</value>
377
+ </choice>
378
+ </define>
379
+ <define name="ParagraphType">
380
+ <attribute name="id">
381
+ <data type="ID"/>
382
+ </attribute>
383
+ <optional>
384
+ <attribute name="align">
385
+ <ref name="Alignments"/>
386
+ </attribute>
387
+ </optional>
388
+ <zeroOrMore>
389
+ <ref name="TextElement"/>
390
+ </zeroOrMore>
391
+ <zeroOrMore>
392
+ <ref name="note"/>
393
+ </zeroOrMore>
394
+ </define>
395
+ <define name="paragraph-with-footnote">
396
+ <element name="p">
397
+ <attribute name="id">
398
+ <data type="ID"/>
399
+ </attribute>
400
+ <optional>
401
+ <attribute name="align">
402
+ <ref name="Alignments"/>
403
+ </attribute>
404
+ </optional>
405
+ <zeroOrMore>
406
+ <choice>
407
+ <ref name="TextElement"/>
408
+ <ref name="fn"/>
409
+ </choice>
410
+ </zeroOrMore>
411
+ <zeroOrMore>
412
+ <ref name="note"/>
413
+ </zeroOrMore>
414
+ </element>
415
+ </define>
416
+ <define name="note">
417
+ <element name="note">
418
+ <attribute name="id">
419
+ <data type="ID"/>
420
+ </attribute>
421
+ <oneOrMore>
422
+ <ref name="paragraph-with-footnote"/>
423
+ </oneOrMore>
424
+ </element>
425
+ </define>
426
+ <define name="review">
427
+ <element name="review">
428
+ <attribute name="id">
429
+ <data type="ID"/>
430
+ </attribute>
431
+ <attribute name="reviewer"/>
432
+ <optional>
433
+ <attribute name="date">
434
+ <data type="date"/>
435
+ </attribute>
436
+ </optional>
437
+ <attribute name="from">
438
+ <data type="IDREF"/>
439
+ </attribute>
440
+ <optional>
441
+ <attribute name="to">
442
+ <data type="IDREF"/>
443
+ </attribute>
444
+ </optional>
445
+ <oneOrMore>
446
+ <ref name="paragraph"/>
447
+ </oneOrMore>
448
+ </element>
449
+ </define>
450
+ <define name="formula">
451
+ <element name="formula">
452
+ <attribute name="id">
453
+ <data type="ID"/>
454
+ </attribute>
455
+ <ref name="stem"/>
456
+ <optional>
457
+ <ref name="dl"/>
458
+ </optional>
459
+ <zeroOrMore>
460
+ <ref name="note"/>
461
+ </zeroOrMore>
462
+ </element>
463
+ </define>
464
+ <define name="quote">
465
+ <element name="quote">
466
+ <attribute name="id">
467
+ <data type="ID"/>
468
+ </attribute>
469
+ <optional>
470
+ <attribute name="alignment">
471
+ <ref name="Alignments"/>
472
+ </attribute>
473
+ </optional>
474
+ <ref name="quote-source"/>
475
+ <optional>
476
+ <ref name="quote-author"/>
477
+ </optional>
478
+ <oneOrMore>
479
+ <ref name="paragraph-with-footnote"/>
480
+ </oneOrMore>
481
+ <zeroOrMore>
482
+ <ref name="note"/>
483
+ </zeroOrMore>
484
+ </element>
485
+ </define>
486
+ <define name="quote-source">
487
+ <element name="source">
488
+ <ref name="erefType"/>
489
+ </element>
490
+ </define>
491
+ <define name="quote-author">
492
+ <element name="author">
493
+ <text/>
494
+ </element>
495
+ </define>
496
+ <define name="sourcecode">
497
+ <element name="sourcecode">
498
+ <attribute name="id">
499
+ <data type="ID"/>
500
+ </attribute>
501
+ <optional>
502
+ <ref name="tname"/>
503
+ </optional>
504
+ <oneOrMore>
505
+ <choice>
506
+ <text/>
507
+ <ref name="callout"/>
508
+ </choice>
509
+ </oneOrMore>
510
+ <zeroOrMore>
511
+ <ref name="annotation"/>
512
+ </zeroOrMore>
513
+ <zeroOrMore>
514
+ <ref name="note"/>
515
+ </zeroOrMore>
516
+ </element>
517
+ </define>
518
+ <define name="table">
519
+ <element name="table">
520
+ <attribute name="id">
521
+ <data type="ID"/>
522
+ </attribute>
523
+ <optional>
524
+ <ref name="tname"/>
525
+ </optional>
526
+ <optional>
527
+ <ref name="thead"/>
528
+ </optional>
529
+ <ref name="tbody"/>
530
+ <optional>
531
+ <ref name="tfoot"/>
532
+ </optional>
533
+ <zeroOrMore>
534
+ <ref name="table-note"/>
535
+ </zeroOrMore>
536
+ <optional>
537
+ <ref name="dl"/>
538
+ </optional>
539
+ </element>
540
+ </define>
541
+ <define name="tname">
542
+ <element name="name">
543
+ <text/>
544
+ </element>
545
+ </define>
546
+ <define name="thead">
547
+ <element name="thead">
548
+ <ref name="tr"/>
549
+ </element>
550
+ </define>
551
+ <define name="tfoot">
552
+ <element name="tfoot">
553
+ <ref name="tr"/>
554
+ </element>
555
+ </define>
556
+ <define name="tbody">
557
+ <element name="tbody">
558
+ <oneOrMore>
559
+ <ref name="tr"/>
560
+ </oneOrMore>
561
+ </element>
562
+ </define>
563
+ <define name="table-note">
564
+ <element name="note">
565
+ <ref name="paragraph"/>
566
+ </element>
567
+ </define>
568
+ <define name="tr">
569
+ <element name="tr">
570
+ <oneOrMore>
571
+ <choice>
572
+ <ref name="td"/>
573
+ <ref name="th"/>
574
+ </choice>
575
+ </oneOrMore>
576
+ </element>
577
+ </define>
578
+ <define name="td">
579
+ <element name="td">
580
+ <optional>
581
+ <attribute name="colspan"/>
582
+ </optional>
583
+ <optional>
584
+ <attribute name="rowspan"/>
585
+ </optional>
586
+ <optional>
587
+ <attribute name="align">
588
+ <choice>
589
+ <value>left</value>
590
+ <value>right</value>
591
+ <value>center</value>
592
+ </choice>
593
+ </attribute>
594
+ </optional>
595
+ <choice>
596
+ <zeroOrMore>
597
+ <ref name="TextElement"/>
598
+ </zeroOrMore>
599
+ <oneOrMore>
600
+ <ref name="paragraph-with-footnote"/>
601
+ </oneOrMore>
602
+ </choice>
603
+ </element>
604
+ </define>
605
+ <define name="th">
606
+ <element name="th">
607
+ <optional>
608
+ <attribute name="colspan"/>
609
+ </optional>
610
+ <optional>
611
+ <attribute name="rowspan"/>
612
+ </optional>
613
+ <optional>
614
+ <attribute name="align">
615
+ <choice>
616
+ <value>left</value>
617
+ <value>right</value>
618
+ <value>center</value>
619
+ </choice>
620
+ </attribute>
621
+ </optional>
622
+ <choice>
623
+ <zeroOrMore>
624
+ <ref name="TextElement"/>
625
+ </zeroOrMore>
626
+ <oneOrMore>
627
+ <ref name="paragraph-with-footnote"/>
628
+ </oneOrMore>
629
+ </choice>
630
+ </element>
631
+ </define>
632
+ <define name="example">
633
+ <element name="example">
634
+ <attribute name="id">
635
+ <data type="ID"/>
636
+ </attribute>
637
+ <oneOrMore>
638
+ <choice>
639
+ <ref name="formula"/>
640
+ <ref name="ul"/>
641
+ <ref name="ol"/>
642
+ <ref name="dl"/>
643
+ <ref name="quote"/>
644
+ <ref name="sourcecode"/>
645
+ <ref name="paragraph-with-footnote"/>
646
+ </choice>
647
+ </oneOrMore>
648
+ <zeroOrMore>
649
+ <ref name="note"/>
650
+ </zeroOrMore>
651
+ </element>
652
+ </define>
653
+ <define name="admonition">
654
+ <element name="admonition">
655
+ <attribute name="type">
656
+ <choice>
657
+ <value>warning</value>
658
+ <value>note</value>
659
+ <value>tip</value>
660
+ <value>important</value>
661
+ <value>caution</value>
662
+ </choice>
663
+ </attribute>
664
+ <attribute name="id">
665
+ <data type="ID"/>
666
+ </attribute>
667
+ <zeroOrMore>
668
+ <ref name="paragraph-with-footnote"/>
669
+ </zeroOrMore>
670
+ <zeroOrMore>
671
+ <ref name="note"/>
672
+ </zeroOrMore>
673
+ </element>
674
+ </define>
675
+ <define name="figure">
676
+ <element name="figure">
677
+ <attribute name="id">
678
+ <data type="ID"/>
679
+ </attribute>
680
+ <optional>
681
+ <ref name="source"/>
682
+ </optional>
683
+ <optional>
684
+ <ref name="tname"/>
685
+ </optional>
686
+ <choice>
687
+ <oneOrMore>
688
+ <ref name="figure"/>
689
+ </oneOrMore>
690
+ <group>
691
+ <zeroOrMore>
692
+ <ref name="TextElement"/>
693
+ </zeroOrMore>
694
+ <zeroOrMore>
695
+ <ref name="note"/>
696
+ </zeroOrMore>
697
+ <optional>
698
+ <ref name="dl"/>
699
+ </optional>
700
+ </group>
701
+ </choice>
702
+ </element>
703
+ </define>
704
+ <define name="TextElement">
705
+ <choice>
706
+ <text/>
707
+ <ref name="em"/>
708
+ <ref name="eref"/>
709
+ <ref name="strong"/>
710
+ <ref name="stem"/>
711
+ <ref name="sub"/>
712
+ <ref name="sup"/>
713
+ <ref name="tt"/>
714
+ <ref name="strike"/>
715
+ <ref name="smallcap"/>
716
+ <ref name="xref"/>
717
+ <ref name="br"/>
718
+ <ref name="hyperlink"/>
719
+ <ref name="hr"/>
720
+ <ref name="pagebreak"/>
721
+ <ref name="bookmark"/>
722
+ </choice>
723
+ </define>
724
+ <define name="em">
725
+ <element name="em">
726
+ <text/>
727
+ </element>
728
+ </define>
729
+ <define name="strong">
730
+ <element name="strong">
731
+ <text/>
732
+ </element>
733
+ </define>
734
+ <define name="tt">
735
+ <element name="tt">
736
+ <text/>
737
+ </element>
738
+ </define>
739
+ <define name="sub">
740
+ <element name="sub">
741
+ <text/>
742
+ </element>
743
+ </define>
744
+ <define name="sup">
745
+ <element name="sup">
746
+ <text/>
747
+ </element>
748
+ </define>
749
+ <define name="strike">
750
+ <element name="strike">
751
+ <text/>
752
+ </element>
753
+ </define>
754
+ <define name="smallcap">
755
+ <element name="smallcap">
756
+ <text/>
757
+ </element>
758
+ </define>
759
+ <define name="br">
760
+ <element name="br">
761
+ <empty/>
762
+ </element>
763
+ </define>
764
+ <define name="hr">
765
+ <element name="hr">
766
+ <empty/>
767
+ </element>
768
+ </define>
769
+ <define name="pagebreak">
770
+ <element name="pagebreak">
771
+ <empty/>
772
+ </element>
773
+ </define>
774
+ <!-- bare ID element, used for referencing arbitrary spans of text -->
775
+ <define name="bookmark">
776
+ <element name="bookmark">
777
+ <attribute name="id">
778
+ <data type="ID"/>
779
+ </attribute>
780
+ <empty/>
781
+ </element>
782
+ </define>
783
+ <define name="ReferenceFormat">
784
+ <choice>
785
+ <value>external</value>
786
+ <value>inline</value>
787
+ <value>footnote</value>
788
+ <value>callout</value>
789
+ </choice>
790
+ </define>
791
+ <define name="eref">
792
+ <element name="eref">
793
+ <ref name="erefType"/>
794
+ </element>
795
+ </define>
796
+ <define name="erefType">
797
+ <optional>
798
+ <attribute name="normative">
799
+ <data type="boolean"/>
800
+ </attribute>
801
+ </optional>
802
+ <attribute name="citeas"/>
803
+ <attribute name="type">
804
+ <ref name="ReferenceFormat"/>
805
+ </attribute>
806
+ <ref name="CitationType"/>
807
+ <text/>
808
+ </define>
809
+ <define name="hyperlink">
810
+ <element name="link">
811
+ <attribute name="target">
812
+ <data type="anyURI"/>
813
+ </attribute>
814
+ <attribute name="type">
815
+ <ref name="ReferenceFormat"/>
816
+ </attribute>
817
+ <text/>
818
+ </element>
819
+ </define>
820
+ <define name="xref">
821
+ <element name="xref">
822
+ <attribute name="target">
823
+ <data type="IDREF"/>
824
+ </attribute>
825
+ <attribute name="type">
826
+ <ref name="ReferenceFormat"/>
827
+ </attribute>
828
+ <text/>
829
+ </element>
830
+ </define>
831
+ <define name="fn">
832
+ <element name="fn">
833
+ <attribute name="reference"/>
834
+ <oneOrMore>
835
+ <ref name="paragraph"/>
836
+ </oneOrMore>
837
+ </element>
838
+ </define>
839
+ <!--
840
+ This is xref with fixed @type="footnote", and @target built in as paragraph+
841
+ @reference replaces ReferenceElement/text
842
+ so <fn reference="2"><p>This is a footnote</p></fn>
843
+ corresponds to
844
+ <eref type="footnote" target="fn2">2</xref> <p id="fn2">This is a footnote</p>
845
+ -->
846
+ <define name="callout">
847
+ <element name="callout">
848
+ <attribute name="target">
849
+ <data type="IDREF"/>
850
+ </attribute>
851
+ <text/>
852
+ </element>
853
+ </define>
854
+ <!--
855
+ This is xref with fixed @type="callout"; the target by convention is in an annotation in the same source code snippet
856
+ so <callout target="xyz">1</callout>
857
+ corresponds to <xref type="callout" target="xyz">1</xref>
858
+ -->
859
+ <define name="image">
860
+ <element name="image">
861
+ <attribute name="id">
862
+ <data type="ID"/>
863
+ </attribute>
864
+ <optional>
865
+ <attribute name="src">
866
+ <data type="anyURI"/>
867
+ </attribute>
868
+ </optional>
869
+ <attribute name="imagetype">
870
+ <choice>
871
+ <value>SVG</value>
872
+ <value>JPEG</value>
873
+ <value>GIF</value>
874
+ <value>PNG</value>
875
+ <value>PDF</value>
876
+ </choice>
877
+ </attribute>
878
+ <optional>
879
+ <attribute name="width">
880
+ <data type="int"/>
881
+ </attribute>
882
+ </optional>
883
+ <optional>
884
+ <attribute name="height">
885
+ <data type="int"/>
886
+ </attribute>
887
+ </optional>
888
+ </element>
889
+ </define>
890
+ <define name="stem">
891
+ <element name="stem">
892
+ <attribute name="type">
893
+ <choice>
894
+ <value>MathML</value>
895
+ <value>AsciiMath</value>
896
+ </choice>
897
+ </attribute>
898
+ <text/>
899
+ </element>
900
+ </define>
901
+ <define name="annotation">
902
+ <element name="annotation">
903
+ <attribute name="id">
904
+ <data type="ID"/>
905
+ </attribute>
906
+ <ref name="paragraph"/>
907
+ </element>
908
+ </define>
909
+ <define name="ul">
910
+ <element name="ul">
911
+ <attribute name="id">
912
+ <data type="ID"/>
913
+ </attribute>
914
+ <oneOrMore>
915
+ <ref name="li"/>
916
+ </oneOrMore>
917
+ <zeroOrMore>
918
+ <ref name="note"/>
919
+ </zeroOrMore>
920
+ </element>
921
+ </define>
922
+ <define name="li">
923
+ <element name="li">
924
+ <oneOrMore>
925
+ <ref name="paragraph-with-footnote"/>
926
+ </oneOrMore>
927
+ </element>
928
+ </define>
929
+ <define name="ol">
930
+ <element name="ol">
931
+ <attribute name="id">
932
+ <data type="ID"/>
933
+ </attribute>
934
+ <attribute name="type">
935
+ <choice>
936
+ <value>roman</value>
937
+ <value>alphabet</value>
938
+ <value>arabic</value>
939
+ <value>roman_upper</value>
940
+ <value>alphabet_upper</value>
941
+ </choice>
942
+ </attribute>
943
+ <oneOrMore>
944
+ <ref name="li"/>
945
+ </oneOrMore>
946
+ <zeroOrMore>
947
+ <ref name="note"/>
948
+ </zeroOrMore>
949
+ </element>
950
+ </define>
951
+ <define name="dl">
952
+ <element name="dl">
953
+ <attribute name="id">
954
+ <data type="ID"/>
955
+ </attribute>
956
+ <oneOrMore>
957
+ <ref name="dt"/>
958
+ <ref name="dd"/>
959
+ </oneOrMore>
960
+ <zeroOrMore>
961
+ <ref name="note"/>
962
+ </zeroOrMore>
963
+ </element>
964
+ </define>
965
+ <define name="dt">
966
+ <element name="dt">
967
+ <ref name="TextElement"/>
968
+ </element>
969
+ </define>
970
+ <define name="dd">
971
+ <element name="dd">
972
+ <zeroOrMore>
973
+ <ref name="paragraph-with-footnote"/>
974
+ </zeroOrMore>
975
+ </element>
976
+ </define>
977
+ <define name="LocalizedString">
978
+ <optional>
979
+ <!-- multiple languages and scripts possible: comma delimit them if so -->
980
+ <attribute name="language"/>
981
+ </optional>
982
+ <optional>
983
+ <attribute name="script"/>
984
+ </optional>
985
+ <text/>
986
+ </define>
987
+ <!--
988
+ Unlike UML, change type to format: type is overloaded
989
+ Would be need if plain were default value and could omit the attribute
990
+ Added LocalizedStringOrXsAny
991
+ -->
992
+ <define name="FormattedString">
993
+ <optional>
994
+ <!-- attribute format { ( "plain" | "html" | "docbook" | "tei" | "asciidoc" | "markdown" ) }?, -->
995
+ <attribute name="format">
996
+ <choice>
997
+ <value>text/plain</value>
998
+ <value>text/html</value>
999
+ <value>application/docbook+xml</value>
1000
+ <value>application/tei+xml</value>
1001
+ <value>text/x-asciidoc</value>
1002
+ <value>text/markdown</value>
1003
+ <value>application/x-isodoc+xml</value>
1004
+ <text/>
1005
+ </choice>
1006
+ </attribute>
1007
+ </optional>
1008
+ <ref name="LocalizedStringOrXsAny"/>
1009
+ </define>
1010
+ <define name="LocalizedStringOrXsAny">
1011
+ <optional>
1012
+ <!-- multiple languages and scripts possible: comma delimit them if so -->
1013
+ <attribute name="language"/>
1014
+ </optional>
1015
+ <optional>
1016
+ <attribute name="script"/>
1017
+ </optional>
1018
+ <oneOrMore>
1019
+ <choice>
1020
+ <text/>
1021
+ <ref name="AnyElement"/>
1022
+ </choice>
1023
+ </oneOrMore>
1024
+ </define>
1025
+ <define name="contributor">
1026
+ <element name="contributor">
1027
+ <zeroOrMore>
1028
+ <ref name="role"/>
1029
+ </zeroOrMore>
1030
+ <ref name="ContributorInfo"/>
1031
+ </element>
1032
+ </define>
1033
+ <define name="role">
1034
+ <element name="role">
1035
+ <optional>
1036
+ <attribute name="type">
1037
+ <choice>
1038
+ <value>author</value>
1039
+ <value>edition</value>
1040
+ <value>publisher</value>
1041
+ <text/>
1042
+ </choice>
1043
+ </attribute>
1044
+ </optional>
1045
+ <zeroOrMore>
1046
+ <ref name="roledescription"/>
1047
+ </zeroOrMore>
1048
+ </element>
1049
+ </define>
1050
+ <define name="ContributorInfo">
1051
+ <choice>
1052
+ <ref name="person"/>
1053
+ <ref name="organization"/>
1054
+ </choice>
1055
+ </define>
1056
+ <define name="roledescription">
1057
+ <element name="description">
1058
+ <ref name="FormattedString"/>
1059
+ </element>
1060
+ </define>
1061
+ <define name="person">
1062
+ <element name="person">
1063
+ <optional>
1064
+ <ref name="fullname"/>
1065
+ </optional>
1066
+ <zeroOrMore>
1067
+ <ref name="affiliation"/>
1068
+ </zeroOrMore>
1069
+ <zeroOrMore>
1070
+ <ref name="person-identifier"/>
1071
+ </zeroOrMore>
1072
+ <zeroOrMore>
1073
+ <ref name="contact"/>
1074
+ </zeroOrMore>
1075
+ <optional>
1076
+ <ref name="uri"/>
1077
+ </optional>
1078
+ </element>
1079
+ </define>
1080
+ <define name="fullname">
1081
+ <element name="name">
1082
+ <zeroOrMore>
1083
+ <ref name="prefix"/>
1084
+ </zeroOrMore>
1085
+ <zeroOrMore>
1086
+ <ref name="forename"/>
1087
+ </zeroOrMore>
1088
+ <zeroOrMore>
1089
+ <ref name="initial"/>
1090
+ </zeroOrMore>
1091
+ <ref name="surname"/>
1092
+ <zeroOrMore>
1093
+ <ref name="addition"/>
1094
+ </zeroOrMore>
1095
+ </element>
1096
+ </define>
1097
+ <define name="prefix">
1098
+ <element name="prefix">
1099
+ <ref name="LocalizedString"/>
1100
+ </element>
1101
+ </define>
1102
+ <define name="initial">
1103
+ <element name="initial">
1104
+ <ref name="LocalizedString"/>
1105
+ </element>
1106
+ </define>
1107
+ <define name="addition">
1108
+ <element name="addition">
1109
+ <ref name="LocalizedString"/>
1110
+ </element>
1111
+ </define>
1112
+ <define name="surname">
1113
+ <element name="surname">
1114
+ <ref name="LocalizedString"/>
1115
+ </element>
1116
+ </define>
1117
+ <define name="forename">
1118
+ <element name="forename">
1119
+ <ref name="LocalizedString"/>
1120
+ </element>
1121
+ </define>
1122
+ <define name="affiliation">
1123
+ <element name="affiliation">
1124
+ <optional>
1125
+ <ref name="affiliationname"/>
1126
+ </optional>
1127
+ <zeroOrMore>
1128
+ <ref name="affiliationdescription"/>
1129
+ </zeroOrMore>
1130
+ <ref name="organization"/>
1131
+ </element>
1132
+ </define>
1133
+ <define name="affiliationname">
1134
+ <element name="name">
1135
+ <ref name="LocalizedString"/>
1136
+ </element>
1137
+ </define>
1138
+ <define name="affiliationdescription">
1139
+ <element name="description">
1140
+ <ref name="FormattedString"/>
1141
+ </element>
1142
+ </define>
1143
+ <define name="organization">
1144
+ <element name="organization">
1145
+ <ref name="orgname"/>
1146
+ <optional>
1147
+ <ref name="uri"/>
1148
+ </optional>
1149
+ <zeroOrMore>
1150
+ <ref name="org-identifier"/>
1151
+ </zeroOrMore>
1152
+ <zeroOrMore>
1153
+ <ref name="contact"/>
1154
+ </zeroOrMore>
1155
+ </element>
1156
+ </define>
1157
+ <define name="orgname">
1158
+ <element name="name">
1159
+ <ref name="LocalizedString"/>
1160
+ </element>
1161
+ </define>
1162
+ <define name="uri">
1163
+ <element name="uri">
1164
+ <data type="anyURI"/>
1165
+ </element>
1166
+ </define>
1167
+ <!-- TODO may change -->
1168
+ <define name="contact">
1169
+ <choice>
1170
+ <ref name="address"/>
1171
+ <ref name="phone"/>
1172
+ <ref name="email"/>
1173
+ <ref name="uri"/>
1174
+ </choice>
1175
+ </define>
1176
+ <define name="phone">
1177
+ <element name="phone">
1178
+ <text/>
1179
+ </element>
1180
+ </define>
1181
+ <define name="email">
1182
+ <element name="email">
1183
+ <text/>
1184
+ </element>
1185
+ </define>
1186
+ <define name="address">
1187
+ <element name="address">
1188
+ <oneOrMore>
1189
+ <!-- iso191606 TODO -->
1190
+ <ref name="street"/>
1191
+ </oneOrMore>
1192
+ <ref name="city"/>
1193
+ <optional>
1194
+ <ref name="state"/>
1195
+ </optional>
1196
+ <ref name="country"/>
1197
+ <optional>
1198
+ <ref name="postcode"/>
1199
+ </optional>
1200
+ </element>
1201
+ </define>
1202
+ <define name="street">
1203
+ <element name="street">
1204
+ <text/>
1205
+ </element>
1206
+ </define>
1207
+ <define name="city">
1208
+ <element name="city">
1209
+ <text/>
1210
+ </element>
1211
+ </define>
1212
+ <define name="state">
1213
+ <element name="state">
1214
+ <text/>
1215
+ </element>
1216
+ </define>
1217
+ <define name="country">
1218
+ <element name="country">
1219
+ <text/>
1220
+ </element>
1221
+ </define>
1222
+ <define name="postcode">
1223
+ <element name="postcode">
1224
+ <text/>
1225
+ </element>
1226
+ </define>
1227
+ <define name="person-identifier">
1228
+ <element name="identifier">
1229
+ <attribute name="type">
1230
+ <choice>
1231
+ <value>isni</value>
1232
+ <value>uri</value>
1233
+ </choice>
1234
+ </attribute>
1235
+ <text/>
1236
+ </element>
1237
+ </define>
1238
+ <define name="org-identifier">
1239
+ <element name="identifier">
1240
+ <attribute name="type">
1241
+ <choice>
1242
+ <value>orcid</value>
1243
+ <value>uri</value>
1244
+ </choice>
1245
+ </attribute>
1246
+ <text/>
1247
+ </element>
1248
+ </define>
1249
+ <define name="citation">
1250
+ <element name="citation">
1251
+ <ref name="CitationType"/>
1252
+ </element>
1253
+ </define>
1254
+ <define name="CitationType">
1255
+ <attribute name="bibitemid">
1256
+ <data type="IDREF"/>
1257
+ </attribute>
1258
+ <zeroOrMore>
1259
+ <ref name="locality"/>
1260
+ </zeroOrMore>
1261
+ <optional>
1262
+ <ref name="date"/>
1263
+ </optional>
1264
+ </define>
1265
+ <define name="date">
1266
+ <element name="date">
1267
+ <choice>
1268
+ <data type="gYear"/>
1269
+ <data type="date"/>
1270
+ </choice>
1271
+ </element>
1272
+ </define>
1273
+ <define name="locality">
1274
+ <element name="locality">
1275
+ <attribute name="type">
1276
+ <choice>
1277
+ <value>section</value>
1278
+ <value>clause</value>
1279
+ <value>part</value>
1280
+ <value>paragraph</value>
1281
+ <value>chapter</value>
1282
+ <value>page</value>
1283
+ <value>whole</value>
1284
+ </choice>
1285
+ </attribute>
1286
+ <zeroOrMore>
1287
+ <ref name="localityreference"/>
1288
+ </zeroOrMore>
1289
+ </element>
1290
+ </define>
1291
+ <define name="localityreference">
1292
+ <element name="reference">
1293
+ <text/>
1294
+ </element>
1295
+ </define>
1296
+ <!-- unlike UML, has id attribute; that results from including bibitem in a docmodel -->
1297
+ <define name="bibitem">
1298
+ <element name="bibitem">
1299
+ <attribute name="id">
1300
+ <data type="ID"/>
1301
+ </attribute>
1302
+ <ref name="BibliographicItem"/>
1303
+ </element>
1304
+ </define>
1305
+ <define name="BibItemType" combine="choice">
1306
+ <choice>
1307
+ <value>article</value>
1308
+ <value>book</value>
1309
+ <value>booklet</value>
1310
+ <value>conference</value>
1311
+ <value>manual</value>
1312
+ <value>proceedings</value>
1313
+ <value>presentation</value>
1314
+ <value>thesis</value>
1315
+ <value>techreport</value>
1316
+ <value>standard</value>
1317
+ <value>unpublished</value>
1318
+ </choice>
1319
+ </define>
1320
+ <define name="BibliographicItem">
1321
+ <optional>
1322
+ <attribute name="type">
1323
+ <ref name="BibItemType"/>
1324
+ </attribute>
1325
+ </optional>
1326
+ <choice>
1327
+ <oneOrMore>
1328
+ <ref name="btitle"/>
1329
+ </oneOrMore>
1330
+ <ref name="formattedref"/>
1331
+ </choice>
1332
+ <optional>
1333
+ <ref name="source"/>
1334
+ </optional>
1335
+ <zeroOrMore>
1336
+ <ref name="docidentifier"/>
1337
+ </zeroOrMore>
1338
+ <zeroOrMore>
1339
+ <ref name="bdate"/>
1340
+ </zeroOrMore>
1341
+ <zeroOrMore>
1342
+ <ref name="contributor"/>
1343
+ </zeroOrMore>
1344
+ <optional>
1345
+ <ref name="edition"/>
1346
+ </optional>
1347
+ <zeroOrMore>
1348
+ <ref name="biblionote"/>
1349
+ </zeroOrMore>
1350
+ <zeroOrMore>
1351
+ <ref name="partof"/>
1352
+ </zeroOrMore>
1353
+ <zeroOrMore>
1354
+ <ref name="language"/>
1355
+ </zeroOrMore>
1356
+ <zeroOrMore>
1357
+ <ref name="script"/>
1358
+ </zeroOrMore>
1359
+ <optional>
1360
+ <ref name="abstract"/>
1361
+ </optional>
1362
+ <optional>
1363
+ <ref name="status"/>
1364
+ </optional>
1365
+ <optional>
1366
+ <ref name="copyright"/>
1367
+ </optional>
1368
+ </define>
1369
+ <define name="BibData">
1370
+ <optional>
1371
+ <attribute name="type">
1372
+ <ref name="BibItemType"/>
1373
+ </attribute>
1374
+ </optional>
1375
+ <oneOrMore>
1376
+ <ref name="btitle"/>
1377
+ </oneOrMore>
1378
+ <optional>
1379
+ <ref name="formattedref"/>
1380
+ </optional>
1381
+ <optional>
1382
+ <ref name="source"/>
1383
+ </optional>
1384
+ <zeroOrMore>
1385
+ <ref name="docidentifier"/>
1386
+ </zeroOrMore>
1387
+ <zeroOrMore>
1388
+ <ref name="bdate"/>
1389
+ </zeroOrMore>
1390
+ <zeroOrMore>
1391
+ <ref name="contributor"/>
1392
+ </zeroOrMore>
1393
+ <optional>
1394
+ <ref name="edition"/>
1395
+ </optional>
1396
+ <zeroOrMore>
1397
+ <ref name="biblionote"/>
1398
+ </zeroOrMore>
1399
+ <zeroOrMore>
1400
+ <ref name="partof"/>
1401
+ </zeroOrMore>
1402
+ <zeroOrMore>
1403
+ <ref name="language"/>
1404
+ </zeroOrMore>
1405
+ <zeroOrMore>
1406
+ <ref name="script"/>
1407
+ </zeroOrMore>
1408
+ <optional>
1409
+ <ref name="abstract"/>
1410
+ </optional>
1411
+ <optional>
1412
+ <ref name="status"/>
1413
+ </optional>
1414
+ <ref name="copyright"/>
1415
+ </define>
1416
+ <define name="btitle">
1417
+ <element name="title">
1418
+ <ref name="FormattedString"/>
1419
+ </element>
1420
+ </define>
1421
+ <define name="formattedref">
1422
+ <element name="formattedref">
1423
+ <ref name="FormattedString"/>
1424
+ </element>
1425
+ </define>
1426
+ <define name="source">
1427
+ <element name="source">
1428
+ <data type="anyURI"/>
1429
+ </element>
1430
+ </define>
1431
+ <define name="bdate">
1432
+ <element name="date">
1433
+ <attribute name="type">
1434
+ <choice>
1435
+ <value>published</value>
1436
+ <value>accessed</value>
1437
+ <value>created</value>
1438
+ <value>activated</value>
1439
+ <value>obsoleted</value>
1440
+ </choice>
1441
+ </attribute>
1442
+ <choice>
1443
+ <data type="gYear"/>
1444
+ <data type="date"/>
1445
+ </choice>
1446
+ </element>
1447
+ </define>
1448
+ <define name="docidentifier">
1449
+ <element name="docidentifier">
1450
+ <optional>
1451
+ <attribute name="type"/>
1452
+ </optional>
1453
+ <text/>
1454
+ </element>
1455
+ </define>
1456
+ <define name="biblionote">
1457
+ <element name="note">
1458
+ <ref name="FormattedString"/>
1459
+ </element>
1460
+ </define>
1461
+ <define name="abstract">
1462
+ <element name="abstract">
1463
+ <ref name="FormattedString"/>
1464
+ </element>
1465
+ </define>
1466
+ <define name="partof">
1467
+ <element name="partof">
1468
+ <ref name="BibliographicItem"/>
1469
+ </element>
1470
+ </define>
1471
+ <define name="copyright">
1472
+ <element name="copyright">
1473
+ <ref name="from"/>
1474
+ <optional>
1475
+ <ref name="to"/>
1476
+ </optional>
1477
+ <ref name="owner"/>
1478
+ </element>
1479
+ </define>
1480
+ <define name="from">
1481
+ <element name="from">
1482
+ <data type="gYear"/>
1483
+ </element>
1484
+ </define>
1485
+ <define name="to">
1486
+ <element name="to">
1487
+ <data type="gYear"/>
1488
+ </element>
1489
+ </define>
1490
+ <define name="owner">
1491
+ <element name="owner">
1492
+ <ref name="ContributorInfo"/>
1493
+ </element>
1494
+ </define>
1495
+ <!--
1496
+ Anycontents = mixed {
1497
+ https://github.com/relaxng/jing-trang/issues/211
1498
+ https://lists.oasis-open.org/archives/office/200808/msg00024.html
1499
+ https://lists.oasis-open.org/archives/office/200808/msg00099.html
1500
+ For this to work, we will actually strip any attributes in the Anycontents before
1501
+ passing it for validation. Horrible I know, but there are no good alternatives
1502
+ that also allow us to do grammar inheritance
1503
+ (attribute * { text } | Any)*
1504
+ Any*
1505
+ }
1506
+ -->
1507
+ <define name="AnyElement">
1508
+ <element>
1509
+ <anyName/>
1510
+ <choice>
1511
+ <text/>
1512
+ <ref name="AnyElement"/>
1513
+ </choice>
1514
+ </element>
1515
+ </define>
1516
+ </grammar>