relaton-nist 1.1.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,5 +34,16 @@ module RelatonNist
34
34
  hash["extended"] = extended.to_s if extended
35
35
  hash
36
36
  end
37
+
38
+ # @param prefix [String]
39
+ # @return [String]
40
+ def to_asciibib(prefix)
41
+ pref = prefix.empty? ? prefix : prefix + "."
42
+ pref += "commentperiod"
43
+ out = "#{pref}.from:: #{from}\n"
44
+ out += "#{pref}.to:: #{to}\n" if to
45
+ out += "#{pref}.extended:: #{extended}\n" if extended
46
+ out
47
+ end
37
48
  end
38
49
  end
@@ -0,0 +1,5 @@
1
+ module RelatonNist
2
+ class DocumentRelation < RelatonBib::DocumentRelation
3
+ TYPES += %w[obsoletedBy supersedes supersededBy].freeze
4
+ end
5
+ end
@@ -15,11 +15,35 @@ module RelatonNist
15
15
 
16
16
  private
17
17
 
18
+ # @param item_hash [Hash]
19
+ # @return [RelatonNist::NistBibliographicItem]
20
+ def bib_item(item_hash)
21
+ NistBibliographicItem.new item_hash
22
+ end
23
+
18
24
  def commentperiod_hash_to_bib(ret)
19
25
  return unless ret[:commentperiod]
20
26
 
21
27
  ret[:commentperiod] = CommentPeriod.new ret[:commentperiod]
22
28
  end
29
+
30
+ # @param ret [Hash]
31
+ def relations_hash_to_bib(ret)
32
+ super
33
+ return unless ret[:relation]
34
+
35
+ ret[:relation] = ret[:relation].map { |r| DocumentRelation.new r }
36
+
37
+ # ret[:relation] = array(ret[:relation])
38
+ # ret[:relation]&.each do |r|
39
+ # if r[:description]
40
+ # r[:description] = FormattedString.new r[:description]
41
+ # end
42
+ # relation_bibitem_hash_to_bib(r)
43
+ # relation_locality_hash_to_bib(r)
44
+ # relation_source_locality_hash_to_bib(r)
45
+ # end
46
+ end
23
47
  end
24
48
  end
25
49
  end
@@ -17,10 +17,10 @@ module RelatonNist
17
17
  # @param year [String]
18
18
  # @param opts [Hash]
19
19
  # @option opts [String] :stage
20
- def initialize(ref_nbr, year = nil, opts = {})
20
+ def initialize(ref_nbr, year = nil, opts = {}) # rubocop:disable Metrics/AbcSize
21
21
  super ref_nbr, year
22
22
 
23
- /(?<docid>(SP|FIPS)\s[0-9-]+)/ =~ text
23
+ /(?<docid>(SP|FIPS)\s[0-9-]+\w?)/ =~ text
24
24
  @array = docid ? from_json(docid, **opts) : from_csrc(**opts)
25
25
 
26
26
  @array.sort! do |a, b|
@@ -45,28 +45,28 @@ module RelatonNist
45
45
  from = d.strftime "%m/%d/%Y"
46
46
  to = d.next_year.prev_day.strftime "%m/%d/%Y"
47
47
  end
48
- url = "#{DOMAIN}/publications/search?keywords-lg=#{text}"
48
+ url = "#{DOMAIN}/publications/search?keywords-lg=#{text}"
49
49
  url += "&dateFrom-lg=#{from}" if from
50
50
  url += "&dateTo-lg=#{to}" if to
51
- url += if /PD/ =~ opts[:stage]
51
+ url += if /PD/.match? opts[:stage]
52
52
  "&status-lg=Draft,Retired Draft,Withdrawn"
53
53
  else
54
54
  "&status-lg=Final,Withdrawn"
55
55
  end
56
56
 
57
- doc = Nokogiri::HTML OpenURI.open_uri(::Addressable::URI.parse(url).normalize)
57
+ doc = Nokogiri::HTML OpenURI.open_uri(::Addressable::URI.parse(url).normalize)
58
58
  doc.css("table.publications-table > tbody > tr").map do |h|
59
59
  link = h.at("td/div/strong/a")
60
60
  serie = h.at("td[1]").text.strip
61
61
  code = h.at("td[2]").text.strip
62
62
  title = link.text
63
- doc_url = DOMAIN + link[:href]
63
+ doc_url = DOMAIN + link[:href]
64
64
  status = h.at("td[4]").text.strip.downcase
65
65
  release_date = Date.strptime h.at("td[5]").text.strip, "%m/%d/%Y"
66
66
  Hit.new(
67
67
  {
68
- code: code, serie: serie, title: title, url: doc_url, status: status,
69
- release_date: release_date
68
+ code: code, serie: serie, title: title, url: doc_url,
69
+ status: status, release_date: release_date
70
70
  }, self
71
71
  )
72
72
  end
@@ -91,17 +91,18 @@ module RelatonNist
91
91
  # @param docid [String]
92
92
  # @param stage [String]
93
93
  # @return [Array<Hach>]
94
- def select_data(docid, **opts)
94
+ def select_data(docid, **opts) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength,Metrics/PerceivedComplexity
95
95
  d = Date.strptime year, "%Y" if year
96
+ didrx = Regexp.new(docid)
96
97
  data.select do |doc|
97
98
  next unless match_year?(doc, d)
98
99
 
99
- if /PD/ =~ opts[:stage]
100
+ if /PD/.match? opts[:stage]
100
101
  next unless %w[draft-public draft-prelim].include? doc["status"]
101
102
  else
102
103
  next unless doc["status"] == "final"
103
104
  end
104
- doc["docidentifier"] =~ Regexp.new(docid)
105
+ doc["docidentifier"] =~ didrx
105
106
  end
106
107
  end
107
108
 
@@ -129,7 +130,9 @@ module RelatonNist
129
130
  #
130
131
  # @prarm ctime [Time, NilClass]
131
132
  def fetch_data(ctime)
132
- resp = OpenURI.open_uri("https://csrc.nist.gov/CSRC/media/feeds/metanorma/pubs-export.meta")
133
+ resp = OpenURI.open_uri(
134
+ "https://csrc.nist.gov/CSRC/media/feeds/metanorma/pubs-export.meta"
135
+ )
133
136
  if !ctime || ctime < resp.last_modified
134
137
  @data = nil
135
138
  zip = OpenURI.open_uri "https://csrc.nist.gov/CSRC/media/feeds/metanorma/pubs-export.zip"
@@ -30,7 +30,7 @@ module RelatonNist
30
30
  # @param validity [RelatonBib:Validity, NilClass]
31
31
  # @param fetched [Date, NilClass] default nil
32
32
  # @param doctype [String]
33
- # @param keyword [Array<RelatonNist::Keyword>]
33
+ # @param keyword [Array<RelatonBib::Keyword>]
34
34
  # @param commentperiod [RelatonNist::CommentPeriod, NilClass]
35
35
  #
36
36
  # @param date [Array<Hash>]
@@ -51,12 +51,13 @@ module RelatonNist
51
51
  # @option abstract [String] :script
52
52
  # @option abstract [String] :type
53
53
  #
54
- # @param relation [Array<Hash>]
54
+ # @param relation [Array<Hash, RelatonNist::DocumentRelation>]
55
55
  # @option relation [String] :type
56
56
  # @option relation [RelatonBib::BibliographicItem] :bibitem
57
57
  # @option relation [Array<RelatonBib::BibItemLocality>] :bib_locality
58
58
  def initialize(**args)
59
- @doctype = args.delete(:doctype) || "standard"
59
+ # @doctype = args.delete(:doctype) || "standard"
60
+ # args[:doctype] ||= "standard"
60
61
  # @keyword = args.delete(:keyword) || []
61
62
  @commentperiod = args.delete :commentperiod
62
63
  super
@@ -67,8 +68,8 @@ module RelatonNist
67
68
  super builder, date_format: :short, **opts do |b|
68
69
  if opts[:bibdata]
69
70
  b.ext do
70
- b.doctype doctype
71
- # keyword.each { |kw| kw.to_xml b }
71
+ b.doctype doctype if doctype
72
+ # keyword.each { |kw| b.keyword { kw.to_xml b } }
72
73
  commentperiod&.to_xml b
73
74
  end
74
75
  end
@@ -82,5 +83,13 @@ module RelatonNist
82
83
  hash["commentperiod"] = commentperiod.to_hash if commentperiod
83
84
  hash
84
85
  end
86
+
87
+ # @param prefix [String]
88
+ # @return [String]
89
+ def to_asciibib(prefix = "")
90
+ out = super
91
+ out += commentperiod.to_asciibib prefix if commentperiod
92
+ out
93
+ end
85
94
  end
86
95
  end
@@ -1,5 +1,6 @@
1
1
  require "relaton_bib"
2
2
  require "relaton_nist/nist_bibliographic_item"
3
+ require "relaton_nist/document_relation"
3
4
  require "relaton_nist/scrapper"
4
5
  require "relaton_nist/hit_collection"
5
6
  require "relaton_nist/xml_parser"
@@ -120,7 +121,7 @@ module RelatonNist
120
121
  end
121
122
 
122
123
  def nistbib_search_filter(code, year, opts)
123
- idregex = %r{[0-9-]{3,}}
124
+ idregex = %r{[0-9-]{3,}\w?}
124
125
  docid = code.match(idregex).to_s
125
126
  serie = code.match(%r{(FISP|SP|NISTIR)(?=\s)})
126
127
  warn "[relaton-nist] (\"#{code}\") fetching..."
@@ -235,15 +235,18 @@ module RelatonNist
235
235
  )
236
236
  end
237
237
  if contr["surname"]
238
- affiliation = RelatonBib::Affiliation.new organization: org
238
+ affiliation = []
239
+ affiliation << RelatonBib::Affiliation.new(organization: org) if org
239
240
  entity = RelatonBib::Person.new(
240
- name: full_name(contr, lang, script), affiliation: [affiliation],
241
+ name: full_name(contr, lang, script), affiliation: affiliation,
241
242
  )
242
- else
243
+ elsif org
243
244
  entity = org
244
245
  end
245
- RelatonBib::ContributionInfo.new entity: entity, role: [type: role]
246
- end
246
+ if entity
247
+ RelatonBib::ContributionInfo.new entity: entity, role: [type: role]
248
+ end
249
+ end.compact
247
250
  end
248
251
 
249
252
  # rubocop:disable Metrics/CyclomaticComplexity
@@ -373,7 +376,7 @@ module RelatonNist
373
376
 
374
377
  # Fetch relations.
375
378
  # @param doc [Nokogiri::HTML::Document]
376
- # @return [Array<RelatonBib::DocumentRelation>]
379
+ # @return [Array<RelatonNist::DocumentRelation>]
377
380
  def fetch_relations(doc)
378
381
  relations = doc.xpath('//span[@id="pub-supersedes-container"]/a').map do |r|
379
382
  doc_relation "supersedes", r.text, DOMAIN + r[:href]
@@ -402,9 +405,9 @@ module RelatonNist
402
405
  # @param type [String]
403
406
  # @param ref [String]
404
407
  # @param uri [String]
405
- # @return [RelatonBib::DocumentRelation]
408
+ # @return [RelatonNist::DocumentRelation]
406
409
  def doc_relation(type, ref, uri, lang = "en", script = "Latn")
407
- RelatonBib::DocumentRelation.new(
410
+ DocumentRelation.new(
408
411
  type: type,
409
412
  bibitem: RelatonBib::BibliographicItem.new(
410
413
  formattedref: RelatonBib::FormattedRef.new(
@@ -1,3 +1,3 @@
1
1
  module RelatonNist
2
- VERSION = "1.1.0".freeze
2
+ VERSION = "1.3.1".freeze
3
3
  end
@@ -1,28 +1,25 @@
1
1
  module RelatonNist
2
2
  class XMLParser < RelatonBib::XMLParser
3
3
  class << self
4
- def from_xml(xml)
5
- doc = Nokogiri::XML xml
6
- doc.remove_namespaces!
7
- nistitem = doc.at("/bibitem|/bibdata")
8
- if nistitem
9
- NistBibliographicItem.new(item_data(nistitem))
10
- elsif
11
- warn "[relaton-nist] can't find bibitem or bibdata element in the XML"
12
- end
13
- end
14
-
15
4
  private
16
5
 
17
- def item_data(nistitem)
6
+ # @param intem [Nokogiri::XML::Document]
7
+ # @return [Hash]
8
+ def item_data(item)
18
9
  data = super
19
- ext = nistitem.at "./ext"
10
+ ext = item.at "./ext"
20
11
  return data unless ext
21
12
 
22
13
  data[:commentperiod] = fetch_commentperiod(ext)
23
14
  data
24
15
  end
25
16
 
17
+ # @param item_hash [Hash]
18
+ # @return [RelatonNist::NistBibliographicItem]
19
+ def bib_item(item_hash)
20
+ NistBibliographicItem.new item_hash
21
+ end
22
+
26
23
  def fetch_status(item)
27
24
  status = item.at "./status"
28
25
  return unless status
@@ -43,6 +40,12 @@ module RelatonNist
43
40
  extended: cp.at("extended")&.text
44
41
  )
45
42
  end
43
+
44
+ # @param item [Nokogiri::XML::Element]
45
+ # @return [Array<RelatonBib::DocumentRelation>]
46
+ def fetch_relations(item)
47
+ super item, DocumentRelation
48
+ end
46
49
  end
47
50
  end
48
51
  end
@@ -34,6 +34,6 @@ Gem::Specification.new do |spec|
34
34
  spec.add_development_dependency "vcr"
35
35
  spec.add_development_dependency "webmock"
36
36
 
37
- spec.add_dependency "relaton-bib", "~> 1.1.0"
37
+ spec.add_dependency "relaton-bib", "~> 1.3.0"
38
38
  spec.add_dependency "rubyzip"
39
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-nist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-03 00:00:00.000000000 Z
11
+ date: 2020-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.1.0
159
+ version: 1.3.0
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 1.1.0
166
+ version: 1.3.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rubyzip
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -200,11 +200,11 @@ files:
200
200
  - grammars/basicdoc.rng
201
201
  - grammars/biblio.rng
202
202
  - grammars/isodoc.rng
203
- - grammars/isostandard.rng
204
203
  - grammars/nist.rng
205
204
  - grammars/reqt.rng
206
205
  - lib/relaton_nist.rb
207
206
  - lib/relaton_nist/comment_period.rb
207
+ - lib/relaton_nist/document_relation.rb
208
208
  - lib/relaton_nist/document_status.rb
209
209
  - lib/relaton_nist/hash_converter.rb
210
210
  - lib/relaton_nist/hit.rb
@@ -220,7 +220,7 @@ homepage: https://github.com/metanorma/relaton-nist
220
220
  licenses:
221
221
  - MIT
222
222
  metadata: {}
223
- post_install_message:
223
+ post_install_message:
224
224
  rdoc_options: []
225
225
  require_paths:
226
226
  - lib
@@ -236,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
236
  version: '0'
237
237
  requirements: []
238
238
  rubygems_version: 3.0.6
239
- signing_key:
239
+ signing_key:
240
240
  specification_version: 4
241
241
  summary: 'RelatonNist: retrive NIST standards.'
242
242
  test_files: []
@@ -1,530 +0,0 @@
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
- <!-- default namespace isostandard = "https://www.metanorma.com/ns/iso" -->
4
- <include href="isodoc.rng">
5
- <start>
6
- <ref name="iso-standard"/>
7
- </start>
8
- <define name="organization">
9
- <element name="organization">
10
- <oneOrMore>
11
- <ref name="orgname"/>
12
- </oneOrMore>
13
- <optional>
14
- <ref name="abbreviation"/>
15
- </optional>
16
- <optional>
17
- <ref name="uri"/>
18
- </optional>
19
- <zeroOrMore>
20
- <ref name="org-identifier"/>
21
- </zeroOrMore>
22
- <zeroOrMore>
23
- <ref name="contact"/>
24
- </zeroOrMore>
25
- <optional>
26
- <ref name="technical-committee"/>
27
- </optional>
28
- <optional>
29
- <ref name="subcommittee"/>
30
- </optional>
31
- <optional>
32
- <ref name="workgroup"/>
33
- </optional>
34
- <optional>
35
- <ref name="secretariat"/>
36
- </optional>
37
- </element>
38
- </define>
39
- <define name="BibDataExtensionType">
40
- <ref name="doctype"/>
41
- <ref name="editorialgroup"/>
42
- <zeroOrMore>
43
- <ref name="ics"/>
44
- </zeroOrMore>
45
- <ref name="structuredidentifier"/>
46
- <optional>
47
- <ref name="stagename"/>
48
- </optional>
49
- </define>
50
- <define name="bdate">
51
- <element name="date">
52
- <attribute name="type">
53
- <choice>
54
- <ref name="BibliographicDateType"/>
55
- <text/>
56
- </choice>
57
- </attribute>
58
- <choice>
59
- <group>
60
- <element name="from">
61
- <ref name="ISO8601Date"/>
62
- </element>
63
- <optional>
64
- <element name="to">
65
- <ref name="ISO8601Date"/>
66
- </element>
67
- </optional>
68
- </group>
69
- <element name="on">
70
- <choice>
71
- <ref name="ISO8601Date"/>
72
- <value>--</value>
73
- <value>–</value>
74
- </choice>
75
- </element>
76
- </choice>
77
- </element>
78
- </define>
79
- <define name="ul">
80
- <element name="ul">
81
- <attribute name="id">
82
- <data type="ID"/>
83
- </attribute>
84
- <oneOrMore>
85
- <ref name="ul_li"/>
86
- </oneOrMore>
87
- <zeroOrMore>
88
- <ref name="note"/>
89
- </zeroOrMore>
90
- </element>
91
- </define>
92
- <define name="sections">
93
- <element name="sections">
94
- <zeroOrMore>
95
- <choice>
96
- <ref name="note"/>
97
- <ref name="admonition"/>
98
- </choice>
99
- </zeroOrMore>
100
- <ref name="clause"/>
101
- <optional>
102
- <choice>
103
- <ref name="term-clause"/>
104
- <ref name="terms"/>
105
- </choice>
106
- </optional>
107
- <optional>
108
- <ref name="definitions"/>
109
- </optional>
110
- <oneOrMore>
111
- <ref name="clause"/>
112
- </oneOrMore>
113
- </element>
114
- </define>
115
- <define name="Clause-Section">
116
- <optional>
117
- <attribute name="id">
118
- <data type="ID"/>
119
- </attribute>
120
- </optional>
121
- <optional>
122
- <attribute name="language"/>
123
- </optional>
124
- <optional>
125
- <attribute name="script"/>
126
- </optional>
127
- <optional>
128
- <attribute name="inline-header">
129
- <data type="boolean"/>
130
- </attribute>
131
- </optional>
132
- <optional>
133
- <attribute name="obligation">
134
- <choice>
135
- <value>normative</value>
136
- <value>informative</value>
137
- </choice>
138
- </attribute>
139
- </optional>
140
- <optional>
141
- <ref name="section-title"/>
142
- </optional>
143
- <choice>
144
- <group>
145
- <oneOrMore>
146
- <ref name="BasicBlock"/>
147
- </oneOrMore>
148
- <zeroOrMore>
149
- <ref name="note"/>
150
- </zeroOrMore>
151
- </group>
152
- <oneOrMore>
153
- <ref name="clause-subsection"/>
154
- </oneOrMore>
155
- </choice>
156
- </define>
157
- <define name="term">
158
- <element name="term">
159
- <optional>
160
- <attribute name="id">
161
- <data type="ID"/>
162
- </attribute>
163
- </optional>
164
- <ref name="preferred"/>
165
- <zeroOrMore>
166
- <ref name="admitted"/>
167
- </zeroOrMore>
168
- <zeroOrMore>
169
- <ref name="deprecates"/>
170
- </zeroOrMore>
171
- <optional>
172
- <ref name="termdomain"/>
173
- </optional>
174
- <ref name="definition"/>
175
- <zeroOrMore>
176
- <ref name="termnote"/>
177
- </zeroOrMore>
178
- <zeroOrMore>
179
- <ref name="termexample"/>
180
- </zeroOrMore>
181
- <zeroOrMore>
182
- <ref name="termsource"/>
183
- </zeroOrMore>
184
- </element>
185
- </define>
186
- <define name="definition">
187
- <element name="definition">
188
- <oneOrMore>
189
- <choice>
190
- <ref name="paragraph"/>
191
- <ref name="figure"/>
192
- <ref name="formula"/>
193
- </choice>
194
- </oneOrMore>
195
- </element>
196
- </define>
197
- <define name="annex">
198
- <element name="annex">
199
- <optional>
200
- <attribute name="id">
201
- <data type="ID"/>
202
- </attribute>
203
- </optional>
204
- <optional>
205
- <attribute name="language"/>
206
- </optional>
207
- <optional>
208
- <attribute name="script"/>
209
- </optional>
210
- <optional>
211
- <attribute name="inline-header">
212
- <data type="boolean"/>
213
- </attribute>
214
- </optional>
215
- <optional>
216
- <attribute name="obligation">
217
- <choice>
218
- <value>normative</value>
219
- <value>informative</value>
220
- </choice>
221
- </attribute>
222
- </optional>
223
- <optional>
224
- <ref name="section-title"/>
225
- </optional>
226
- <zeroOrMore>
227
- <!--
228
- allow hanging paragraps in annexes: they introduce lists
229
- ( paragraph-with-footnote | table | note | formula | admonition | ol | ul | dl | figure | quote | sourcecode | review | example )*,
230
- -->
231
- <ref name="BasicBlock"/>
232
- </zeroOrMore>
233
- <zeroOrMore>
234
- <ref name="note"/>
235
- </zeroOrMore>
236
- <zeroOrMore>
237
- <ref name="clause-hanging-paragraph-with-footnote"/>
238
- </zeroOrMore>
239
- <zeroOrMore>
240
- <ref name="annex-appendix"/>
241
- </zeroOrMore>
242
- </element>
243
- </define>
244
- <define name="AdmonitionType">
245
- <choice>
246
- <value>danger</value>
247
- <value>caution</value>
248
- <value>warning</value>
249
- <value>important</value>
250
- <value>safety precautions</value>
251
- </choice>
252
- </define>
253
- <define name="preface">
254
- <element name="preface">
255
- <optional>
256
- <ref name="preface_abstract"/>
257
- </optional>
258
- <ref name="foreword"/>
259
- <optional>
260
- <ref name="introduction"/>
261
- </optional>
262
- </element>
263
- </define>
264
- <define name="DocumentType">
265
- <choice>
266
- <value>international-standard</value>
267
- <value>technical-specification</value>
268
- <value>technical-report</value>
269
- <value>publicly-available-specification</value>
270
- <value>international-workshop-agreement</value>
271
- <value>guide</value>
272
- <value>amendment</value>
273
- <value>technical-corrigendum</value>
274
- </choice>
275
- </define>
276
- <define name="structuredidentifier">
277
- <element name="structuredidentifier">
278
- <optional>
279
- <attribute name="type"/>
280
- </optional>
281
- <group>
282
- <ref name="documentnumber"/>
283
- <optional>
284
- <ref name="tc-documentnumber"/>
285
- </optional>
286
- </group>
287
- </element>
288
- </define>
289
- <define name="foreword">
290
- <element name="foreword">
291
- <ref name="Basic-Section"/>
292
- </element>
293
- </define>
294
- <define name="introduction">
295
- <element name="introduction">
296
- <ref name="Content-Section"/>
297
- </element>
298
- </define>
299
- <define name="editorialgroup">
300
- <element name="editorialgroup">
301
- <oneOrMore>
302
- <ref name="technical-committee"/>
303
- </oneOrMore>
304
- <zeroOrMore>
305
- <ref name="subcommittee"/>
306
- </zeroOrMore>
307
- <zeroOrMore>
308
- <ref name="workgroup"/>
309
- </zeroOrMore>
310
- <optional>
311
- <ref name="secretariat"/>
312
- </optional>
313
- </element>
314
- </define>
315
- <define name="Content-Section">
316
- <optional>
317
- <attribute name="id">
318
- <data type="ID"/>
319
- </attribute>
320
- </optional>
321
- <optional>
322
- <attribute name="language"/>
323
- </optional>
324
- <optional>
325
- <attribute name="script"/>
326
- </optional>
327
- <optional>
328
- <attribute name="obligation">
329
- <choice>
330
- <value>normative</value>
331
- <value>informative</value>
332
- </choice>
333
- </attribute>
334
- </optional>
335
- <optional>
336
- <ref name="section-title"/>
337
- </optional>
338
- <choice>
339
- <group>
340
- <zeroOrMore>
341
- <ref name="BasicBlock"/>
342
- </zeroOrMore>
343
- <zeroOrMore>
344
- <ref name="note"/>
345
- </zeroOrMore>
346
- </group>
347
- <oneOrMore>
348
- <ref name="content-subsection"/>
349
- </oneOrMore>
350
- </choice>
351
- </define>
352
- <define name="table">
353
- <element name="table">
354
- <attribute name="id">
355
- <data type="ID"/>
356
- </attribute>
357
- <optional>
358
- <attribute name="width"/>
359
- </optional>
360
- <optional>
361
- <attribute name="unnumbered">
362
- <data type="boolean"/>
363
- </attribute>
364
- </optional>
365
- <optional>
366
- <attribute name="subsequence"/>
367
- </optional>
368
- <optional>
369
- <attribute name="alt"/>
370
- </optional>
371
- <optional>
372
- <attribute name="summary"/>
373
- </optional>
374
- <optional>
375
- <attribute name="uri">
376
- <data type="anyURI"/>
377
- </attribute>
378
- </optional>
379
- <optional>
380
- <ref name="tname"/>
381
- </optional>
382
- <optional>
383
- <ref name="thead"/>
384
- </optional>
385
- <ref name="tbody"/>
386
- <optional>
387
- <ref name="tfoot"/>
388
- </optional>
389
- <zeroOrMore>
390
- <ref name="table-note"/>
391
- </zeroOrMore>
392
- <optional>
393
- <ref name="dl"/>
394
- </optional>
395
- </element>
396
- </define>
397
- </include>
398
- <!-- end overrides -->
399
- <!--
400
- We display the Normative References between scope and terms; but to keep the
401
- grammar simple, we keep the references together
402
- -->
403
- <define name="iso-standard">
404
- <element name="iso-standard">
405
- <ref name="bibdata"/>
406
- <zeroOrMore>
407
- <ref name="termdocsource"/>
408
- </zeroOrMore>
409
- <optional>
410
- <ref name="boilerplate"/>
411
- </optional>
412
- <ref name="preface"/>
413
- <oneOrMore>
414
- <ref name="sections"/>
415
- </oneOrMore>
416
- <zeroOrMore>
417
- <ref name="annex"/>
418
- </zeroOrMore>
419
- <ref name="bibliography"/>
420
- </element>
421
- </define>
422
- <define name="documentnumber">
423
- <element name="project-number">
424
- <optional>
425
- <attribute name="part">
426
- <data type="int"/>
427
- </attribute>
428
- </optional>
429
- <optional>
430
- <attribute name="subpart">
431
- <data type="int"/>
432
- </attribute>
433
- </optional>
434
- <text/>
435
- </element>
436
- </define>
437
- <define name="tc-documentnumber">
438
- <element name="tc-document-number">
439
- <data type="int"/>
440
- </element>
441
- </define>
442
- <define name="subcommittee">
443
- <element name="subcommittee">
444
- <ref name="IsoWorkgroup"/>
445
- </element>
446
- </define>
447
- <define name="workgroup">
448
- <element name="workgroup">
449
- <ref name="IsoWorkgroup"/>
450
- </element>
451
- </define>
452
- <define name="secretariat">
453
- <element name="secretariat">
454
- <text/>
455
- </element>
456
- </define>
457
- <define name="clause-hanging-paragraph-with-footnote">
458
- <element name="clause">
459
- <optional>
460
- <attribute name="id">
461
- <data type="ID"/>
462
- </attribute>
463
- </optional>
464
- <optional>
465
- <attribute name="language"/>
466
- </optional>
467
- <optional>
468
- <attribute name="script"/>
469
- </optional>
470
- <optional>
471
- <attribute name="inline-header">
472
- <data type="boolean"/>
473
- </attribute>
474
- </optional>
475
- <optional>
476
- <attribute name="obligation">
477
- <choice>
478
- <value>normative</value>
479
- <value>informative</value>
480
- </choice>
481
- </attribute>
482
- </optional>
483
- <optional>
484
- <ref name="section-title"/>
485
- </optional>
486
- <zeroOrMore>
487
- <!-- allow hanging paragraphs in annexes: they introduce lists -->
488
- <ref name="BasicBlock"/>
489
- </zeroOrMore>
490
- <zeroOrMore>
491
- <ref name="note"/>
492
- </zeroOrMore>
493
- <zeroOrMore>
494
- <ref name="clause-hanging-paragraph-with-footnote"/>
495
- </zeroOrMore>
496
- </element>
497
- </define>
498
- <define name="annex-appendix">
499
- <element name="appendix">
500
- <ref name="Clause-Section"/>
501
- </element>
502
- </define>
503
- <define name="ul_li">
504
- <element name="li">
505
- <optional>
506
- <attribute name="id">
507
- <data type="ID"/>
508
- </attribute>
509
- </optional>
510
- <optional>
511
- <attribute name="uncheckedcheckbox">
512
- <data type="boolean"/>
513
- </attribute>
514
- </optional>
515
- <optional>
516
- <attribute name="checkedcheckbox">
517
- <data type="boolean"/>
518
- </attribute>
519
- </optional>
520
- <oneOrMore>
521
- <ref name="BasicBlock"/>
522
- </oneOrMore>
523
- </element>
524
- </define>
525
- <define name="stagename">
526
- <element name="stagename">
527
- <text/>
528
- </element>
529
- </define>
530
- </grammar>