relaton-itu 1.0.1 → 1.3.0

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.
@@ -16,8 +16,9 @@ module RelatonItu
16
16
  # @param subgroup [Hash, RelatonItu::ItuGroup, NilClass]
17
17
  # @param workgroup [Hash, RelatonItu::ItuGroup, NilClass]
18
18
  def initialize(bureau:, group:, subgroup: nil, workgroup: nil)
19
- raise ArgumentError, "invalid bureau: #{bureau}" unless BUREAUS.include? bureau
20
-
19
+ unless BUREAUS.include? bureau
20
+ warn "[relaton-itu] WARNING: invalid bureau: #{bureau}"
21
+ end
21
22
  @bureau = bureau
22
23
  @group = group.is_a?(Hash) ? ItuGroup.new(group) : group
23
24
  @subgroup = subgroup.is_a?(Hash) ? ItuGroup.new(subgroup) : subgroup
@@ -25,10 +26,10 @@ module RelatonItu
25
26
  end
26
27
 
27
28
  # @param builder [Nokogiri::XML::Builder]
28
- def to_xml(builder)
29
+ def to_xml(builder) # rubocop:disable Metrics/AbcSize
29
30
  builder.editorialgroup do
30
31
  builder.bureau bureau
31
- builder.group { |b| group.to_xml b }
32
+ builder.group { |b| group.to_xml b } if group
32
33
  builder.subgroup { |b| group.to_xml b } if subgroup
33
34
  builder.workgroup { |b| group.to_xml b } if workgroup
34
35
  end
@@ -36,10 +37,23 @@ module RelatonItu
36
37
 
37
38
  # @return [Hash]
38
39
  def to_hash
39
- hash = { "bureau" => bureau, "group" => group.to_hash }
40
+ hash = { "bureau" => bureau }
41
+ hash["group"] = group.to_hash if group
40
42
  hash["subgroup"] = subgroup.to_hash if subgroup
41
43
  hash["workgroup"] = workgroup.to_hash if workgroup
42
44
  hash
43
45
  end
46
+
47
+ # @param prefix [String]
48
+ # @return [String]
49
+ def to_asciibib(prefix) # rubocop:disable Metrics/AbcSize
50
+ pref = prefix.empty? ? prefix : prefix + "."
51
+ pref += "editorialgroup"
52
+ out = "#{pref}.bureau:: #{bureau}\n"
53
+ out += group.to_asciibib "#{pref}.group" if group
54
+ out += subgroup.to_asciibib "#{pref}.subgroup" if subgroup
55
+ out += workgroup.to_asciibib "#{pref}.workgroup" if workgroup
56
+ out
57
+ end
44
58
  end
45
59
  end
@@ -1,5 +1,5 @@
1
1
  module RelatonItu
2
- class HashConverter < RelatonIsoBib::HashConverter
2
+ class HashConverter < RelatonBib::HashConverter
3
3
  class << self
4
4
  private
5
5
 
@@ -9,6 +9,15 @@ module RelatonItu
9
9
 
10
10
  ret[:editorialgroup] = EditorialGroup.new eg
11
11
  end
12
+
13
+ # @param ret [Hash]
14
+ def structuredidentifier_hash_to_bib(ret)
15
+ return unless ret[:structuredidentifier]
16
+
17
+ ret[:structuredidentifier] = StructuredIdentifier.new(
18
+ ret[:structuredidentifier]
19
+ )
20
+ end
12
21
  end
13
22
  end
14
23
  end
@@ -1,5 +1,5 @@
1
1
  module RelatonItu
2
- class ItuBibliographicItem < RelatonIsoBib::IsoBibliographicItem
2
+ class ItuBibliographicItem < RelatonBib::BibliographicItem
3
3
  TYPES = %w[
4
4
  recommendation recommendation-supplement recommendation-amendment
5
5
  recommendation-corrigendum recommendation-errata recommendation-annex
@@ -7,12 +7,11 @@ module RelatonItu
7
7
  joint-itu-iso-iec
8
8
  ].freeze
9
9
 
10
+ # @params structuredidentifier [RelatonItu::StructuredIdentifier]
10
11
  def initialize(**args)
11
- @doctype = args.delete :doctype
12
- if doctype && !TYPES.include?(doctype)
13
- raise ArgumentError, "invalid doctype: #{doctype}"
12
+ if args[:doctype] && !TYPES.include?(args[:doctype])
13
+ warn "[relaton-itu] WARNING: invalid doctype: #{args[:doctype]}"
14
14
  end
15
-
16
15
  super
17
16
  end
18
17
  end
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "relaton_iso_bib"
3
+ require "relaton_bib"
4
4
  require "relaton_itu/itu_bibliographic_item"
5
5
  require "relaton_itu/editorial_group"
6
+ require "relaton_itu/structured_identifier"
6
7
  require "relaton_itu/itu_group"
7
8
  require "relaton_itu/scrapper"
8
9
  require "relaton_itu/hit_collection"
@@ -66,14 +67,6 @@ module RelatonItu
66
67
  nil
67
68
  end
68
69
 
69
- # def fetch_pages(hits, threads)
70
- # workers = RelatonBib::WorkersPool.new threads
71
- # workers.worker { |w| { i: w[:i], hit: w[:hit].fetch } }
72
- # hits.each_with_index { |hit, i| workers << { i: i, hit: hit } }
73
- # workers.end
74
- # workers.result.sort_by { |a| a[:i] }.map { |x| x[:hit] }
75
- # end
76
-
77
70
  def search_filter(code)
78
71
  docidrx = %r{\w+\.\d+|\w\sSuppl\.\s\d+} # %r{^ITU-T\s[^\s]+}
79
72
  c = code.sub(/Imp\s?/, "").match(docidrx).to_s
@@ -28,6 +28,16 @@ module RelatonItu
28
28
  hash["finish"] = finish if finish
29
29
  hash
30
30
  end
31
+
32
+ # @param prefix [String]
33
+ # @return [String]
34
+ def to_asciibib(prefix)
35
+ pref = prefix.empty? ? prefix : prefix + "."
36
+ pref += "period"
37
+ out = "#{pref}.start:: #{start}\n"
38
+ out += "#{pref}.finish:: #{finish}\n" if finish
39
+ out
40
+ end
31
41
  end
32
42
 
33
43
  TYPES = %w[tsag study-group work-group].freeze
@@ -72,5 +82,16 @@ module RelatonItu
72
82
  hash["period"] = period.to_hash if period
73
83
  hash
74
84
  end
85
+
86
+ # @param prefix [String]
87
+ # @return [String]
88
+ def to_asciibib(prefix)
89
+ pref = prefix.empty? ? prefix : prefix + "."
90
+ out = "#{pref}name:: #{name}\n"
91
+ out += "#{pref}type:: #{type}\n" if type
92
+ out += "#{pref}acronym:: #{acronym}\n" if acronym
93
+ out += period.to_asciibib prefix if period
94
+ out
95
+ end
75
96
  end
76
97
  end
@@ -43,6 +43,7 @@ module RelatonItu
43
43
 
44
44
  ItuBibliographicItem.new(
45
45
  fetched: Date.today.to_s,
46
+ type: "standard",
46
47
  docid: fetch_docid(doc),
47
48
  edition: edition,
48
49
  language: ["en"],
@@ -170,7 +171,7 @@ module RelatonItu
170
171
  doc.xpath('//div[contains(@id, "tab_sup")]//table/tr[position()>2]').map do |r|
171
172
  ref = r.at('./td/span[contains(@id, "title_e")]/nobr/a')
172
173
  fref = RelatonBib::FormattedRef.new(content: ref.text, language: "en", script: "Latn")
173
- bibitem = RelatonIsoBib::IsoBibliographicItem.new(formattedref: fref)
174
+ bibitem = ItuBibliographicItem.new(formattedref: fref, type: "standard")
174
175
  { type: "complements", bibitem: bibitem }
175
176
  end
176
177
  end
@@ -183,30 +184,7 @@ module RelatonItu
183
184
  t = doc.at("//td[@class='title']|//div/table[1]/tr[4]/td/strong")
184
185
  return [] unless t
185
186
 
186
- titles = t.text.sub(/\w\.Imp\s?\d+\u00A0:\u00A0/, "").split " - "
187
- case titles.size
188
- when 0
189
- intro, main, part = nil, "", nil
190
- when 1
191
- intro, main, part = nil, titles[0], nil
192
- when 2
193
- if /^(Part|Partie) \d+:/ =~ titles[1]
194
- intro, main, part = nil, titles[0], titles[1]
195
- else
196
- intro, main, part = titles[0], titles[1], nil
197
- end
198
- when 3
199
- intro, main, part = titles[0], titles[1], titles[2]
200
- else
201
- intro, main, part = titles[0], titles[1], titles[2..-1]&.join(" -- ")
202
- end
203
- [{
204
- title_intro: intro,
205
- title_main: main,
206
- title_part: part,
207
- language: "en",
208
- script: "Latn",
209
- }]
187
+ RelatonBib::TypedTitleString.from_string t.text, "en", "Latn"
210
188
  end
211
189
 
212
190
  # Fetch dates
@@ -284,7 +262,7 @@ module RelatonItu
284
262
  # Fetch copyright.
285
263
  # @param code [String]
286
264
  # @param doc [Nokogiri::HTML::Document]
287
- # @return [Hash]
265
+ # @return [Array<Hash>]
288
266
  def fetch_copyright(code, doc)
289
267
  abbreviation = code.match(/^[^-]+/).to_s
290
268
  case abbreviation
@@ -294,7 +272,8 @@ module RelatonItu
294
272
  end
295
273
  fdate = doc.at("//table/tr/td/span[contains(@id, 'Label5')]")
296
274
  from = fdate&.text || ob_date(doc)
297
- { owner: { name: name, abbreviation: abbreviation, url: url }, from: from }
275
+ [{ owner: [{ name: name, abbreviation: abbreviation, url: url }],
276
+ from: from }]
298
277
  end
299
278
  end
300
279
  end
@@ -0,0 +1,51 @@
1
+ module RelatonItu
2
+ class StructuredIdentifier
3
+ # @return [String]
4
+ attr_reader :bureau, :docnumber
5
+
6
+ # @return [String, NilClass]
7
+ attr_reader :annexid
8
+
9
+ # @param bureau [String] T, D, or R
10
+ # @param docnumber [String]
11
+ # @param annexid [String, NilClass]
12
+ def initialize(bureau:, docnumber:, annexid: nil)
13
+ unless EditorialGroup::BUREAUS.include? bureau
14
+ warn "[relaton-itu] WARNING: invalid bureau: #{bureau}"
15
+ end
16
+ @bureau = bureau
17
+ @docnumber = docnumber
18
+ @annexid = annexid
19
+ end
20
+
21
+ # @param builder [Nokogiri::XML::Builder]
22
+ def to_xml(builder)
23
+ builder.structuredidentifier do |b|
24
+ b.bureau bureau
25
+ b.docnumber docnumber
26
+ b.annexid annexid if annexid
27
+ end
28
+ end
29
+
30
+ # @return [Hash]
31
+ def to_hash
32
+ hash = { bureau: bureau, docnumber: docnumber }
33
+ hash[:annexid] = annexid if annexid
34
+ hash
35
+ end
36
+
37
+ # @param prefix [String]
38
+ # @return [String]
39
+ def to_asciibib(prefix)
40
+ pref = prefix.empty? ? prefix : prefix + "."
41
+ pref += "structuredidentifier"
42
+ out = "#{pref}.bureau:: #{bureau}\n#{pref}.docnumber:: #{docnumber}\n"
43
+ out += "#{pref}.annexid:: #{annexid}\n" if annexid
44
+ out
45
+ end
46
+
47
+ def presence?
48
+ true
49
+ end
50
+ end
51
+ end
@@ -1,3 +1,3 @@
1
1
  module RelatonItu
2
- VERSION = "1.0.1".freeze
2
+ VERSION = "1.3.0".freeze
3
3
  end
@@ -1,23 +1,16 @@
1
1
  require "nokogiri"
2
2
 
3
3
  module RelatonItu
4
- class XMLParser < RelatonIsoBib::XMLParser
4
+ class XMLParser < RelatonBib::XMLParser
5
5
  class << self
6
- # Override RelatonIsoBib::XMLParser.form_xml method.
7
- # @param xml [String]
6
+ private
7
+
8
+ # @param item_hash [Hash]
8
9
  # @return [RelatonItu::ItuBibliographicItem]
9
- def from_xml(xml)
10
- doc = Nokogiri::XML(xml)
11
- ituitem = doc.at "/bibitem|/bibdata"
12
- if ituitem
13
- ItuBibliographicItem.new item_data(ituitem)
14
- elsif
15
- warn "[relaton-itu] can't find bibitem or bibdata element in the XML"
16
- end
10
+ def bib_item(item_hash)
11
+ ItuBibliographicItem.new item_hash
17
12
  end
18
13
 
19
- private
20
-
21
14
  # @param ext [Nokogiri::XML::Element]
22
15
  # @return [RelatonItu::EditorialGroup]
23
16
  def fetch_editorialgroup(ext)
@@ -54,6 +47,18 @@ module RelatonItu
54
47
  start: period.at("start").text, finish: period.at("end")&.text,
55
48
  )
56
49
  end
50
+
51
+ # @param ext [Nokogiri::XML::Element]
52
+ # @return [RelatonItu::StructuredIdentifier]
53
+ def fetch_structuredidentifier(ext)
54
+ sid = ext.at "./structuredidentifier"
55
+ return unless sid
56
+
57
+ br = sid.at("bureau").text
58
+ dn = sid.at("docnumber").text
59
+ an = sid.at("annexid")&.text
60
+ StructuredIdentifier.new(bureau: br, docnumber: dn, annexid: an)
61
+ end
57
62
  end
58
63
  end
59
64
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
 
19
19
  # Specify which files should be added to the gem when it is released.
20
20
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
- spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
21
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
22
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
23
  end
24
24
  spec.bindir = "exe"
@@ -37,5 +37,5 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency "vcr", "~> 5.0.0"
38
38
  spec.add_development_dependency "webmock"
39
39
 
40
- spec.add_dependency "relaton-iso-bib", "~> 1.0.0"
40
+ spec.add_dependency "relaton-bib", "~> 1.3.0"
41
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-itu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-04 00:00:00.000000000 Z
11
+ date: 2020-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase
@@ -151,19 +151,19 @@ dependencies:
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: relaton-iso-bib
154
+ name: relaton-bib
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.0.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.0.0
166
+ version: 1.3.0
167
167
  description: 'RelatonItu: retrieve ITU Standards for bibliographic use using the BibliographicItem
168
168
  model'
169
169
  email:
@@ -187,7 +187,6 @@ files:
187
187
  - grammars/basicdoc.rng
188
188
  - grammars/biblio.rng
189
189
  - grammars/isodoc.rng
190
- - grammars/isostandard.rng
191
190
  - grammars/itu.rng
192
191
  - grammars/reqt.rng
193
192
  - lib/relaton_itu.rb
@@ -200,6 +199,7 @@ files:
200
199
  - lib/relaton_itu/itu_group.rb
201
200
  - lib/relaton_itu/processor.rb
202
201
  - lib/relaton_itu/scrapper.rb
202
+ - lib/relaton_itu/structured_identifier.rb
203
203
  - lib/relaton_itu/version.rb
204
204
  - lib/relaton_itu/xml_parser.rb
205
205
  - relaton-itu.gemspec
@@ -1,522 +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
- <ref name="clause"/>
95
- <optional>
96
- <choice>
97
- <ref name="term-clause"/>
98
- <ref name="terms"/>
99
- </choice>
100
- </optional>
101
- <optional>
102
- <ref name="definitions"/>
103
- </optional>
104
- <oneOrMore>
105
- <ref name="clause"/>
106
- </oneOrMore>
107
- </element>
108
- </define>
109
- <define name="Clause-Section">
110
- <optional>
111
- <attribute name="id">
112
- <data type="ID"/>
113
- </attribute>
114
- </optional>
115
- <optional>
116
- <attribute name="language"/>
117
- </optional>
118
- <optional>
119
- <attribute name="script"/>
120
- </optional>
121
- <optional>
122
- <attribute name="inline-header">
123
- <data type="boolean"/>
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
- <choice>
138
- <group>
139
- <oneOrMore>
140
- <ref name="BasicBlock"/>
141
- </oneOrMore>
142
- <zeroOrMore>
143
- <ref name="note"/>
144
- </zeroOrMore>
145
- </group>
146
- <oneOrMore>
147
- <ref name="clause-subsection"/>
148
- </oneOrMore>
149
- </choice>
150
- </define>
151
- <define name="term">
152
- <element name="term">
153
- <optional>
154
- <attribute name="id">
155
- <data type="ID"/>
156
- </attribute>
157
- </optional>
158
- <ref name="preferred"/>
159
- <zeroOrMore>
160
- <ref name="admitted"/>
161
- </zeroOrMore>
162
- <zeroOrMore>
163
- <ref name="deprecates"/>
164
- </zeroOrMore>
165
- <optional>
166
- <ref name="termdomain"/>
167
- </optional>
168
- <ref name="definition"/>
169
- <zeroOrMore>
170
- <ref name="termnote"/>
171
- </zeroOrMore>
172
- <zeroOrMore>
173
- <ref name="termexample"/>
174
- </zeroOrMore>
175
- <zeroOrMore>
176
- <ref name="termsource"/>
177
- </zeroOrMore>
178
- </element>
179
- </define>
180
- <define name="definition">
181
- <element name="definition">
182
- <oneOrMore>
183
- <choice>
184
- <ref name="paragraph"/>
185
- <ref name="figure"/>
186
- <ref name="formula"/>
187
- </choice>
188
- </oneOrMore>
189
- </element>
190
- </define>
191
- <define name="annex">
192
- <element name="annex">
193
- <optional>
194
- <attribute name="id">
195
- <data type="ID"/>
196
- </attribute>
197
- </optional>
198
- <optional>
199
- <attribute name="language"/>
200
- </optional>
201
- <optional>
202
- <attribute name="script"/>
203
- </optional>
204
- <optional>
205
- <attribute name="inline-header">
206
- <data type="boolean"/>
207
- </attribute>
208
- </optional>
209
- <optional>
210
- <attribute name="obligation">
211
- <choice>
212
- <value>normative</value>
213
- <value>informative</value>
214
- </choice>
215
- </attribute>
216
- </optional>
217
- <optional>
218
- <ref name="section-title"/>
219
- </optional>
220
- <zeroOrMore>
221
- <!--
222
- allow hanging paragraps in annexes: they introduce lists
223
- ( paragraph-with-footnote | table | note | formula | admonition | ol | ul | dl | figure | quote | sourcecode | review | example )*,
224
- -->
225
- <ref name="BasicBlock"/>
226
- </zeroOrMore>
227
- <zeroOrMore>
228
- <ref name="note"/>
229
- </zeroOrMore>
230
- <zeroOrMore>
231
- <ref name="clause-hanging-paragraph-with-footnote"/>
232
- </zeroOrMore>
233
- <zeroOrMore>
234
- <ref name="annex-appendix"/>
235
- </zeroOrMore>
236
- </element>
237
- </define>
238
- <define name="AdmonitionType">
239
- <choice>
240
- <value>danger</value>
241
- <value>caution</value>
242
- <value>warning</value>
243
- <value>important</value>
244
- <value>safety precautions</value>
245
- </choice>
246
- </define>
247
- <define name="preface">
248
- <element name="preface">
249
- <optional>
250
- <ref name="preface_abstract"/>
251
- </optional>
252
- <ref name="foreword"/>
253
- <optional>
254
- <ref name="introduction"/>
255
- </optional>
256
- </element>
257
- </define>
258
- <define name="DocumentType">
259
- <choice>
260
- <value>international-standard</value>
261
- <value>technical-specification</value>
262
- <value>technical-report</value>
263
- <value>publicly-available-specification</value>
264
- <value>international-workshop-agreement</value>
265
- <value>guide</value>
266
- </choice>
267
- </define>
268
- <define name="structuredidentifier">
269
- <element name="structuredidentifier">
270
- <optional>
271
- <attribute name="type"/>
272
- </optional>
273
- <group>
274
- <ref name="documentnumber"/>
275
- <optional>
276
- <ref name="tc-documentnumber"/>
277
- </optional>
278
- </group>
279
- </element>
280
- </define>
281
- <define name="foreword">
282
- <element name="foreword">
283
- <ref name="Basic-Section"/>
284
- </element>
285
- </define>
286
- <define name="introduction">
287
- <element name="introduction">
288
- <ref name="Content-Section"/>
289
- </element>
290
- </define>
291
- <define name="editorialgroup">
292
- <element name="editorialgroup">
293
- <oneOrMore>
294
- <ref name="technical-committee"/>
295
- </oneOrMore>
296
- <zeroOrMore>
297
- <ref name="subcommittee"/>
298
- </zeroOrMore>
299
- <zeroOrMore>
300
- <ref name="workgroup"/>
301
- </zeroOrMore>
302
- <optional>
303
- <ref name="secretariat"/>
304
- </optional>
305
- </element>
306
- </define>
307
- <define name="Content-Section">
308
- <optional>
309
- <attribute name="id">
310
- <data type="ID"/>
311
- </attribute>
312
- </optional>
313
- <optional>
314
- <attribute name="language"/>
315
- </optional>
316
- <optional>
317
- <attribute name="script"/>
318
- </optional>
319
- <optional>
320
- <attribute name="obligation">
321
- <choice>
322
- <value>normative</value>
323
- <value>informative</value>
324
- </choice>
325
- </attribute>
326
- </optional>
327
- <optional>
328
- <ref name="section-title"/>
329
- </optional>
330
- <choice>
331
- <group>
332
- <zeroOrMore>
333
- <ref name="BasicBlock"/>
334
- </zeroOrMore>
335
- <zeroOrMore>
336
- <ref name="note"/>
337
- </zeroOrMore>
338
- </group>
339
- <oneOrMore>
340
- <ref name="content-subsection"/>
341
- </oneOrMore>
342
- </choice>
343
- </define>
344
- <define name="table">
345
- <element name="table">
346
- <attribute name="id">
347
- <data type="ID"/>
348
- </attribute>
349
- <optional>
350
- <attribute name="width"/>
351
- </optional>
352
- <optional>
353
- <attribute name="unnumbered">
354
- <data type="boolean"/>
355
- </attribute>
356
- </optional>
357
- <optional>
358
- <attribute name="subsequence"/>
359
- </optional>
360
- <optional>
361
- <attribute name="alt"/>
362
- </optional>
363
- <optional>
364
- <attribute name="summary"/>
365
- </optional>
366
- <optional>
367
- <attribute name="uri">
368
- <data type="anyURI"/>
369
- </attribute>
370
- </optional>
371
- <optional>
372
- <ref name="tname"/>
373
- </optional>
374
- <optional>
375
- <ref name="thead"/>
376
- </optional>
377
- <ref name="tbody"/>
378
- <optional>
379
- <ref name="tfoot"/>
380
- </optional>
381
- <zeroOrMore>
382
- <ref name="table-note"/>
383
- </zeroOrMore>
384
- <optional>
385
- <ref name="dl"/>
386
- </optional>
387
- </element>
388
- </define>
389
- </include>
390
- <!-- end overrides -->
391
- <!--
392
- We display the Normative References between scope and terms; but to keep the
393
- grammar simple, we keep the references together
394
- -->
395
- <define name="iso-standard">
396
- <element name="iso-standard">
397
- <ref name="bibdata"/>
398
- <zeroOrMore>
399
- <ref name="termdocsource"/>
400
- </zeroOrMore>
401
- <optional>
402
- <ref name="boilerplate"/>
403
- </optional>
404
- <ref name="preface"/>
405
- <oneOrMore>
406
- <ref name="sections"/>
407
- </oneOrMore>
408
- <zeroOrMore>
409
- <ref name="annex"/>
410
- </zeroOrMore>
411
- <ref name="bibliography"/>
412
- </element>
413
- </define>
414
- <define name="documentnumber">
415
- <element name="project-number">
416
- <optional>
417
- <attribute name="part">
418
- <data type="int"/>
419
- </attribute>
420
- </optional>
421
- <optional>
422
- <attribute name="subpart">
423
- <data type="int"/>
424
- </attribute>
425
- </optional>
426
- <text/>
427
- </element>
428
- </define>
429
- <define name="tc-documentnumber">
430
- <element name="tc-document-number">
431
- <data type="int"/>
432
- </element>
433
- </define>
434
- <define name="subcommittee">
435
- <element name="subcommittee">
436
- <ref name="IsoWorkgroup"/>
437
- </element>
438
- </define>
439
- <define name="workgroup">
440
- <element name="workgroup">
441
- <ref name="IsoWorkgroup"/>
442
- </element>
443
- </define>
444
- <define name="secretariat">
445
- <element name="secretariat">
446
- <text/>
447
- </element>
448
- </define>
449
- <define name="clause-hanging-paragraph-with-footnote">
450
- <element name="clause">
451
- <optional>
452
- <attribute name="id">
453
- <data type="ID"/>
454
- </attribute>
455
- </optional>
456
- <optional>
457
- <attribute name="language"/>
458
- </optional>
459
- <optional>
460
- <attribute name="script"/>
461
- </optional>
462
- <optional>
463
- <attribute name="inline-header">
464
- <data type="boolean"/>
465
- </attribute>
466
- </optional>
467
- <optional>
468
- <attribute name="obligation">
469
- <choice>
470
- <value>normative</value>
471
- <value>informative</value>
472
- </choice>
473
- </attribute>
474
- </optional>
475
- <optional>
476
- <ref name="section-title"/>
477
- </optional>
478
- <zeroOrMore>
479
- <!-- allow hanging paragraphs in annexes: they introduce lists -->
480
- <ref name="BasicBlock"/>
481
- </zeroOrMore>
482
- <zeroOrMore>
483
- <ref name="note"/>
484
- </zeroOrMore>
485
- <zeroOrMore>
486
- <ref name="clause-hanging-paragraph-with-footnote"/>
487
- </zeroOrMore>
488
- </element>
489
- </define>
490
- <define name="annex-appendix">
491
- <element name="appendix">
492
- <ref name="Clause-Section"/>
493
- </element>
494
- </define>
495
- <define name="ul_li">
496
- <element name="li">
497
- <optional>
498
- <attribute name="id">
499
- <data type="ID"/>
500
- </attribute>
501
- </optional>
502
- <optional>
503
- <attribute name="uncheckedcheckbox">
504
- <data type="boolean"/>
505
- </attribute>
506
- </optional>
507
- <optional>
508
- <attribute name="checkedcheckbox">
509
- <data type="boolean"/>
510
- </attribute>
511
- </optional>
512
- <oneOrMore>
513
- <ref name="paragraph-with-footnote"/>
514
- </oneOrMore>
515
- </element>
516
- </define>
517
- <define name="stagename">
518
- <element name="stagename">
519
- <text/>
520
- </element>
521
- </define>
522
- </grammar>