metanorma-csa 1.4.0

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 +38 -0
  3. data/.github/workflows/ubuntu.yml +38 -0
  4. data/.github/workflows/windows.yml +41 -0
  5. data/.gitignore +8 -0
  6. data/.hound.yml +3 -0
  7. data/.rubocop.yml +10 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +11 -0
  10. data/LICENSE +25 -0
  11. data/README.adoc +83 -0
  12. data/Rakefile +6 -0
  13. data/bin/console +14 -0
  14. data/bin/rspec +18 -0
  15. data/bin/setup +8 -0
  16. data/lib/asciidoctor/csa.rb +5 -0
  17. data/lib/asciidoctor/csa/basicdoc.rng +1045 -0
  18. data/lib/asciidoctor/csa/biblio.rng +1142 -0
  19. data/lib/asciidoctor/csa/converter.rb +150 -0
  20. data/lib/asciidoctor/csa/csa.rng +101 -0
  21. data/lib/asciidoctor/csa/isodoc.rng +514 -0
  22. data/lib/asciidoctor/csa/isostandard.rng +860 -0
  23. data/lib/asciidoctor/csa/reqt.rng +171 -0
  24. data/lib/asciidoctor/csa/validate.rb +21 -0
  25. data/lib/isodoc/csa/base_convert.rb +43 -0
  26. data/lib/isodoc/csa/html/csa-logo-white.png +0 -0
  27. data/lib/isodoc/csa/html/csa.png +0 -0
  28. data/lib/isodoc/csa/html/csa.scss +700 -0
  29. data/lib/isodoc/csa/html/dots-w@2x.png +0 -0
  30. data/lib/isodoc/csa/html/dots@2x.png +0 -0
  31. data/lib/isodoc/csa/html/header.html +186 -0
  32. data/lib/isodoc/csa/html/html_csa_intro.html +8 -0
  33. data/lib/isodoc/csa/html/html_csa_titlepage.html +89 -0
  34. data/lib/isodoc/csa/html/htmlstyle.scss +1129 -0
  35. data/lib/isodoc/csa/html/scripts.html +74 -0
  36. data/lib/isodoc/csa/html/scripts.pdf.html +72 -0
  37. data/lib/isodoc/csa/html/word_csa_intro.html +33 -0
  38. data/lib/isodoc/csa/html/word_csa_titlepage.html +76 -0
  39. data/lib/isodoc/csa/html/wordstyle.scss +1136 -0
  40. data/lib/isodoc/csa/html_convert.rb +58 -0
  41. data/lib/isodoc/csa/metadata.rb +50 -0
  42. data/lib/isodoc/csa/pdf_convert.rb +63 -0
  43. data/lib/isodoc/csa/word_convert.rb +41 -0
  44. data/lib/metanorma-csa.rb +11 -0
  45. data/lib/metanorma/csa.rb +7 -0
  46. data/lib/metanorma/csa/processor.rb +46 -0
  47. data/lib/metanorma/csa/version.rb +7 -0
  48. data/metanorma-csa.gemspec +52 -0
  49. metadata +348 -0
@@ -0,0 +1,150 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'asciidoctor'
4
+ require 'metanorma/csa/version'
5
+ require 'isodoc/csa/html_convert'
6
+ require 'isodoc/csa/pdf_convert'
7
+ require 'isodoc/csa/word_convert'
8
+ require 'asciidoctor/standoc/converter'
9
+ require 'fileutils'
10
+ require_relative 'validate'
11
+
12
+ module Asciidoctor
13
+ module Csa
14
+ CSA_NAMESPACE = 'https://open.ribose.com/standards/csa'
15
+ CSA_TYPE = 'csa'
16
+
17
+ # A {Converter} implementation that generates CSD output, and a document
18
+ # schema encapsulation of the document for validation
19
+ class Converter < Standoc::Converter
20
+
21
+ register_for CSA_TYPE
22
+
23
+ def metadata_author(node, xml)
24
+ xml.contributor do |c|
25
+ c.role **{ type: "author" }
26
+ c.organization do |a|
27
+ a.name "Cloud Security Alliance"
28
+ end
29
+ end
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 "Cloud Security Alliance"
37
+ end
38
+ end
39
+ end
40
+
41
+ def metadata_committee(node, xml)
42
+ return unless node.attr("technical-committee")
43
+ xml.editorialgroup do |a|
44
+ a.committee node.attr("technical-committee"),
45
+ **attr_code(type: node.attr("technical-committee-type"))
46
+ i = 2
47
+ while node.attr("technical-committee_#{i}") do
48
+ a.committee node.attr("technical-committee_#{i}"),
49
+ **attr_code(type: node.attr("technical-committee-type_#{i}"))
50
+ i += 1
51
+ end
52
+ end
53
+ end
54
+
55
+ def metadata_id(node, xml)
56
+ docstatus = node.attr('status')
57
+ dn = node.attr('docnumber')
58
+ if docstatus
59
+ abbr = IsoDoc::Csa::Metadata.new('en', 'Latn', {})
60
+ .status_abbr(docstatus)
61
+ dn = "#{dn}(#{abbr})" unless abbr.empty?
62
+ end
63
+ node.attr('copyright-year') && dn += ":#{node.attr('copyright-year')}"
64
+ xml.docidentifier dn, **{ type: CSA_TYPE }
65
+ xml.docnumber { |i| i << node.attr('docnumber') }
66
+ end
67
+
68
+ def metadata_copyright(node, xml)
69
+ from = node.attr('copyright-year') || Date.today.year
70
+ xml.copyright do |c|
71
+ c.from from
72
+ c.owner do |owner|
73
+ owner.organization do |o|
74
+ o.name 'Cloud Security Alliance'
75
+ end
76
+ end
77
+ end
78
+ end
79
+
80
+ def title_validate(root)
81
+ nil
82
+ end
83
+
84
+ def makexml(node)
85
+ result = ["<?xml version='1.0' encoding='UTF-8'?>\n<csa-standard>"]
86
+ @draft = node.attributes.has_key?("draft")
87
+ result << noko { |ixml| front node, ixml }
88
+ result << noko { |ixml| middle node, ixml }
89
+ result << '</csa-standard>'
90
+ result = textcleanup(result)
91
+ ret1 = cleanup(Nokogiri::XML(result))
92
+ validate(ret1) unless @novalid
93
+ ret1.root.add_namespace(nil, CSA_NAMESPACE)
94
+ ret1
95
+ end
96
+
97
+ def doctype(node)
98
+ d = node.attr('doctype')
99
+ unless %w{guidance proposal standard report whitepaper charter policy glossary case-study}.include? d
100
+ warn "#{d} is not a legal document type: reverting to 'standard'"
101
+ d = 'standard'
102
+ end
103
+ d
104
+ end
105
+
106
+ def document(node)
107
+ init(node)
108
+ ret1 = makexml(node)
109
+ ret = ret1.to_xml(indent: 2)
110
+ unless node.attr('nodoc') || !node.attr('docfile')
111
+ filename = node.attr('docfile').gsub(/\.adoc/, '.xml')
112
+ .gsub(%r{^.*/}, '')
113
+ File.open(filename, 'w') { |f| f.write(ret) }
114
+ html_converter(node).convert filename unless node.attr('nodoc')
115
+ pdf_converter(node).convert filename unless node.attr('nodoc')
116
+ word_converter(node).convert filename unless node.attr('nodoc')
117
+ end
118
+ @files_to_delete.each { |f| FileUtils.rm f }
119
+ ret
120
+ end
121
+
122
+ def validate(doc)
123
+ content_validate(doc)
124
+ schema_validate(formattedstr_strip(doc.dup),
125
+ File.join(File.dirname(__FILE__), 'csa.rng'))
126
+ end
127
+
128
+ def sections_cleanup(x)
129
+ super
130
+ x.xpath("//*[@inline-header]").each do |h|
131
+ h.delete('inline-header')
132
+ end
133
+ end
134
+
135
+ def style(n, t)
136
+ return
137
+ end
138
+
139
+ def html_converter(node)
140
+ IsoDoc::Csa::HtmlConvert.new(html_extract_attributes(node))
141
+ end
142
+ def pdf_converter(node)
143
+ IsoDoc::Csa::PdfConvert.new(html_extract_attributes(node))
144
+ end
145
+ def word_converter(node)
146
+ IsoDoc::Csa::WordConvert.new(doc_extract_attributes(node))
147
+ end
148
+ end
149
+ end
150
+ end
@@ -0,0 +1,101 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
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="isostandard.rng">
9
+ <start>
10
+ <ref name="csa-standard"/>
11
+ </start>
12
+ <define name="figure">
13
+ <element name="figure">
14
+ <attribute name="id">
15
+ <data type="ID"/>
16
+ </attribute>
17
+ <optional>
18
+ <ref name="source"/>
19
+ </optional>
20
+ <optional>
21
+ <ref name="tname"/>
22
+ </optional>
23
+ <choice>
24
+ <oneOrMore>
25
+ <ref name="figure"/>
26
+ </oneOrMore>
27
+ <group>
28
+ <choice>
29
+ <zeroOrMore>
30
+ <ref name="TextElement"/>
31
+ </zeroOrMore>
32
+ <ref name="pre"/>
33
+ </choice>
34
+ <zeroOrMore>
35
+ <ref name="note"/>
36
+ </zeroOrMore>
37
+ <optional>
38
+ <ref name="dl"/>
39
+ </optional>
40
+ </group>
41
+ </choice>
42
+ </element>
43
+ </define>
44
+ <define name="DocumentType">
45
+ <choice>
46
+ <value>guidance</value>
47
+ <value>proposal</value>
48
+ <value>standard</value>
49
+ <value>report</value>
50
+ <value>whitepaper</value>
51
+ <value>charter</value>
52
+ <value>policy</value>
53
+ <value>glossary</value>
54
+ <value>case-study</value>
55
+ </choice>
56
+ </define>
57
+ <define name="BibDataExtensionType">
58
+ <optional>
59
+ <ref name="doctype"/>
60
+ </optional>
61
+ <ref name="editorialgroup"/>
62
+ <zeroOrMore>
63
+ <ref name="ics"/>
64
+ </zeroOrMore>
65
+ </define>
66
+ <define name="editorialgroup">
67
+ <element name="editorialgroup">
68
+ <oneOrMore>
69
+ <ref name="technical-committee"/>
70
+ </oneOrMore>
71
+ </element>
72
+ </define>
73
+ <define name="technical-committee">
74
+ <element name="committee">
75
+ <optional>
76
+ <attribute name="type"/>
77
+ </optional>
78
+ <text/>
79
+ </element>
80
+ </define>
81
+ </include>
82
+ <define name="csa-standard">
83
+ <element name="csa-standard">
84
+ <ref name="bibdata"/>
85
+ <zeroOrMore>
86
+ <ref name="termdocsource"/>
87
+ </zeroOrMore>
88
+ <optional>
89
+ <ref name="boilerplate"/>
90
+ </optional>
91
+ <ref name="preface"/>
92
+ <oneOrMore>
93
+ <ref name="sections"/>
94
+ </oneOrMore>
95
+ <zeroOrMore>
96
+ <ref name="annex"/>
97
+ </zeroOrMore>
98
+ <ref name="bibliography"/>
99
+ </element>
100
+ </define>
101
+ </grammar>
@@ -0,0 +1,514 @@
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="BibDataExtensionType">
28
+ <ref name="doctype"/>
29
+ <zeroOrMore>
30
+ <ref name="structuredidentifier"/>
31
+ </zeroOrMore>
32
+ </define>
33
+ <define name="TitleType">
34
+ <text/>
35
+ </define>
36
+ <define name="sections">
37
+ <element name="sections">
38
+ <oneOrMore>
39
+ <choice>
40
+ <ref name="clause"/>
41
+ <ref name="terms"/>
42
+ <ref name="definitions"/>
43
+ </choice>
44
+ </oneOrMore>
45
+ </element>
46
+ </define>
47
+ <define name="references">
48
+ <element name="references">
49
+ <optional>
50
+ <attribute name="id">
51
+ <data type="ID"/>
52
+ </attribute>
53
+ </optional>
54
+ <optional>
55
+ <ref name="section-title"/>
56
+ </optional>
57
+ <zeroOrMore>
58
+ <ref name="BasicBlock"/>
59
+ </zeroOrMore>
60
+ <zeroOrMore>
61
+ <ref name="bibitem"/>
62
+ <zeroOrMore>
63
+ <ref name="note"/>
64
+ </zeroOrMore>
65
+ </zeroOrMore>
66
+ </element>
67
+ </define>
68
+ </include>
69
+ <define name="standard-document">
70
+ <element name="standard-document">
71
+ <ref name="bibdata"/>
72
+ <optional>
73
+ <ref name="boilerplate"/>
74
+ </optional>
75
+ <optional>
76
+ <ref name="preface"/>
77
+ </optional>
78
+ <ref name="sections"/>
79
+ <zeroOrMore>
80
+ <ref name="annex"/>
81
+ </zeroOrMore>
82
+ <zeroOrMore>
83
+ <ref name="references"/>
84
+ </zeroOrMore>
85
+ </element>
86
+ </define>
87
+ <define name="preface">
88
+ <element name="preface">
89
+ <oneOrMore>
90
+ <choice>
91
+ <ref name="content"/>
92
+ <ref name="abstract"/>
93
+ <ref name="foreword"/>
94
+ <ref name="introduction"/>
95
+ <ref name="acknowledgements"/>
96
+ </choice>
97
+ </oneOrMore>
98
+ </element>
99
+ </define>
100
+ <define name="foreword">
101
+ <element name="foreword">
102
+ <ref name="Content-Section"/>
103
+ </element>
104
+ </define>
105
+ <define name="introduction">
106
+ <element name="introduction">
107
+ <ref name="Content-Section"/>
108
+ </element>
109
+ </define>
110
+ <define name="boilerplate">
111
+ <element name="boilerplate">
112
+ <optional>
113
+ <ref name="copyright-statement"/>
114
+ </optional>
115
+ <optional>
116
+ <ref name="license-statement"/>
117
+ </optional>
118
+ <optional>
119
+ <ref name="legal-statement"/>
120
+ </optional>
121
+ <optional>
122
+ <ref name="feedback-statement"/>
123
+ </optional>
124
+ </element>
125
+ </define>
126
+ <define name="copyright-statement">
127
+ <element name="copyright-statement">
128
+ <ref name="Content-Section"/>
129
+ </element>
130
+ </define>
131
+ <define name="license-statement">
132
+ <element name="license-statement">
133
+ <ref name="Content-Section"/>
134
+ </element>
135
+ </define>
136
+ <define name="legal-statement">
137
+ <element name="legal-statement">
138
+ <ref name="Content-Section"/>
139
+ </element>
140
+ </define>
141
+ <define name="feedback-statement">
142
+ <element name="feedback-statement">
143
+ <ref name="Content-Section"/>
144
+ </element>
145
+ </define>
146
+ <define name="definitions">
147
+ <element name="definitions">
148
+ <optional>
149
+ <attribute name="id">
150
+ <data type="ID"/>
151
+ </attribute>
152
+ </optional>
153
+ <optional>
154
+ <attribute name="language"/>
155
+ </optional>
156
+ <optional>
157
+ <attribute name="script"/>
158
+ </optional>
159
+ <optional>
160
+ <ref name="section-title"/>
161
+ </optional>
162
+ <oneOrMore>
163
+ <zeroOrMore>
164
+ <ref name="BasicBlock"/>
165
+ </zeroOrMore>
166
+ <ref name="dl"/>
167
+ </oneOrMore>
168
+ </element>
169
+ </define>
170
+ <define name="content">
171
+ <element name="clause">
172
+ <ref name="Content-Section"/>
173
+ </element>
174
+ </define>
175
+ <define name="abstract">
176
+ <element name="abstract">
177
+ <ref name="Content-Section"/>
178
+ </element>
179
+ </define>
180
+ <define name="acknowledgements">
181
+ <element name="acknowledgements">
182
+ <ref name="Content-Section"/>
183
+ </element>
184
+ </define>
185
+ <define name="content-subsection">
186
+ <element name="clause">
187
+ <optional>
188
+ <attribute name="type"/>
189
+ </optional>
190
+ <ref name="Content-Section"/>
191
+ </element>
192
+ </define>
193
+ <define name="Content-Section">
194
+ <optional>
195
+ <attribute name="id">
196
+ <data type="ID"/>
197
+ </attribute>
198
+ </optional>
199
+ <optional>
200
+ <attribute name="language"/>
201
+ </optional>
202
+ <optional>
203
+ <attribute name="script"/>
204
+ </optional>
205
+ <optional>
206
+ <ref name="section-title"/>
207
+ </optional>
208
+ <choice>
209
+ <group>
210
+ <zeroOrMore>
211
+ <ref name="BasicBlock"/>
212
+ </zeroOrMore>
213
+ <zeroOrMore>
214
+ <ref name="note"/>
215
+ </zeroOrMore>
216
+ </group>
217
+ <oneOrMore>
218
+ <ref name="content-subsection"/>
219
+ </oneOrMore>
220
+ </choice>
221
+ </define>
222
+ <define name="clause">
223
+ <element name="clause">
224
+ <optional>
225
+ <attribute name="type"/>
226
+ </optional>
227
+ <ref name="Clause-Section"/>
228
+ </element>
229
+ </define>
230
+ <define name="Clause-Section">
231
+ <optional>
232
+ <attribute name="id">
233
+ <data type="ID"/>
234
+ </attribute>
235
+ </optional>
236
+ <optional>
237
+ <attribute name="language"/>
238
+ </optional>
239
+ <optional>
240
+ <attribute name="script"/>
241
+ </optional>
242
+ <optional>
243
+ <ref name="section-title"/>
244
+ </optional>
245
+ <choice>
246
+ <group>
247
+ <zeroOrMore>
248
+ <ref name="BasicBlock"/>
249
+ </zeroOrMore>
250
+ <zeroOrMore>
251
+ <ref name="note"/>
252
+ </zeroOrMore>
253
+ </group>
254
+ <oneOrMore>
255
+ <choice>
256
+ <ref name="clause-subsection"/>
257
+ <ref name="terms"/>
258
+ <ref name="definitions"/>
259
+ </choice>
260
+ </oneOrMore>
261
+ </choice>
262
+ </define>
263
+ <define name="clause-subsection">
264
+ <element name="clause">
265
+ <ref name="Clause-Section"/>
266
+ </element>
267
+ </define>
268
+ <define name="annex">
269
+ <element name="annex">
270
+ <optional>
271
+ <attribute name="id">
272
+ <data type="ID"/>
273
+ </attribute>
274
+ </optional>
275
+ <optional>
276
+ <attribute name="language"/>
277
+ </optional>
278
+ <optional>
279
+ <attribute name="script"/>
280
+ </optional>
281
+ <attribute name="obligation">
282
+ <choice>
283
+ <value>normative</value>
284
+ <value>informative</value>
285
+ </choice>
286
+ </attribute>
287
+ <optional>
288
+ <ref name="section-title"/>
289
+ </optional>
290
+ <choice>
291
+ <group>
292
+ <zeroOrMore>
293
+ <ref name="BasicBlock"/>
294
+ </zeroOrMore>
295
+ <zeroOrMore>
296
+ <ref name="note"/>
297
+ </zeroOrMore>
298
+ </group>
299
+ <oneOrMore>
300
+ <ref name="clause-subsection"/>
301
+ </oneOrMore>
302
+ </choice>
303
+ </element>
304
+ </define>
305
+ <define name="terms">
306
+ <element name="terms">
307
+ <optional>
308
+ <attribute name="id">
309
+ <data type="ID"/>
310
+ </attribute>
311
+ </optional>
312
+ <optional>
313
+ <attribute name="language"/>
314
+ </optional>
315
+ <optional>
316
+ <attribute name="script"/>
317
+ </optional>
318
+ <zeroOrMore>
319
+ <ref name="BasicBlock"/>
320
+ </zeroOrMore>
321
+ <oneOrMore>
322
+ <ref name="term"/>
323
+ </oneOrMore>
324
+ </element>
325
+ </define>
326
+ <define name="term">
327
+ <element name="term">
328
+ <optional>
329
+ <attribute name="id">
330
+ <data type="ID"/>
331
+ </attribute>
332
+ </optional>
333
+ <oneOrMore>
334
+ <ref name="preferred"/>
335
+ </oneOrMore>
336
+ <zeroOrMore>
337
+ <ref name="admitted"/>
338
+ </zeroOrMore>
339
+ <zeroOrMore>
340
+ <ref name="related"/>
341
+ </zeroOrMore>
342
+ <zeroOrMore>
343
+ <ref name="deprecates"/>
344
+ </zeroOrMore>
345
+ <optional>
346
+ <ref name="termdomain"/>
347
+ </optional>
348
+ <zeroOrMore>
349
+ <ref name="termgrammar"/>
350
+ </zeroOrMore>
351
+ <ref name="definition"/>
352
+ <zeroOrMore>
353
+ <ref name="termnote"/>
354
+ </zeroOrMore>
355
+ <zeroOrMore>
356
+ <ref name="termexample"/>
357
+ </zeroOrMore>
358
+ <zeroOrMore>
359
+ <ref name="termsource"/>
360
+ </zeroOrMore>
361
+ </element>
362
+ </define>
363
+ <define name="preferred">
364
+ <element name="preferred">
365
+ <oneOrMore>
366
+ <ref name="TextElement"/>
367
+ </oneOrMore>
368
+ </element>
369
+ </define>
370
+ <define name="admitted">
371
+ <element name="admitted">
372
+ <oneOrMore>
373
+ <ref name="TextElement"/>
374
+ </oneOrMore>
375
+ </element>
376
+ </define>
377
+ <define name="related">
378
+ <element name="related">
379
+ <optional>
380
+ <attribute name="type">
381
+ <choice>
382
+ <value>compare</value>
383
+ <value>contrast</value>
384
+ <value>see</value>
385
+ </choice>
386
+ </attribute>
387
+ </optional>
388
+ <oneOrMore>
389
+ <ref name="TextElement"/>
390
+ </oneOrMore>
391
+ </element>
392
+ </define>
393
+ <define name="deprecates">
394
+ <element name="deprecates">
395
+ <oneOrMore>
396
+ <ref name="TextElement"/>
397
+ </oneOrMore>
398
+ </element>
399
+ </define>
400
+ <define name="termdomain">
401
+ <element name="domain">
402
+ <oneOrMore>
403
+ <ref name="TextElement"/>
404
+ </oneOrMore>
405
+ </element>
406
+ </define>
407
+ <define name="termgrammar">
408
+ <element name="grammar">
409
+ <oneOrMore>
410
+ <ref name="TextElement"/>
411
+ </oneOrMore>
412
+ </element>
413
+ </define>
414
+ <define name="definition">
415
+ <element name="definition">
416
+ <ref name="paragraph"/>
417
+ </element>
418
+ </define>
419
+ <define name="termnote">
420
+ <element name="termnote">
421
+ <attribute name="id">
422
+ <data type="ID"/>
423
+ </attribute>
424
+ <ref name="paragraph"/>
425
+ </element>
426
+ </define>
427
+ <define name="termexample">
428
+ <element name="termexample">
429
+ <attribute name="id">
430
+ <data type="ID"/>
431
+ </attribute>
432
+ <ref name="paragraph"/>
433
+ </element>
434
+ </define>
435
+ <define name="termsource">
436
+ <element name="termsource">
437
+ <attribute name="status">
438
+ <choice>
439
+ <value>identical</value>
440
+ <value>modified</value>
441
+ </choice>
442
+ </attribute>
443
+ <ref name="origin"/>
444
+ <optional>
445
+ <ref name="modification"/>
446
+ </optional>
447
+ </element>
448
+ </define>
449
+ <define name="origin">
450
+ <element name="origin">
451
+ <ref name="erefType"/>
452
+ </element>
453
+ </define>
454
+ <define name="modification">
455
+ <element name="modification">
456
+ <ref name="paragraph"/>
457
+ </element>
458
+ </define>
459
+ <define name="structuredidentifier">
460
+ <element name="structuredidentifier">
461
+ <optional>
462
+ <attribute name="type"/>
463
+ </optional>
464
+ <oneOrMore>
465
+ <element name="agency">
466
+ <text/>
467
+ </element>
468
+ </oneOrMore>
469
+ <optional>
470
+ <element name="class">
471
+ <text/>
472
+ </element>
473
+ </optional>
474
+ <element name="docnumber">
475
+ <text/>
476
+ </element>
477
+ <optional>
478
+ <element name="partnumber">
479
+ <text/>
480
+ </element>
481
+ </optional>
482
+ <optional>
483
+ <element name="edition">
484
+ <text/>
485
+ </element>
486
+ </optional>
487
+ <optional>
488
+ <element name="version">
489
+ <text/>
490
+ </element>
491
+ </optional>
492
+ <optional>
493
+ <element name="supplementtype">
494
+ <text/>
495
+ </element>
496
+ </optional>
497
+ <optional>
498
+ <element name="supplementnumber">
499
+ <text/>
500
+ </element>
501
+ </optional>
502
+ <optional>
503
+ <element name="language">
504
+ <text/>
505
+ </element>
506
+ </optional>
507
+ <optional>
508
+ <element name="year">
509
+ <text/>
510
+ </element>
511
+ </optional>
512
+ </element>
513
+ </define>
514
+ </grammar>