asciidoctor-iso 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ff84c9af977a9b2adf3922bca65699f511b6d8c
4
- data.tar.gz: b947358c67928d815d674c49b6aeed1d813b20f0
3
+ metadata.gz: 58f094fee040fe809c10907c121a5f57a49eb298
4
+ data.tar.gz: ab697dc58b43802eaa4a8b7ed684a7230c7dac75
5
5
  SHA512:
6
- metadata.gz: 3332e2fde234aab645e965644750bc650acfe94b590eb090358fc2ede5683ca54940f8f9bc81dedca11007fe6a6da4abeb57c4b9ed5ef021cbf185af21d60ff0
7
- data.tar.gz: 8aba7335bf894058658fb2511812a01d65dd3a0d9a9b0ce7d65ebcaf6b4506f96636a0d22dd5a612cfede9d78117226ec6fcfeb1d1e02d7d61bb3676e20d4145
6
+ metadata.gz: 62485082baccb11b5a2c494f2326972c526ae62a75487e8392a8f79fd1df08392ec61aae09fe37c5830dfc65f1e82d9b382ca572489d2136cea10595be36b17b
7
+ data.tar.gz: 7d6f0b924bdc4cd14b97e21c73ebb917e3d33485809afee917a09c9d21b331e3848b40e3257f7815140ce360e9ac854050f20609b01ac6fe219e6d59d32e5827
@@ -14,7 +14,7 @@ GIT
14
14
 
15
15
  GIT
16
16
  remote: https://github.com/riboseinc/isodoc.git
17
- revision: 99f7eecc594e3763d98b60382588fae8e59fa0c0
17
+ revision: e84b3385acf7d6eb025d80756080a1610efc43da
18
18
  specs:
19
19
  isodoc (0.5.7)
20
20
  asciimath
@@ -32,20 +32,21 @@ GIT
32
32
  PATH
33
33
  remote: .
34
34
  specs:
35
- asciidoctor-iso (0.7.2)
35
+ asciidoctor-iso (0.7.3)
36
36
  asciidoctor (~> 1.5.6)
37
37
  html2doc
38
38
  htmlentities (~> 4.3.4)
39
39
  isodoc
40
40
  nokogiri
41
41
  ruby-jing
42
+ sass
42
43
  thread_safe
43
44
  uuidtools
44
45
 
45
46
  GEM
46
47
  remote: https://rubygems.org/
47
48
  specs:
48
- asciidoctor (1.5.6.1)
49
+ asciidoctor (1.5.6.2)
49
50
  asciimath (1.0.4)
50
51
  ast (2.4.0)
51
52
  byebug (9.1.0)
@@ -129,6 +130,11 @@ GEM
129
130
  ruby-progressbar (1.9.0)
130
131
  ruby-xslt (0.9.10)
131
132
  ruby_dep (1.5.0)
133
+ sass (3.5.6)
134
+ sass-listen (~> 4.0.0)
135
+ sass-listen (4.0.0)
136
+ rb-fsevent (~> 0.9, >= 0.9.4)
137
+ rb-inotify (~> 0.9, >= 0.9.7)
132
138
  shellany (0.0.1)
133
139
  simplecov (0.16.1)
134
140
  docile (~> 1.1)
@@ -526,6 +526,8 @@ is available at link:spec/examples/english.yaml[].
526
526
  `:copyright-year:`:: The year which will be claimed as when the copyright for
527
527
  the document was issued
528
528
 
529
+ `:library-ics:` :: The ICS (International Categorization for Standards) number for the standard. There may be more than one ICS for a document; if so, they should be comma-delimited. (The ics identifier is added to the document metadata, but is not output to the current document templates.)
530
+
529
531
  `:title-intro-en:`:: The introductory component of the English title of the
530
532
  document
531
533
 
@@ -557,6 +559,9 @@ https://www.iso.org/stage-codes.html[International harmonized stage codes])
557
559
  `:docsubstage:`:: The substage code for the document status (see
558
560
  https://www.iso.org/stage-codes.html[International harmonized stage codes])
559
561
 
562
+ `:iteration:`:: The iteration of a stage, in case there have been multiple drafts
563
+ (e.g. `2` on a `CD`: this is the second iteration through the `CD` stage).
564
+
560
565
  `:secretariat:`:: The national body acting as the secretariat for the document
561
566
  in the deafting stage
562
567
 
@@ -592,6 +597,15 @@ not supplied. Example values: `JWG`, `JAG`, `AG` (advisory group), `AHG`, `SWG`,
592
597
  `:publisher:`:: The standards agency publishing the standard; can be multiple
593
598
  (comma-delimited). Defaults to `ISO`.
594
599
 
600
+ `:body-font:`:: Font for body text; will be inserted into CSS. Defaults to
601
+ Cambria for Latin script, SimSun for Simplified Chinese.
602
+
603
+ `:header-font:`:: Font for headers; will be inserted into CSS. Defaults to
604
+ Cambria for Latin script, SimHei for Simplified Chinese.
605
+
606
+ `:monospace-font`:: Font for monospace; will be inserted into CSS. Defaults to
607
+ Courier New.
608
+
595
609
  The attribute `:draft:`, if present, includes review notes in the XML output;
596
610
  these are otherwise suppressed.
597
611
 
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "nokogiri"
33
33
  spec.add_dependency "ruby-jing"
34
34
  spec.add_dependency "thread_safe"
35
+ spec.add_dependency "sass"
35
36
  spec.add_dependency "uuidtools"
36
37
  spec.add_dependency "html2doc"
37
38
  spec.add_dependency "isodoc"
@@ -5,6 +5,7 @@ require "json"
5
5
  require "pathname"
6
6
  require "open-uri"
7
7
  require "pp"
8
+ require "sass"
8
9
  require "isodoc"
9
10
 
10
11
  module Asciidoctor
@@ -31,10 +32,19 @@ module Asciidoctor
31
32
  File.join(File.dirname(__FILE__), File.join("html", file))
32
33
  end
33
34
 
35
+ def generate_css(filename, stripwordcss)
36
+ stylesheet = File.read(filename, encoding: "UTF-8")
37
+ stylesheet = stylesheet.gsub(/(\s|\{)mso-[^:]+:[^;]+;/m, "\\1") if stripwordcss
38
+ engine = Sass::Engine.new(@fontheader + stylesheet, syntax: :scss)
39
+ outname = File.basename(filename, ".*") + ".css"
40
+ File.open(outname, "w") { |f| f.write(engine.render) }
41
+ outname
42
+ end
43
+
34
44
  def html_converter(node)
35
45
  IsoDoc::Convert.new(
36
- htmlstylesheet: html_doc_path("htmlstyle.css"),
37
- standardstylesheet: html_doc_path("isodoc.css"),
46
+ htmlstylesheet: generate_css(html_doc_path("htmlstyle.scss"), true),
47
+ standardstylesheet: generate_css(html_doc_path("isodoc.scss"), true),
38
48
  htmlcoverpage: html_doc_path("html_iso_titlepage.html"),
39
49
  htmlintropage: html_doc_path("html_iso_intro.html"),
40
50
  i18nyaml: node.attr("i18nyaml"),
@@ -43,8 +53,8 @@ module Asciidoctor
43
53
 
44
54
  def doc_converter(node)
45
55
  IsoDoc::WordConvert.new(
46
- wordstylesheet: html_doc_path("wordstyle.css"),
47
- standardstylesheet: html_doc_path("isodoc.css"),
56
+ wordstylesheet: generate_css(html_doc_path("wordstyle.scss"), false),
57
+ standardstylesheet: generate_css(html_doc_path("isodoc.scss"), false),
48
58
  header: html_doc_path("header.html"),
49
59
  wordcoverpage: html_doc_path("word_iso_titlepage.html"),
50
60
  wordintropage: html_doc_path("word_iso_intro.html"),
@@ -61,6 +71,18 @@ module Asciidoctor
61
71
  @anchors = {}
62
72
  @draft = node.attributes.has_key?("draft")
63
73
  @novalid = node.attr("novalid")
74
+ @fontheader = default_fonts(node)
75
+ end
76
+
77
+ def default_fonts(node)
78
+ b = node.attr("body-font") ||
79
+ (node.attr("script") == "Hans" ? '"SimSun",serif' :
80
+ '"Cambria",serif')
81
+ h = node.attr("header-font") ||
82
+ (node.attr("script") == "Hans" ? '"SimHei",sans-serif' :
83
+ '"Cambria",serif')
84
+ m = node.attr("monospace-font") || '"Courier New",monospace'
85
+ "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
64
86
  end
65
87
 
66
88
  def document(node)
@@ -0,0 +1,584 @@
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="FormattedString"/>
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 name="type">
350
+ <choice>
351
+ <value>section</value>
352
+ <value>clause</value>
353
+ <value>part</value>
354
+ <value>paragraph</value>
355
+ <value>chapter</value>
356
+ <value>page</value>
357
+ <value>whole</value>
358
+ <value>table</value>
359
+ <value>annex</value>
360
+ <value>figure</value>
361
+ <value>note</value>
362
+ <value>example</value>
363
+ </choice>
364
+ </attribute>
365
+ <ref name="referenceFrom"/>
366
+ <optional>
367
+ <ref name="referenceTo"/>
368
+ </optional>
369
+ </element>
370
+ </define>
371
+ <define name="referenceFrom">
372
+ <element name="referenceFrom">
373
+ <text/>
374
+ </element>
375
+ </define>
376
+ <define name="referenceTo">
377
+ <element name="referenceTo">
378
+ <text/>
379
+ </element>
380
+ </define>
381
+ <!-- unlike UML, has id attribute; that results from including bibitem in a docmodel -->
382
+ <define name="bibitem">
383
+ <element name="bibitem">
384
+ <attribute name="id">
385
+ <data type="ID"/>
386
+ </attribute>
387
+ <ref name="BibliographicItem"/>
388
+ </element>
389
+ </define>
390
+ <define name="bibitem_no_id">
391
+ <element name="bibitem">
392
+ <ref name="BibliographicItem"/>
393
+ </element>
394
+ </define>
395
+ <define name="BibItemType" combine="choice">
396
+ <choice>
397
+ <value>article</value>
398
+ <value>book</value>
399
+ <value>booklet</value>
400
+ <value>conference</value>
401
+ <value>manual</value>
402
+ <value>proceedings</value>
403
+ <value>presentation</value>
404
+ <value>thesis</value>
405
+ <value>techreport</value>
406
+ <value>standard</value>
407
+ <value>unpublished</value>
408
+ </choice>
409
+ </define>
410
+ <define name="BibliographicItem">
411
+ <optional>
412
+ <attribute name="type">
413
+ <ref name="BibItemType"/>
414
+ </attribute>
415
+ </optional>
416
+ <choice>
417
+ <oneOrMore>
418
+ <ref name="btitle"/>
419
+ </oneOrMore>
420
+ <ref name="formattedref"/>
421
+ </choice>
422
+ <zeroOrMore>
423
+ <ref name="source"/>
424
+ </zeroOrMore>
425
+ <zeroOrMore>
426
+ <ref name="docidentifier"/>
427
+ </zeroOrMore>
428
+ <zeroOrMore>
429
+ <ref name="bdate"/>
430
+ </zeroOrMore>
431
+ <zeroOrMore>
432
+ <ref name="contributor"/>
433
+ </zeroOrMore>
434
+ <optional>
435
+ <ref name="edition"/>
436
+ </optional>
437
+ <zeroOrMore>
438
+ <ref name="biblionote"/>
439
+ </zeroOrMore>
440
+ <zeroOrMore>
441
+ <ref name="partof"/>
442
+ </zeroOrMore>
443
+ <zeroOrMore>
444
+ <ref name="language"/>
445
+ </zeroOrMore>
446
+ <zeroOrMore>
447
+ <ref name="script"/>
448
+ </zeroOrMore>
449
+ <optional>
450
+ <ref name="abstract"/>
451
+ </optional>
452
+ <optional>
453
+ <ref name="status"/>
454
+ </optional>
455
+ <optional>
456
+ <ref name="copyright"/>
457
+ </optional>
458
+ <zeroOrMore>
459
+ <ref name="docrelation"/>
460
+ </zeroOrMore>
461
+ </define>
462
+ <define name="btitle">
463
+ <element name="title">
464
+ <ref name="FormattedString"/>
465
+ </element>
466
+ </define>
467
+ <define name="formattedref">
468
+ <element name="formattedref">
469
+ <ref name="FormattedString"/>
470
+ </element>
471
+ </define>
472
+ <define name="link">
473
+ <element name="link">
474
+ <ref name="TypedUri"/>
475
+ </element>
476
+ </define>
477
+ <define name="TypedUri">
478
+ <optional>
479
+ <attribute name="type"/>
480
+ </optional>
481
+ <data type="anyURI"/>
482
+ </define>
483
+ <define name="bdate">
484
+ <element name="date">
485
+ <attribute name="type">
486
+ <choice>
487
+ <value>published</value>
488
+ <value>accessed</value>
489
+ <value>created</value>
490
+ <value>activated</value>
491
+ <value>obsoleted</value>
492
+ </choice>
493
+ </attribute>
494
+ <ref name="bfrom"/>
495
+ <optional>
496
+ <ref name="bto"/>
497
+ </optional>
498
+ </element>
499
+ </define>
500
+ <define name="bfrom">
501
+ <element name="from">
502
+ <choice>
503
+ <data type="gYear"/>
504
+ <data type="date"/>
505
+ </choice>
506
+ </element>
507
+ </define>
508
+ <define name="bto">
509
+ <element name="to">
510
+ <choice>
511
+ <data type="gYear"/>
512
+ <data type="date"/>
513
+ </choice>
514
+ </element>
515
+ </define>
516
+ <define name="docidentifier">
517
+ <element name="docidentifier">
518
+ <optional>
519
+ <attribute name="type"/>
520
+ </optional>
521
+ <text/>
522
+ </element>
523
+ </define>
524
+ <define name="biblionote">
525
+ <element name="note">
526
+ <ref name="FormattedString"/>
527
+ </element>
528
+ </define>
529
+ <define name="abstract">
530
+ <element name="abstract">
531
+ <ref name="FormattedString"/>
532
+ </element>
533
+ </define>
534
+ <define name="partof">
535
+ <element name="partof">
536
+ <ref name="BibliographicItem"/>
537
+ </element>
538
+ </define>
539
+ <define name="copyright">
540
+ <element name="copyright">
541
+ <ref name="from"/>
542
+ <optional>
543
+ <ref name="to"/>
544
+ </optional>
545
+ <ref name="owner"/>
546
+ </element>
547
+ </define>
548
+ <define name="from">
549
+ <element name="from">
550
+ <data type="gYear"/>
551
+ </element>
552
+ </define>
553
+ <define name="to">
554
+ <element name="to">
555
+ <data type="gYear"/>
556
+ </element>
557
+ </define>
558
+ <define name="owner">
559
+ <element name="owner">
560
+ <ref name="ContributorInfo"/>
561
+ </element>
562
+ </define>
563
+ <!--
564
+ Anycontents = mixed {
565
+ https://github.com/relaxng/jing-trang/issues/211
566
+ https://lists.oasis-open.org/archives/office/200808/msg00024.html
567
+ https://lists.oasis-open.org/archives/office/200808/msg00099.html
568
+ For this to work, we will actually strip any attributes in the Anycontents before
569
+ passing it for validation. Horrible I know, but there are no good alternatives
570
+ that also allow us to do grammar inheritance
571
+ (attribute * { text } | Any)*
572
+ Any*
573
+ }
574
+ -->
575
+ <define name="AnyElement">
576
+ <element>
577
+ <anyName/>
578
+ <choice>
579
+ <text/>
580
+ <ref name="AnyElement"/>
581
+ </choice>
582
+ </element>
583
+ </define>
584
+ </grammar>