relaton-cen 1.8.pre1 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -38,6 +38,9 @@
38
38
  </define>
39
39
  <define name="BibDataExtensionType">
40
40
  <ref name="doctype"/>
41
+ <optional>
42
+ <ref name="docsubtype"/>
43
+ </optional>
41
44
  <optional>
42
45
  <ref name="horizontal"/>
43
46
  </optional>
@@ -98,7 +101,11 @@
98
101
  <ref name="definitions"/>
99
102
  </optional>
100
103
  <oneOrMore>
101
- <ref name="clause"/>
104
+ <choice>
105
+ <ref name="clause"/>
106
+ <ref name="term-clause"/>
107
+ <ref name="terms"/>
108
+ </choice>
102
109
  </oneOrMore>
103
110
  </element>
104
111
  </define>
@@ -133,22 +140,17 @@
133
140
  <optional>
134
141
  <ref name="section-title"/>
135
142
  </optional>
136
- <group>
143
+ <choice>
137
144
  <choice>
138
- <group>
139
- <oneOrMore>
140
- <ref name="BasicBlock"/>
141
- </oneOrMore>
142
- <zeroOrMore>
143
- <ref name="note"/>
144
- </zeroOrMore>
145
- </group>
145
+ <oneOrMore>
146
+ <ref name="BasicBlock"/>
147
+ </oneOrMore>
146
148
  <ref name="amend"/>
147
149
  </choice>
148
150
  <oneOrMore>
149
151
  <ref name="clause-subsection"/>
150
152
  </oneOrMore>
151
- </group>
153
+ </choice>
152
154
  </define>
153
155
  <define name="term">
154
156
  <element name="term">
@@ -157,6 +159,20 @@
157
159
  <data type="ID"/>
158
160
  </attribute>
159
161
  </optional>
162
+ <optional>
163
+ <attribute name="language"/>
164
+ </optional>
165
+ <optional>
166
+ <attribute name="script"/>
167
+ </optional>
168
+ <optional>
169
+ <attribute name="tag"/>
170
+ </optional>
171
+ <optional>
172
+ <attribute name="multilingual-rendering">
173
+ <ref name="MultilingualRenderingType"/>
174
+ </attribute>
175
+ </optional>
160
176
  <ref name="preferred"/>
161
177
  <zeroOrMore>
162
178
  <ref name="admitted"/>
@@ -167,7 +183,7 @@
167
183
  <optional>
168
184
  <ref name="termdomain"/>
169
185
  </optional>
170
- <ref name="definition"/>
186
+ <ref name="termdefinition"/>
171
187
  <zeroOrMore>
172
188
  <ref name="termnote"/>
173
189
  </zeroOrMore>
@@ -177,6 +193,9 @@
177
193
  <zeroOrMore>
178
194
  <ref name="termsource"/>
179
195
  </zeroOrMore>
196
+ <zeroOrMore>
197
+ <ref name="term"/>
198
+ </zeroOrMore>
180
199
  </element>
181
200
  </define>
182
201
  <define name="annex">
@@ -215,9 +234,6 @@
215
234
  -->
216
235
  <ref name="BasicBlock"/>
217
236
  </zeroOrMore>
218
- <zeroOrMore>
219
- <ref name="note"/>
220
- </zeroOrMore>
221
237
  <zeroOrMore>
222
238
  <ref name="clause-hanging-paragraph-with-footnote"/>
223
239
  </zeroOrMore>
@@ -259,6 +275,14 @@
259
275
  <value>directive</value>
260
276
  </choice>
261
277
  </define>
278
+ <define name="DocumentSubtype">
279
+ <choice>
280
+ <value>specification</value>
281
+ <value>method-of-test</value>
282
+ <value>vocabulary</value>
283
+ <value>code-of-practice</value>
284
+ </choice>
285
+ </define>
262
286
  <define name="structuredidentifier">
263
287
  <element name="structuredidentifier">
264
288
  <optional>
@@ -333,14 +357,9 @@
333
357
  <ref name="section-title"/>
334
358
  </optional>
335
359
  <choice>
336
- <group>
337
- <zeroOrMore>
338
- <ref name="BasicBlock"/>
339
- </zeroOrMore>
340
- <zeroOrMore>
341
- <ref name="note"/>
342
- </zeroOrMore>
343
- </group>
360
+ <zeroOrMore>
361
+ <ref name="BasicBlock"/>
362
+ </zeroOrMore>
344
363
  <oneOrMore>
345
364
  <ref name="content-subsection"/>
346
365
  </oneOrMore>
@@ -457,9 +476,6 @@
457
476
  <!-- allow hanging paragraphs in annexes: they introduce lists -->
458
477
  <ref name="BasicBlock"/>
459
478
  </zeroOrMore>
460
- <zeroOrMore>
461
- <ref name="note"/>
462
- </zeroOrMore>
463
479
  <zeroOrMore>
464
480
  <ref name="clause-hanging-paragraph-with-footnote"/>
465
481
  </zeroOrMore>
data/grammars/reqt.rng CHANGED
@@ -30,9 +30,22 @@
30
30
  <data type="boolean"/>
31
31
  </attribute>
32
32
  </optional>
33
+ <optional>
34
+ <attribute name="number"/>
35
+ </optional>
33
36
  <optional>
34
37
  <attribute name="subsequence"/>
35
38
  </optional>
39
+ <optional>
40
+ <attribute name="keep-with-next">
41
+ <data type="boolean"/>
42
+ </attribute>
43
+ </optional>
44
+ <optional>
45
+ <attribute name="keep-lines-together">
46
+ <data type="boolean"/>
47
+ </attribute>
48
+ </optional>
36
49
  <attribute name="id">
37
50
  <data type="ID"/>
38
51
  </attribute>
@@ -40,17 +53,31 @@
40
53
  <attribute name="filename"/>
41
54
  </optional>
42
55
  <optional>
43
- <ref name="reqtitle"/>
56
+ <attribute name="model"/>
44
57
  </optional>
45
58
  <optional>
46
- <ref name="label"/>
59
+ <attribute name="type"/>
47
60
  </optional>
48
61
  <optional>
49
- <ref name="subject"/>
62
+ <attribute name="tag"/>
50
63
  </optional>
51
64
  <optional>
52
- <ref name="reqinherit"/>
65
+ <attribute name="multilingual-rendering">
66
+ <ref name="MultilingualRenderingType"/>
67
+ </attribute>
53
68
  </optional>
69
+ <optional>
70
+ <ref name="reqtitle"/>
71
+ </optional>
72
+ <optional>
73
+ <ref name="label"/>
74
+ </optional>
75
+ <zeroOrMore>
76
+ <ref name="subject"/>
77
+ </zeroOrMore>
78
+ <zeroOrMore>
79
+ <ref name="reqinherit"/>
80
+ </zeroOrMore>
54
81
  <zeroOrMore>
55
82
  <ref name="classification"/>
56
83
  </zeroOrMore>
@@ -61,6 +88,7 @@
61
88
  <ref name="verification"/>
62
89
  <ref name="import"/>
63
90
  <ref name="description"/>
91
+ <ref name="component"/>
64
92
  </choice>
65
93
  </zeroOrMore>
66
94
  <optional>
@@ -81,17 +109,23 @@
81
109
  </define>
82
110
  <define name="label">
83
111
  <element name="label">
84
- <text/>
112
+ <oneOrMore>
113
+ <ref name="TextElement"/>
114
+ </oneOrMore>
85
115
  </element>
86
116
  </define>
87
117
  <define name="subject">
88
118
  <element name="subject">
89
- <text/>
119
+ <oneOrMore>
120
+ <ref name="TextElement"/>
121
+ </oneOrMore>
90
122
  </element>
91
123
  </define>
92
124
  <define name="reqinherit">
93
125
  <element name="inherit">
94
- <text/>
126
+ <oneOrMore>
127
+ <ref name="TextElement"/>
128
+ </oneOrMore>
95
129
  </element>
96
130
  </define>
97
131
  <define name="measurementtarget">
@@ -119,6 +153,12 @@
119
153
  <ref name="RequirementSubpart"/>
120
154
  </element>
121
155
  </define>
156
+ <define name="component">
157
+ <element name="component">
158
+ <attribute name="class"/>
159
+ <ref name="RequirementSubpart"/>
160
+ </element>
161
+ </define>
122
162
  <define name="reqt_references">
123
163
  <element name="references">
124
164
  <oneOrMore>
@@ -135,6 +175,24 @@
135
175
  <data type="boolean"/>
136
176
  </attribute>
137
177
  </optional>
178
+ <optional>
179
+ <attribute name="keep-with-next">
180
+ <data type="boolean"/>
181
+ </attribute>
182
+ </optional>
183
+ <optional>
184
+ <attribute name="keep-lines-together">
185
+ <data type="boolean"/>
186
+ </attribute>
187
+ </optional>
188
+ <optional>
189
+ <attribute name="tag"/>
190
+ </optional>
191
+ <optional>
192
+ <attribute name="multilingual-rendering">
193
+ <ref name="MultilingualRenderingType"/>
194
+ </attribute>
195
+ </optional>
138
196
  <oneOrMore>
139
197
  <ref name="BasicBlock"/>
140
198
  </oneOrMore>
@@ -14,7 +14,7 @@ module RelatonCen
14
14
  # @param text [String]
15
15
  # @return [RelatonCen::HitCollection]
16
16
  def search(text, year = nil)
17
- /^CEN\s(?<code>.+)/ =~ text
17
+ /^C?EN\s(?<code>.+)/ =~ text
18
18
  HitCollection.new code, year
19
19
  rescue Mechanize::ResponseCodeError => e
20
20
  raise RelatonBib::RequestError, e.message
@@ -26,20 +26,11 @@ module RelatonCen
26
26
  # reference is required
27
27
  # @return [RelatonBib::BibliographicItem, nil]
28
28
  def get(code, year = nil, opts = {}) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
29
- # if year.nil?
30
29
  code1, year1 = code.split ":"
31
- # unless code1.nil?
32
30
  code = code1
33
31
  year ||= year1
34
- # end
35
- # end
36
-
37
- ret = bib_get1(code, year, opts)
38
- return nil if ret.nil?
39
32
 
40
- # ret = ret.to_most_recent_reference unless year || opts[:keep_year]
41
- # ret = ret.to_all_parts if opts[:all_parts]
42
- ret
33
+ bib_get1(code, year, opts)
43
34
  end
44
35
 
45
36
  private
@@ -67,7 +58,7 @@ module RelatonCen
67
58
  # @param code [String]
68
59
  # @return [RelatonCen::HitCollection]
69
60
  def search_filter(code) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
70
- %r{^CEN\s(?<code1>[^-:]+)(?:-(?<part1>\d+))?} =~ code
61
+ %r{^C?EN\s(?<code1>[^-:]+)(?:-(?<part1>\d+))?} =~ code
71
62
  warn "[relaton-cen] (\"#{code}\") fetching..."
72
63
  result = search(code)
73
64
  result.select do |i|
@@ -5,7 +5,7 @@ require "relaton_cen/hit"
5
5
  module RelatonCen
6
6
  # Page of hit collection.
7
7
  class HitCollection < RelatonBib::HitCollection
8
- DOMAIN = "https://standards.cen.eu/dyn/www/"
8
+ DOMAIN = "https://standards.cencenelec.eu/dyn/www/"
9
9
 
10
10
  # @return [Mechanize]
11
11
  attr_reader :agent
@@ -21,23 +21,25 @@ module RelatonCen
21
21
  return
22
22
  end
23
23
 
24
- search_page = agent.get "#{DOMAIN}f?p=204:105:0:::::"
25
- form = search_page.at "//form"
26
- req_body = form.xpath("//input").map do |f|
27
- next if f[:name].empty? || f[:name] == "f11"
24
+ search_page = agent.get "#{DOMAIN}f?p=205:105:0:::::"
25
+ form = search_page.at "//form[@id='wwvFlowForm']"
26
+ skip_inputs = %w[f11 essentialCookies]
27
+ req_body = form.xpath(".//input").map do |f|
28
+ next if f[:name].empty? || skip_inputs.include?(f[:name])
28
29
 
29
30
  val = case f[:value]
30
31
  when "LANGUAGE_LIST" then 0
31
32
  when "STAND_REF" then ref
32
33
  else
33
34
  case f[:name]
34
- when "p_request" then "S1-S2-S3-S4-S5-S6"
35
+ when "p_request" then "S1-S2-S3-S4-S5-S6-CEN-CLC-"
35
36
  when "f10" then ""
36
37
  else f[:value]
37
38
  end
38
39
  end
39
40
  if f[:name] == "f10" then "f10=#{f[:value]}&f11=#{val}"
40
- else "#{f[:name]}=#{val}"
41
+ else
42
+ "#{f[:name]}=#{val}"
41
43
  end
42
44
  end.compact.join("&")
43
45
  resp = agent.post form[:action], req_body
@@ -2,10 +2,10 @@ require "relaton/processor"
2
2
 
3
3
  module RelatonCen
4
4
  class Processor < Relaton::Processor
5
- def initialize
5
+ def initialize # rubocop:disable Lint/MissingSuper
6
6
  @short = :relaton_cen
7
7
  @prefix = "CEN"
8
- @defaultprefix = %r{^CEN\s}
8
+ @defaultprefix = %r{^C?EN\s}
9
9
  @idtype = "CEN"
10
10
  end
11
11
 
@@ -76,20 +76,20 @@ module RelatonCen
76
76
  # @return [RelatonIsoBib::EditorialGroup]
77
77
  def fetch_editorialgroup(doc) # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
78
78
  code = doc.at("//tr/td/h1/text()").text
79
- title = doc.at("//tr/td/h1/span").text
79
+ title = doc.at("//tr/td[3]/h1").text
80
80
  %r{/(?<type>\w+)(?:\s(?<num>[^/]+))?$} =~ code
81
81
  tc = []
82
82
  COMMITTEES.each do |k, v|
83
83
  next unless code.include? k
84
84
 
85
- t, n = k.split " "
86
- tc << RelatonIsoBib::IsoSubgroup.new(name: v, type: t, number: n)
85
+ t, n = k.split
86
+ tc << RelatonBib::WorkGroup.new(name: v, type: t, number: n)
87
87
  end
88
88
  sc = []
89
89
  if tc.any?
90
- sc << RelatonIsoBib::IsoSubgroup.new(name: title, type: type, number: num)
90
+ sc << RelatonBib::WorkGroup.new(name: title, type: type, number: num)
91
91
  else
92
- tc << RelatonIsoBib::IsoSubgroup.new(name: title, type: type, number: num)
92
+ tc << RelatonBib::WorkGroup.new(name: title, type: type, number: num)
93
93
  end
94
94
  RelatonIsoBib::EditorialGroup.new(technical_committee: tc,
95
95
  subcommittee: sc)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonCen
4
- VERSION = "1.8.pre1"
4
+ VERSION = "1.10.0"
5
5
  end
data/relaton_cen.gemspec CHANGED
@@ -8,13 +8,13 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["Ribose Inc."]
9
9
  spec.email = ["open.source@ribose.com"]
10
10
 
11
- spec.summary = "RelatonItu: retrieve Cenelec Standards for bibliographic use "\
12
- "using the BibliographicItem model"
13
- spec.description = "RelatonItu: retrieve Cenelec Standards for bibliographic use "\
14
- "using the BibliographicItem model"
11
+ spec.summary = "RelatonCen: retrieve Cenelec Standards for "\
12
+ "bibliographic use using the IsoBibliographicItem model"
13
+ spec.description = "RelatonCen: retrieve Cenelec Standards for "\
14
+ "bibliographic use using the IsoBibliographicItem model"
15
15
  spec.homepage = "https://github.com/metanorma/relaton-cen"
16
16
  spec.license = "BSD-2-Clause"
17
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
17
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
18
18
 
19
19
  # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
20
20
 
@@ -33,13 +33,16 @@ Gem::Specification.new do |spec|
33
33
 
34
34
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
35
35
  spec.add_development_dependency "pry-byebug"
36
+ spec.add_development_dependency "rubocop", "~> 1.17.0"
37
+ spec.add_development_dependency "rubocop-performance", "~> 1.11.0"
38
+ spec.add_development_dependency "rubocop-rails", "~> 2.10.0"
36
39
  spec.add_development_dependency "ruby-jing"
37
40
  spec.add_development_dependency "simplecov"
38
41
  spec.add_development_dependency "vcr", "~> 5.0.0"
39
42
  spec.add_development_dependency "webmock"
40
43
 
41
44
  spec.add_dependency "mechanize"
42
- spec.add_dependency "relaton-iso-bib", "~> 1.8.0"
45
+ spec.add_dependency "relaton-iso-bib", "~> 1.10.0"
43
46
 
44
47
  # For more information and examples about making a new gem, checkout our
45
48
  # guide at: https://bundler.io/guides/creating_gem.html
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-cen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.pre1
4
+ version: 1.10.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: 2021-06-01 00:00:00.000000000 Z
11
+ date: 2022-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml
@@ -38,6 +38,48 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.17.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.17.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-performance
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.11.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.11.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 2.10.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 2.10.0
41
83
  - !ruby/object:Gem::Dependency
42
84
  name: ruby-jing
43
85
  requirement: !ruby/object:Gem::Requirement
@@ -114,16 +156,16 @@ dependencies:
114
156
  requirements:
115
157
  - - "~>"
116
158
  - !ruby/object:Gem::Version
117
- version: 1.8.0
159
+ version: 1.10.0
118
160
  type: :runtime
119
161
  prerelease: false
120
162
  version_requirements: !ruby/object:Gem::Requirement
121
163
  requirements:
122
164
  - - "~>"
123
165
  - !ruby/object:Gem::Version
124
- version: 1.8.0
125
- description: 'RelatonItu: retrieve Cenelec Standards for bibliographic use using the
126
- BibliographicItem model'
166
+ version: 1.10.0
167
+ description: 'RelatonCen: retrieve Cenelec Standards for bibliographic use using the
168
+ IsoBibliographicItem model'
127
169
  email:
128
170
  - open.source@ribose.com
129
171
  executables: []
@@ -170,16 +212,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
212
  requirements:
171
213
  - - ">="
172
214
  - !ruby/object:Gem::Version
173
- version: 2.4.0
215
+ version: 2.5.0
174
216
  required_rubygems_version: !ruby/object:Gem::Requirement
175
217
  requirements:
176
- - - ">"
218
+ - - ">="
177
219
  - !ruby/object:Gem::Version
178
- version: 1.3.1
220
+ version: '0'
179
221
  requirements: []
180
222
  rubygems_version: 3.2.3
181
223
  signing_key:
182
224
  specification_version: 4
183
- summary: 'RelatonItu: retrieve Cenelec Standards for bibliographic use using the BibliographicItem
225
+ summary: 'RelatonCen: retrieve Cenelec Standards for bibliographic use using the IsoBibliographicItem
184
226
  model'
185
227
  test_files: []