metanorma-generic 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/macos.yml +39 -0
  3. data/.github/workflows/ubuntu.yml +39 -0
  4. data/.github/workflows/windows.yml +42 -0
  5. data/.gitignore +1 -0
  6. data/.hound.yml +3 -0
  7. data/.rubocop.ribose.yml +66 -0
  8. data/.rubocop.tb.yml +650 -0
  9. data/.rubocop.yml +10 -0
  10. data/CODE_OF_CONDUCT.md +74 -0
  11. data/Gemfile +11 -0
  12. data/LICENSE +25 -0
  13. data/README.adoc +52 -0
  14. data/Rakefile +6 -0
  15. data/bin/console +14 -0
  16. data/bin/rspec +17 -0
  17. data/bin/setup +8 -0
  18. data/lib/asciidoctor/generic.rb +7 -0
  19. data/lib/asciidoctor/generic/basicdoc.rng +1059 -0
  20. data/lib/asciidoctor/generic/biblio.rng +1142 -0
  21. data/lib/asciidoctor/generic/converter.rb +172 -0
  22. data/lib/asciidoctor/generic/generic.rng +79 -0
  23. data/lib/asciidoctor/generic/isodoc.rng +1033 -0
  24. data/lib/asciidoctor/generic/reqt.rng +171 -0
  25. data/lib/asciidoctor/generic/rsd.rng +225 -0
  26. data/lib/isodoc/generic.rb +10 -0
  27. data/lib/isodoc/generic/base_convert.rb +59 -0
  28. data/lib/isodoc/generic/html/generic.scss +766 -0
  29. data/lib/isodoc/generic/html/header.html +253 -0
  30. data/lib/isodoc/generic/html/html_generic_intro.html +8 -0
  31. data/lib/isodoc/generic/html/html_generic_titlepage.html +106 -0
  32. data/lib/isodoc/generic/html/htmlstyle.scss +710 -0
  33. data/lib/isodoc/generic/html/logo.jpg +0 -0
  34. data/lib/isodoc/generic/html/scripts.html +84 -0
  35. data/lib/isodoc/generic/html/scripts.pdf.html +72 -0
  36. data/lib/isodoc/generic/html/word_generic_intro.html +72 -0
  37. data/lib/isodoc/generic/html/word_generic_titlepage.html +75 -0
  38. data/lib/isodoc/generic/html/wordstyle.scss +1157 -0
  39. data/lib/isodoc/generic/html_convert.rb +63 -0
  40. data/lib/isodoc/generic/metadata.rb +48 -0
  41. data/lib/isodoc/generic/pdf_convert.rb +64 -0
  42. data/lib/isodoc/generic/word_convert.rb +56 -0
  43. data/lib/metanorma-generic.rb +8 -0
  44. data/lib/metanorma/generic.rb +88 -0
  45. data/lib/metanorma/generic/processor.rb +71 -0
  46. data/lib/metanorma/generic/version.rb +5 -0
  47. data/metanorma-generic.gemspec +43 -0
  48. data/metanorma.yml.example +19 -0
  49. metadata +276 -0
@@ -0,0 +1,172 @@
1
+ require "asciidoctor"
2
+ require "asciidoctor/standoc/converter"
3
+ require "fileutils"
4
+
5
+ module Asciidoctor
6
+ module Generic
7
+
8
+ # A {Converter} implementation that generates RSD output, and a document
9
+ # schema encapsulation of the document for validation
10
+ #
11
+ class Converter < Standoc::Converter
12
+ XML_ROOT_TAG = "generic-standard".freeze
13
+ XML_NAMESPACE = "https://www.metanorma.org/ns/generic".freeze
14
+
15
+ register_for "generic"
16
+
17
+ def baselocation(loc)
18
+ return nil if loc.nil?
19
+ File.expand_path(File.join(File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
20
+ end
21
+
22
+ def metadata_author(node, xml)
23
+ xml.contributor do |c|
24
+ c.role **{ type: "author" }
25
+ c.organization do |a|
26
+ a.name configuration.organization_name_short
27
+ end
28
+ end
29
+ personal_author(node, xml)
30
+ end
31
+
32
+ def metadata_publisher(node, xml)
33
+ xml.contributor do |c|
34
+ c.role **{ type: "publisher" }
35
+ c.organization do |a|
36
+ a.name configuration.organization_name_short
37
+ end
38
+ end
39
+ end
40
+
41
+ def metadata_committee(node, xml)
42
+ return unless node.attr("committee")
43
+ xml.editorialgroup do |a|
44
+ a.committee node.attr("committee"),
45
+ **attr_code(type: node.attr("committee-type"))
46
+ i = 2
47
+ while node.attr("committee_#{i}") do
48
+ a.committee node.attr("committee_#{i}"),
49
+ **attr_code(type: node.attr("committee-type_#{i}"))
50
+ i += 1
51
+ end
52
+ end
53
+ end
54
+
55
+ def docidentifier_cleanup(xmldoc)
56
+ template = configuration.docid_template ||
57
+ "{{ organization_name_short }} {{ docnumeric }}"
58
+ docid = xmldoc.at("//bibdata/docidentifier")
59
+ id = boilerplate_isodoc(xmldoc).populate_template(template, nil)
60
+ id.empty? and docid.remove or docid.children = id
61
+ end
62
+
63
+ def metadata_id(node, xml)
64
+ xml.docidentifier do |i|
65
+ i << "DUMMY"
66
+ end
67
+ xml.docnumber { |i| i << node.attr("docnumber") }
68
+ end
69
+
70
+ def metadata_copyright(node, xml)
71
+ from = node.attr("copyright-year") || Date.today.year
72
+ xml.copyright do |c|
73
+ c.from from
74
+ c.owner do |owner|
75
+ owner.organization do |o|
76
+ o.name configuration.organization_name_short
77
+ end
78
+ end
79
+ end
80
+ end
81
+
82
+ def makexml(node)
83
+ root_tag = configuration.xml_root_tag || XML_ROOT_TAG
84
+ result = ["<?xml version='1.0' encoding='UTF-8'?>\n<#{root_tag}>"]
85
+ @draft = node.attributes.has_key?("draft")
86
+ result << noko { |ixml| front node, ixml }
87
+ result << noko { |ixml| middle node, ixml }
88
+ result << "</#{root_tag}>"
89
+ result = textcleanup(result)
90
+ ret1 = cleanup(Nokogiri::XML(result))
91
+ validate(ret1) unless @novalid
92
+ ret1.root.add_namespace(nil, configuration.document_namespace ||
93
+ XML_NAMESPACE)
94
+ ret1
95
+ end
96
+
97
+ def doctype(node)
98
+ d = node.attr("doctype")
99
+ unless %w{policy-and-procedures best-practices supporting-document
100
+ report legal directives proposal standard}.include? d
101
+ @log.add("Document Attributes", nil,
102
+ "#{d} is not a legal document type: reverting to 'standard'")
103
+ d = "standard"
104
+ end
105
+ d
106
+ end
107
+
108
+ def read_config_file(path_to_config_file)
109
+ Metanorma::Generic.configuration.
110
+ set_default_values_from_yaml_file(path_to_config_file)
111
+ end
112
+
113
+ def document(node)
114
+ read_config_file(node.attr("customize")) if node.attr("customize")
115
+ init(node)
116
+ ret1 = makexml(node)
117
+ ret = ret1.to_xml(indent: 2)
118
+ unless node.attr("nodoc") || !node.attr("docfile")
119
+ filename = node.attr("docfile").gsub(/\.adoc/, ".xml").
120
+ gsub(%r{^.*/}, "")
121
+ File.open(filename, "w") { |f| f.write(ret) }
122
+ html_converter(node).convert filename unless node.attr("nodoc")
123
+ word_converter(node).convert filename unless node.attr("nodoc")
124
+ pdf_converter(node).convert filename unless node.attr("nodoc")
125
+ end
126
+ @log.write(@localdir + @filename + ".err") unless @novalid
127
+ @files_to_delete.each { |f| FileUtils.rm f }
128
+ ret
129
+ end
130
+
131
+ def validate(doc)
132
+ content_validate(doc)
133
+ schema_validate(formattedstr_strip(doc.dup),
134
+ baselocation(configuration.validate_rng_file) ||
135
+ File.join(File.dirname(__FILE__), "generic.rng"))
136
+ end
137
+
138
+ def sections_cleanup(x)
139
+ super
140
+ x.xpath("//*[@inline-header]").each do |h|
141
+ h.delete("inline-header")
142
+ end
143
+ end
144
+
145
+ def blank_method(*args); end
146
+
147
+ def html_converter(node)
148
+ IsoDoc::Generic::HtmlConvert.new(html_extract_attributes(node))
149
+ end
150
+
151
+ alias_method :pdf_converter, :html_converter
152
+ alias_method :style, :blank_method
153
+ alias_method :title_validate, :blank_method
154
+
155
+ def word_converter(node)
156
+ IsoDoc::Generic::WordConvert.new(doc_extract_attributes(node))
157
+ end
158
+
159
+ def configuration
160
+ Metanorma::Generic.configuration
161
+ end
162
+
163
+ def boilerplate_isodoc(xmldoc)
164
+ conv = super
165
+ Metanorma::Generic::Configuration::CONFIG_ATTRS.each do |a|
166
+ conv.labels[a] = configuration.send a
167
+ end
168
+ conv
169
+ end
170
+ end
171
+ end
172
+ end
@@ -0,0 +1,79 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <grammar ns="https://www.metanorma.org/ns/generic" xmlns="http://relaxng.org/ns/structure/1.0">
3
+ <!--
4
+ Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
5
+ we cannot have a new default namespace: we will end up with a grammar with two different
6
+ namespaces, one for isostandard and one for csand additions. And we do not want that.
7
+ -->
8
+ <include href="isodoc.rng">
9
+ <start>
10
+ <ref name="generic-standard"/>
11
+ </start>
12
+ <define name="DocumentType">
13
+ <choice>
14
+ <value>policy-and-procedures</value>
15
+ <value>best-practices</value>
16
+ <value>supporting-document</value>
17
+ <value>report</value>
18
+ <value>legal</value>
19
+ <value>directives</value>
20
+ <value>proposal</value>
21
+ <value>standard</value>
22
+ </choice>
23
+ </define>
24
+ <define name="editorialgroup">
25
+ <element name="editorialgroup">
26
+ <oneOrMore>
27
+ <ref name="committee"/>
28
+ </oneOrMore>
29
+ </element>
30
+ </define>
31
+ <define name="BibDataExtensionType">
32
+ <optional>
33
+ <ref name="doctype"/>
34
+ </optional>
35
+ <ref name="editorialgroup"/>
36
+ <zeroOrMore>
37
+ <ref name="ics"/>
38
+ </zeroOrMore>
39
+ <optional>
40
+ <ref name="security"/>
41
+ </optional>
42
+ </define>
43
+ </include>
44
+ <define name="committee">
45
+ <element name="committee">
46
+ <attribute name="type">
47
+ <choice>
48
+ <value>technical</value>
49
+ <value>provisional</value>
50
+ </choice>
51
+ </attribute>
52
+ <text/>
53
+ </element>
54
+ </define>
55
+ <define name="security">
56
+ <element name="security">
57
+ <text/>
58
+ </element>
59
+ </define>
60
+ <define name="generic-standard">
61
+ <element name="generic-standard">
62
+ <ref name="bibdata"/>
63
+ <zeroOrMore>
64
+ <ref name="termdocsource"/>
65
+ </zeroOrMore>
66
+ <optional>
67
+ <ref name="boilerplate"/>
68
+ </optional>
69
+ <ref name="preface"/>
70
+ <oneOrMore>
71
+ <ref name="sections"/>
72
+ </oneOrMore>
73
+ <zeroOrMore>
74
+ <ref name="annex"/>
75
+ </zeroOrMore>
76
+ <ref name="bibliography"/>
77
+ </element>
78
+ </define>
79
+ </grammar>
@@ -0,0 +1,1033 @@
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="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
21
+ <include href="reqt.rng"/>
22
+ <!-- include "biblio.rnc" { } -->
23
+ <include href="basicdoc.rng">
24
+ <start>
25
+ <ref name="standard-document"/>
26
+ </start>
27
+ <define name="hyperlink">
28
+ <element name="link">
29
+ <attribute name="target">
30
+ <data type="anyURI"/>
31
+ </attribute>
32
+ <optional>
33
+ <attribute name="type">
34
+ <ref name="ReferenceFormat"/>
35
+ </attribute>
36
+ </optional>
37
+ <optional>
38
+ <attribute name="alt"/>
39
+ </optional>
40
+ <text/>
41
+ </element>
42
+ </define>
43
+ <define name="xref">
44
+ <element name="xref">
45
+ <attribute name="target">
46
+ <data type="IDREF"/>
47
+ </attribute>
48
+ <optional>
49
+ <attribute name="type">
50
+ <ref name="ReferenceFormat"/>
51
+ </attribute>
52
+ </optional>
53
+ <optional>
54
+ <attribute name="alt"/>
55
+ </optional>
56
+ <text/>
57
+ </element>
58
+ </define>
59
+ <define name="example">
60
+ <element name="example">
61
+ <attribute name="id">
62
+ <data type="ID"/>
63
+ </attribute>
64
+ <optional>
65
+ <attribute name="unnumbered">
66
+ <data type="boolean"/>
67
+ </attribute>
68
+ </optional>
69
+ <optional>
70
+ <attribute name="subsequence"/>
71
+ </optional>
72
+ <optional>
73
+ <ref name="tname"/>
74
+ </optional>
75
+ <oneOrMore>
76
+ <choice>
77
+ <ref name="formula"/>
78
+ <ref name="ul"/>
79
+ <ref name="ol"/>
80
+ <ref name="dl"/>
81
+ <ref name="quote"/>
82
+ <ref name="sourcecode"/>
83
+ <ref name="paragraph-with-footnote"/>
84
+ <ref name="figure"/>
85
+ </choice>
86
+ </oneOrMore>
87
+ <zeroOrMore>
88
+ <ref name="note"/>
89
+ </zeroOrMore>
90
+ </element>
91
+ </define>
92
+ <define name="BibDataExtensionType">
93
+ <ref name="doctype"/>
94
+ <optional>
95
+ <ref name="editorialgroup"/>
96
+ </optional>
97
+ <zeroOrMore>
98
+ <ref name="ics"/>
99
+ </zeroOrMore>
100
+ <zeroOrMore>
101
+ <ref name="structuredidentifier"/>
102
+ </zeroOrMore>
103
+ </define>
104
+ <define name="TitleType">
105
+ <text/>
106
+ </define>
107
+ <define name="sections">
108
+ <element name="sections">
109
+ <oneOrMore>
110
+ <choice>
111
+ <ref name="clause"/>
112
+ <ref name="terms"/>
113
+ <ref name="term-clause"/>
114
+ <ref name="definitions"/>
115
+ </choice>
116
+ </oneOrMore>
117
+ </element>
118
+ </define>
119
+ <define name="references">
120
+ <element name="references">
121
+ <optional>
122
+ <attribute name="id">
123
+ <data type="ID"/>
124
+ </attribute>
125
+ </optional>
126
+ <optional>
127
+ <attribute name="obligation">
128
+ <choice>
129
+ <value>normative</value>
130
+ <value>informative</value>
131
+ </choice>
132
+ </attribute>
133
+ </optional>
134
+ <optional>
135
+ <ref name="section-title"/>
136
+ </optional>
137
+ <zeroOrMore>
138
+ <ref name="BasicBlock"/>
139
+ </zeroOrMore>
140
+ <zeroOrMore>
141
+ <ref name="note"/>
142
+ </zeroOrMore>
143
+ <zeroOrMore>
144
+ <ref name="bibitem"/>
145
+ <zeroOrMore>
146
+ <ref name="note"/>
147
+ </zeroOrMore>
148
+ </zeroOrMore>
149
+ <zeroOrMore>
150
+ <ref name="references"/>
151
+ </zeroOrMore>
152
+ </element>
153
+ </define>
154
+ <define name="note">
155
+ <element name="note">
156
+ <attribute name="id">
157
+ <data type="ID"/>
158
+ </attribute>
159
+ <oneOrMore>
160
+ <choice>
161
+ <ref name="paragraph"/>
162
+ <ref name="ul"/>
163
+ <ref name="ol"/>
164
+ <ref name="dl"/>
165
+ <ref name="formula"/>
166
+ </choice>
167
+ </oneOrMore>
168
+ </element>
169
+ </define>
170
+ <define name="Basic-Section">
171
+ <optional>
172
+ <attribute name="id">
173
+ <data type="ID"/>
174
+ </attribute>
175
+ </optional>
176
+ <optional>
177
+ <attribute name="language"/>
178
+ </optional>
179
+ <optional>
180
+ <attribute name="script"/>
181
+ </optional>
182
+ <optional>
183
+ <attribute name="obligation">
184
+ <choice>
185
+ <value>normative</value>
186
+ <value>informative</value>
187
+ </choice>
188
+ </attribute>
189
+ </optional>
190
+ <optional>
191
+ <ref name="section-title"/>
192
+ </optional>
193
+ <group>
194
+ <oneOrMore>
195
+ <ref name="BasicBlock"/>
196
+ </oneOrMore>
197
+ <zeroOrMore>
198
+ <ref name="note"/>
199
+ </zeroOrMore>
200
+ </group>
201
+ </define>
202
+ <define name="li">
203
+ <element name="li">
204
+ <group>
205
+ <optional>
206
+ <attribute name="id">
207
+ <data type="ID"/>
208
+ </attribute>
209
+ </optional>
210
+ <oneOrMore>
211
+ <ref name="BasicBlock"/>
212
+ </oneOrMore>
213
+ </group>
214
+ <!-- exclude figures? -->
215
+ </element>
216
+ </define>
217
+ <define name="dd">
218
+ <element name="dd">
219
+ <zeroOrMore>
220
+ <!-- exclude figures? -->
221
+ <ref name="BasicBlock"/>
222
+ </zeroOrMore>
223
+ </element>
224
+ </define>
225
+ <define name="thead">
226
+ <element name="thead">
227
+ <oneOrMore>
228
+ <ref name="tr"/>
229
+ </oneOrMore>
230
+ </element>
231
+ </define>
232
+ <define name="td">
233
+ <element name="td">
234
+ <optional>
235
+ <attribute name="colspan"/>
236
+ </optional>
237
+ <optional>
238
+ <attribute name="rowspan"/>
239
+ </optional>
240
+ <optional>
241
+ <attribute name="align">
242
+ <choice>
243
+ <value>left</value>
244
+ <value>right</value>
245
+ <value>center</value>
246
+ </choice>
247
+ </attribute>
248
+ </optional>
249
+ <choice>
250
+ <zeroOrMore>
251
+ <choice>
252
+ <ref name="TextElement"/>
253
+ <ref name="fn"/>
254
+ </choice>
255
+ </zeroOrMore>
256
+ <oneOrMore>
257
+ <choice>
258
+ <ref name="paragraph-with-footnote"/>
259
+ <ref name="dl"/>
260
+ <ref name="ul"/>
261
+ <ref name="ol"/>
262
+ <ref name="figure"/>
263
+ </choice>
264
+ </oneOrMore>
265
+ </choice>
266
+ </element>
267
+ </define>
268
+ <define name="th">
269
+ <element name="th">
270
+ <optional>
271
+ <attribute name="colspan"/>
272
+ </optional>
273
+ <optional>
274
+ <attribute name="rowspan"/>
275
+ </optional>
276
+ <optional>
277
+ <attribute name="align">
278
+ <choice>
279
+ <value>left</value>
280
+ <value>right</value>
281
+ <value>center</value>
282
+ </choice>
283
+ </attribute>
284
+ </optional>
285
+ <choice>
286
+ <zeroOrMore>
287
+ <choice>
288
+ <ref name="TextElement"/>
289
+ <ref name="fn"/>
290
+ </choice>
291
+ </zeroOrMore>
292
+ <oneOrMore>
293
+ <ref name="paragraph-with-footnote"/>
294
+ </oneOrMore>
295
+ </choice>
296
+ </element>
297
+ </define>
298
+ <define name="table-note">
299
+ <element name="note">
300
+ <optional>
301
+ <attribute name="id">
302
+ <data type="ID"/>
303
+ </attribute>
304
+ </optional>
305
+ <ref name="paragraph"/>
306
+ </element>
307
+ </define>
308
+ </include>
309
+ <!-- end overrides -->
310
+ <define name="BasicBlock" combine="choice">
311
+ <choice>
312
+ <ref name="requirement"/>
313
+ <ref name="recommendation"/>
314
+ <ref name="permission"/>
315
+ </choice>
316
+ </define>
317
+ <define name="bibliography">
318
+ <element name="bibliography">
319
+ <oneOrMore>
320
+ <choice>
321
+ <ref name="references"/>
322
+ <ref name="reference-clause"/>
323
+ </choice>
324
+ </oneOrMore>
325
+ </element>
326
+ </define>
327
+ <define name="reference-clause">
328
+ <element name="clause">
329
+ <optional>
330
+ <attribute name="id">
331
+ <data type="ID"/>
332
+ </attribute>
333
+ </optional>
334
+ <optional>
335
+ <attribute name="language"/>
336
+ </optional>
337
+ <optional>
338
+ <attribute name="script"/>
339
+ </optional>
340
+ <optional>
341
+ <attribute name="inline-header">
342
+ <data type="boolean"/>
343
+ </attribute>
344
+ </optional>
345
+ <optional>
346
+ <attribute name="obligation">
347
+ <choice>
348
+ <value>normative</value>
349
+ <value>informative</value>
350
+ </choice>
351
+ </attribute>
352
+ </optional>
353
+ <optional>
354
+ <ref name="section-title"/>
355
+ </optional>
356
+ <zeroOrMore>
357
+ <ref name="BasicBlock"/>
358
+ </zeroOrMore>
359
+ <zeroOrMore>
360
+ <ref name="note"/>
361
+ </zeroOrMore>
362
+ <choice>
363
+ <oneOrMore>
364
+ <ref name="reference-clause"/>
365
+ </oneOrMore>
366
+ <zeroOrMore>
367
+ <ref name="references"/>
368
+ </zeroOrMore>
369
+ </choice>
370
+ </element>
371
+ </define>
372
+ <define name="editorialgroup">
373
+ <element name="editorialgroup">
374
+ <oneOrMore>
375
+ <ref name="technical-committee"/>
376
+ </oneOrMore>
377
+ </element>
378
+ </define>
379
+ <define name="technical-committee">
380
+ <element name="technical-committee">
381
+ <ref name="IsoWorkgroup"/>
382
+ </element>
383
+ </define>
384
+ <define name="IsoWorkgroup">
385
+ <optional>
386
+ <attribute name="number">
387
+ <data type="int"/>
388
+ </attribute>
389
+ </optional>
390
+ <optional>
391
+ <attribute name="type"/>
392
+ </optional>
393
+ <text/>
394
+ </define>
395
+ <define name="ics">
396
+ <element name="ics">
397
+ <element name="code">
398
+ <text/>
399
+ </element>
400
+ <element name="text">
401
+ <text/>
402
+ </element>
403
+ </element>
404
+ </define>
405
+ <define name="standard-document">
406
+ <element name="standard-document">
407
+ <ref name="bibdata"/>
408
+ <optional>
409
+ <ref name="boilerplate"/>
410
+ </optional>
411
+ <optional>
412
+ <ref name="preface"/>
413
+ </optional>
414
+ <ref name="sections"/>
415
+ <zeroOrMore>
416
+ <ref name="annex"/>
417
+ </zeroOrMore>
418
+ <zeroOrMore>
419
+ <ref name="references"/>
420
+ </zeroOrMore>
421
+ </element>
422
+ </define>
423
+ <define name="preface">
424
+ <element name="preface">
425
+ <oneOrMore>
426
+ <choice>
427
+ <ref name="content"/>
428
+ <ref name="preface_abstract"/>
429
+ <ref name="foreword"/>
430
+ <ref name="introduction"/>
431
+ <ref name="acknowledgements"/>
432
+ </choice>
433
+ </oneOrMore>
434
+ </element>
435
+ </define>
436
+ <define name="foreword">
437
+ <element name="foreword">
438
+ <ref name="Content-Section"/>
439
+ </element>
440
+ </define>
441
+ <define name="introduction">
442
+ <element name="introduction">
443
+ <ref name="Content-Section"/>
444
+ </element>
445
+ </define>
446
+ <define name="boilerplate">
447
+ <element name="boilerplate">
448
+ <optional>
449
+ <ref name="copyright-statement"/>
450
+ </optional>
451
+ <optional>
452
+ <ref name="license-statement"/>
453
+ </optional>
454
+ <optional>
455
+ <ref name="legal-statement"/>
456
+ </optional>
457
+ <optional>
458
+ <ref name="feedback-statement"/>
459
+ </optional>
460
+ </element>
461
+ </define>
462
+ <define name="copyright-statement">
463
+ <element name="copyright-statement">
464
+ <ref name="Content-Section"/>
465
+ </element>
466
+ </define>
467
+ <define name="license-statement">
468
+ <element name="license-statement">
469
+ <ref name="Content-Section"/>
470
+ </element>
471
+ </define>
472
+ <define name="legal-statement">
473
+ <element name="legal-statement">
474
+ <ref name="Content-Section"/>
475
+ </element>
476
+ </define>
477
+ <define name="feedback-statement">
478
+ <element name="feedback-statement">
479
+ <ref name="Content-Section"/>
480
+ </element>
481
+ </define>
482
+ <define name="definitions">
483
+ <element name="definitions">
484
+ <optional>
485
+ <attribute name="id">
486
+ <data type="ID"/>
487
+ </attribute>
488
+ </optional>
489
+ <optional>
490
+ <attribute name="language"/>
491
+ </optional>
492
+ <optional>
493
+ <attribute name="script"/>
494
+ </optional>
495
+ <optional>
496
+ <attribute name="obligation">
497
+ <choice>
498
+ <value>normative</value>
499
+ <value>informative</value>
500
+ </choice>
501
+ </attribute>
502
+ </optional>
503
+ <optional>
504
+ <ref name="section-title"/>
505
+ </optional>
506
+ <oneOrMore>
507
+ <zeroOrMore>
508
+ <ref name="BasicBlock"/>
509
+ </zeroOrMore>
510
+ <zeroOrMore>
511
+ <ref name="note"/>
512
+ </zeroOrMore>
513
+ <ref name="dl"/>
514
+ </oneOrMore>
515
+ </element>
516
+ </define>
517
+ <define name="content">
518
+ <element name="clause">
519
+ <ref name="Content-Section"/>
520
+ </element>
521
+ </define>
522
+ <define name="abstract">
523
+ <element name="abstract">
524
+ <ref name="Content-Section"/>
525
+ </element>
526
+ </define>
527
+ <define name="acknowledgements">
528
+ <element name="acknowledgements">
529
+ <ref name="Content-Section"/>
530
+ </element>
531
+ </define>
532
+ <define name="content-subsection">
533
+ <element name="clause">
534
+ <optional>
535
+ <attribute name="type"/>
536
+ </optional>
537
+ <ref name="Content-Section"/>
538
+ </element>
539
+ </define>
540
+ <define name="Content-Section">
541
+ <optional>
542
+ <attribute name="id">
543
+ <data type="ID"/>
544
+ </attribute>
545
+ </optional>
546
+ <optional>
547
+ <attribute name="language"/>
548
+ </optional>
549
+ <optional>
550
+ <attribute name="script"/>
551
+ </optional>
552
+ <optional>
553
+ <attribute name="inline-header">
554
+ <data type="boolean"/>
555
+ </attribute>
556
+ </optional>
557
+ <optional>
558
+ <attribute name="obligation">
559
+ <choice>
560
+ <value>normative</value>
561
+ <value>informative</value>
562
+ </choice>
563
+ </attribute>
564
+ </optional>
565
+ <optional>
566
+ <ref name="section-title"/>
567
+ </optional>
568
+ <group>
569
+ <group>
570
+ <zeroOrMore>
571
+ <ref name="BasicBlock"/>
572
+ </zeroOrMore>
573
+ <zeroOrMore>
574
+ <ref name="note"/>
575
+ </zeroOrMore>
576
+ </group>
577
+ <zeroOrMore>
578
+ <ref name="content-subsection"/>
579
+ </zeroOrMore>
580
+ </group>
581
+ </define>
582
+ <define name="clause">
583
+ <element name="clause">
584
+ <optional>
585
+ <attribute name="type"/>
586
+ </optional>
587
+ <ref name="Clause-Section"/>
588
+ </element>
589
+ </define>
590
+ <define name="Clause-Section">
591
+ <optional>
592
+ <attribute name="id">
593
+ <data type="ID"/>
594
+ </attribute>
595
+ </optional>
596
+ <optional>
597
+ <attribute name="language"/>
598
+ </optional>
599
+ <optional>
600
+ <attribute name="script"/>
601
+ </optional>
602
+ <optional>
603
+ <attribute name="inline-header">
604
+ <data type="boolean"/>
605
+ </attribute>
606
+ </optional>
607
+ <optional>
608
+ <attribute name="obligation">
609
+ <choice>
610
+ <value>normative</value>
611
+ <value>informative</value>
612
+ </choice>
613
+ </attribute>
614
+ </optional>
615
+ <optional>
616
+ <ref name="section-title"/>
617
+ </optional>
618
+ <group>
619
+ <group>
620
+ <zeroOrMore>
621
+ <ref name="BasicBlock"/>
622
+ </zeroOrMore>
623
+ <zeroOrMore>
624
+ <ref name="note"/>
625
+ </zeroOrMore>
626
+ </group>
627
+ <zeroOrMore>
628
+ <choice>
629
+ <ref name="clause-subsection"/>
630
+ <ref name="terms"/>
631
+ <ref name="definitions"/>
632
+ </choice>
633
+ </zeroOrMore>
634
+ </group>
635
+ </define>
636
+ <define name="Annex-Section">
637
+ <optional>
638
+ <attribute name="id">
639
+ <data type="ID"/>
640
+ </attribute>
641
+ </optional>
642
+ <optional>
643
+ <attribute name="language"/>
644
+ </optional>
645
+ <optional>
646
+ <attribute name="script"/>
647
+ </optional>
648
+ <optional>
649
+ <attribute name="inline-header">
650
+ <data type="boolean"/>
651
+ </attribute>
652
+ </optional>
653
+ <optional>
654
+ <attribute name="obligation">
655
+ <choice>
656
+ <value>normative</value>
657
+ <value>informative</value>
658
+ </choice>
659
+ </attribute>
660
+ </optional>
661
+ <optional>
662
+ <ref name="section-title"/>
663
+ </optional>
664
+ <group>
665
+ <group>
666
+ <zeroOrMore>
667
+ <ref name="BasicBlock"/>
668
+ </zeroOrMore>
669
+ <zeroOrMore>
670
+ <ref name="note"/>
671
+ </zeroOrMore>
672
+ </group>
673
+ <zeroOrMore>
674
+ <choice>
675
+ <ref name="annex-subsection"/>
676
+ <ref name="terms"/>
677
+ <ref name="definitions"/>
678
+ <ref name="references"/>
679
+ </choice>
680
+ </zeroOrMore>
681
+ </group>
682
+ </define>
683
+ <define name="clause-subsection">
684
+ <element name="clause">
685
+ <ref name="Clause-Section"/>
686
+ </element>
687
+ </define>
688
+ <define name="annex-subsection">
689
+ <element name="clause">
690
+ <ref name="Annex-Section"/>
691
+ </element>
692
+ </define>
693
+ <define name="annex">
694
+ <element name="annex">
695
+ <optional>
696
+ <attribute name="id">
697
+ <data type="ID"/>
698
+ </attribute>
699
+ </optional>
700
+ <optional>
701
+ <attribute name="language"/>
702
+ </optional>
703
+ <optional>
704
+ <attribute name="script"/>
705
+ </optional>
706
+ <optional>
707
+ <attribute name="inline-header">
708
+ <data type="boolean"/>
709
+ </attribute>
710
+ </optional>
711
+ <attribute name="obligation">
712
+ <choice>
713
+ <value>normative</value>
714
+ <value>informative</value>
715
+ </choice>
716
+ </attribute>
717
+ <optional>
718
+ <ref name="section-title"/>
719
+ </optional>
720
+ <group>
721
+ <group>
722
+ <zeroOrMore>
723
+ <ref name="BasicBlock"/>
724
+ </zeroOrMore>
725
+ <zeroOrMore>
726
+ <ref name="note"/>
727
+ </zeroOrMore>
728
+ </group>
729
+ <zeroOrMore>
730
+ <choice>
731
+ <ref name="annex-subsection"/>
732
+ <ref name="terms"/>
733
+ <ref name="definitions"/>
734
+ <ref name="references"/>
735
+ </choice>
736
+ </zeroOrMore>
737
+ </group>
738
+ </element>
739
+ </define>
740
+ <define name="terms">
741
+ <element name="terms">
742
+ <optional>
743
+ <attribute name="id">
744
+ <data type="ID"/>
745
+ </attribute>
746
+ </optional>
747
+ <optional>
748
+ <attribute name="language"/>
749
+ </optional>
750
+ <optional>
751
+ <attribute name="script"/>
752
+ </optional>
753
+ <optional>
754
+ <attribute name="obligation">
755
+ <choice>
756
+ <value>normative</value>
757
+ <value>informative</value>
758
+ </choice>
759
+ </attribute>
760
+ </optional>
761
+ <optional>
762
+ <ref name="section-title"/>
763
+ </optional>
764
+ <zeroOrMore>
765
+ <ref name="BasicBlock"/>
766
+ </zeroOrMore>
767
+ <zeroOrMore>
768
+ <ref name="note"/>
769
+ </zeroOrMore>
770
+ <choice>
771
+ <oneOrMore>
772
+ <ref name="term"/>
773
+ </oneOrMore>
774
+ <group>
775
+ <zeroOrMore>
776
+ <ref name="terms"/>
777
+ </zeroOrMore>
778
+ <optional>
779
+ <ref name="definitions"/>
780
+ </optional>
781
+ </group>
782
+ </choice>
783
+ </element>
784
+ </define>
785
+ <define name="term">
786
+ <element name="term">
787
+ <optional>
788
+ <attribute name="id">
789
+ <data type="ID"/>
790
+ </attribute>
791
+ </optional>
792
+ <oneOrMore>
793
+ <ref name="preferred"/>
794
+ </oneOrMore>
795
+ <zeroOrMore>
796
+ <ref name="admitted"/>
797
+ </zeroOrMore>
798
+ <zeroOrMore>
799
+ <ref name="related"/>
800
+ </zeroOrMore>
801
+ <zeroOrMore>
802
+ <ref name="deprecates"/>
803
+ </zeroOrMore>
804
+ <optional>
805
+ <ref name="termdomain"/>
806
+ </optional>
807
+ <zeroOrMore>
808
+ <ref name="termgrammar"/>
809
+ </zeroOrMore>
810
+ <ref name="definition"/>
811
+ <zeroOrMore>
812
+ <ref name="termnote"/>
813
+ </zeroOrMore>
814
+ <zeroOrMore>
815
+ <ref name="termexample"/>
816
+ </zeroOrMore>
817
+ <zeroOrMore>
818
+ <ref name="termsource"/>
819
+ </zeroOrMore>
820
+ </element>
821
+ </define>
822
+ <define name="preferred">
823
+ <element name="preferred">
824
+ <oneOrMore>
825
+ <ref name="TextElement"/>
826
+ </oneOrMore>
827
+ </element>
828
+ </define>
829
+ <define name="admitted">
830
+ <element name="admitted">
831
+ <oneOrMore>
832
+ <ref name="TextElement"/>
833
+ </oneOrMore>
834
+ </element>
835
+ </define>
836
+ <define name="related">
837
+ <element name="related">
838
+ <optional>
839
+ <attribute name="type">
840
+ <choice>
841
+ <value>compare</value>
842
+ <value>contrast</value>
843
+ <value>see</value>
844
+ </choice>
845
+ </attribute>
846
+ </optional>
847
+ <oneOrMore>
848
+ <ref name="TextElement"/>
849
+ </oneOrMore>
850
+ </element>
851
+ </define>
852
+ <define name="deprecates">
853
+ <element name="deprecates">
854
+ <oneOrMore>
855
+ <ref name="TextElement"/>
856
+ </oneOrMore>
857
+ </element>
858
+ </define>
859
+ <define name="termdomain">
860
+ <element name="domain">
861
+ <oneOrMore>
862
+ <ref name="TextElement"/>
863
+ </oneOrMore>
864
+ </element>
865
+ </define>
866
+ <define name="termgrammar">
867
+ <element name="grammar">
868
+ <oneOrMore>
869
+ <ref name="TextElement"/>
870
+ </oneOrMore>
871
+ </element>
872
+ </define>
873
+ <define name="definition">
874
+ <element name="definition">
875
+ <oneOrMore>
876
+ <choice>
877
+ <ref name="paragraph"/>
878
+ <ref name="figure"/>
879
+ <ref name="formula"/>
880
+ </choice>
881
+ </oneOrMore>
882
+ </element>
883
+ </define>
884
+ <define name="termnote">
885
+ <element name="termnote">
886
+ <attribute name="id">
887
+ <data type="ID"/>
888
+ </attribute>
889
+ <ref name="paragraph"/>
890
+ </element>
891
+ </define>
892
+ <define name="termexample">
893
+ <element name="termexample">
894
+ <attribute name="id">
895
+ <data type="ID"/>
896
+ </attribute>
897
+ <ref name="paragraph"/>
898
+ </element>
899
+ </define>
900
+ <define name="termsource">
901
+ <element name="termsource">
902
+ <attribute name="status">
903
+ <choice>
904
+ <value>identical</value>
905
+ <value>modified</value>
906
+ </choice>
907
+ </attribute>
908
+ <ref name="origin"/>
909
+ <optional>
910
+ <ref name="modification"/>
911
+ </optional>
912
+ </element>
913
+ </define>
914
+ <define name="origin">
915
+ <element name="origin">
916
+ <ref name="erefType"/>
917
+ </element>
918
+ </define>
919
+ <define name="modification">
920
+ <element name="modification">
921
+ <ref name="paragraph"/>
922
+ </element>
923
+ </define>
924
+ <define name="structuredidentifier">
925
+ <element name="structuredidentifier">
926
+ <optional>
927
+ <attribute name="type"/>
928
+ </optional>
929
+ <oneOrMore>
930
+ <element name="agency">
931
+ <text/>
932
+ </element>
933
+ </oneOrMore>
934
+ <optional>
935
+ <element name="class">
936
+ <text/>
937
+ </element>
938
+ </optional>
939
+ <element name="docnumber">
940
+ <text/>
941
+ </element>
942
+ <optional>
943
+ <element name="partnumber">
944
+ <text/>
945
+ </element>
946
+ </optional>
947
+ <optional>
948
+ <element name="edition">
949
+ <text/>
950
+ </element>
951
+ </optional>
952
+ <optional>
953
+ <element name="version">
954
+ <text/>
955
+ </element>
956
+ </optional>
957
+ <optional>
958
+ <element name="supplementtype">
959
+ <text/>
960
+ </element>
961
+ </optional>
962
+ <optional>
963
+ <element name="supplementnumber">
964
+ <text/>
965
+ </element>
966
+ </optional>
967
+ <optional>
968
+ <element name="language">
969
+ <text/>
970
+ </element>
971
+ </optional>
972
+ <optional>
973
+ <element name="year">
974
+ <text/>
975
+ </element>
976
+ </optional>
977
+ </element>
978
+ </define>
979
+ <define name="preface_abstract">
980
+ <element name="abstract">
981
+ <ref name="Basic-Section"/>
982
+ </element>
983
+ </define>
984
+ <define name="term-clause">
985
+ <element name="clause">
986
+ <optional>
987
+ <attribute name="id">
988
+ <data type="ID"/>
989
+ </attribute>
990
+ </optional>
991
+ <optional>
992
+ <attribute name="language"/>
993
+ </optional>
994
+ <optional>
995
+ <attribute name="script"/>
996
+ </optional>
997
+ <optional>
998
+ <attribute name="inline-header">
999
+ <data type="boolean"/>
1000
+ </attribute>
1001
+ </optional>
1002
+ <optional>
1003
+ <attribute name="obligation">
1004
+ <choice>
1005
+ <value>normative</value>
1006
+ <value>informative</value>
1007
+ </choice>
1008
+ </attribute>
1009
+ </optional>
1010
+ <optional>
1011
+ <ref name="section-title"/>
1012
+ </optional>
1013
+ <zeroOrMore>
1014
+ <ref name="BasicBlock"/>
1015
+ </zeroOrMore>
1016
+ <zeroOrMore>
1017
+ <ref name="note"/>
1018
+ </zeroOrMore>
1019
+ <zeroOrMore>
1020
+ <choice>
1021
+ <ref name="term-clause"/>
1022
+ <ref name="terms"/>
1023
+ <ref name="definitions"/>
1024
+ </choice>
1025
+ </zeroOrMore>
1026
+ </element>
1027
+ </define>
1028
+ <define name="termdocsource">
1029
+ <element name="termdocsource">
1030
+ <ref name="CitationType"/>
1031
+ </element>
1032
+ </define>
1033
+ </grammar>