relaton-iec 1.10.1 → 1.11.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e449c90e5d42349f83529a764d1eb502658dae2dd993e2597f2051c0ac14b9e
4
- data.tar.gz: 5cfa9fb5734c5467f22de8bd6629c02d60b7f0f3ac13fb06892530519eaa3af3
3
+ metadata.gz: 6ac7a2b47a1a7b746f0a40a5ba93210ef38d6302e155d3b5c52d363e888de9c7
4
+ data.tar.gz: 18253a34039c3b99ad516f0260f7b34c61df0a4a8dd0ed5a32f5bafabc72b7ad
5
5
  SHA512:
6
- metadata.gz: f4c2d5a7969cd29d8cf4311d636bf5ff8f1567acf5e11d003e2b1bfee8dc35df79a9bcfe5d3a9d738eccfb2b8fbb604c00b408873226c7f21734a3fc1b9dfa5b
7
- data.tar.gz: ed09a6035d0f056097f8cf4c0f34f7b0af1d44723e968114f1090652f2aa3ae8aa73ac1f1864f2b45a1ea0ae7696b5082fe18419af286be1a5245c7fcdc82ae9
6
+ metadata.gz: d7ade3ceccc427c5901b59fa90674d781430f9562ea4c64b6d575a538a58fb2c930eda46f790c2bbe9439e0e8c0dcfe92122bed97693560674dda66321778c50
7
+ data.tar.gz: d47eba43051be57244e1985b2311848db19eb5225cdada484b69c4af745eb364e40ab3c0cd745808b9c16378b448049323169844a290fd0710383d7df8bae033
data/Gemfile CHANGED
@@ -1,6 +1,3 @@
1
- Encoding.default_external = Encoding::UTF_8
2
- Encoding.default_internal = Encoding::UTF_8
3
-
4
1
  source "https://rubygems.org"
5
2
 
6
3
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
data/grammars/biblio.rng CHANGED
@@ -677,6 +677,9 @@
677
677
  <zeroOrMore>
678
678
  <ref name="extent"/>
679
679
  </zeroOrMore>
680
+ <optional>
681
+ <ref name="bibliographic_size"/>
682
+ </optional>
680
683
  <zeroOrMore>
681
684
  <ref name="accesslocation"/>
682
685
  </zeroOrMore>
@@ -922,9 +925,29 @@
922
925
  <text/>
923
926
  </element>
924
927
  </define>
928
+ <define name="sizevalue">
929
+ <element name="value">
930
+ <attribute name="type"/>
931
+ <text/>
932
+ </element>
933
+ </define>
934
+ <define name="bibliographic_size">
935
+ <element name="size">
936
+ <oneOrMore>
937
+ <ref name="sizevalue"/>
938
+ </oneOrMore>
939
+ </element>
940
+ </define>
925
941
  <define name="extent">
926
942
  <element name="extent">
927
- <ref name="BibItemLocality"/>
943
+ <choice>
944
+ <zeroOrMore>
945
+ <ref name="locality"/>
946
+ </zeroOrMore>
947
+ <zeroOrMore>
948
+ <ref name="localityStack"/>
949
+ </zeroOrMore>
950
+ </choice>
928
951
  </element>
929
952
  </define>
930
953
  <define name="series">
data/grammars/isodoc.rng CHANGED
@@ -152,9 +152,7 @@
152
152
  <data type="boolean"/>
153
153
  </attribute>
154
154
  </optional>
155
- <oneOrMore>
156
- <ref name="PureTextElement"/>
157
- </oneOrMore>
155
+ <ref name="XrefBody"/>
158
156
  </element>
159
157
  </define>
160
158
  <define name="erefType">
@@ -188,6 +186,42 @@
188
186
  <ref name="PureTextElement"/>
189
187
  </oneOrMore>
190
188
  </define>
189
+ <define name="localityStack">
190
+ <element name="localityStack">
191
+ <optional>
192
+ <attribute name="connective">
193
+ <choice>
194
+ <value>and</value>
195
+ <value>or</value>
196
+ <value>from</value>
197
+ <value>to</value>
198
+ <value/>
199
+ </choice>
200
+ </attribute>
201
+ </optional>
202
+ <zeroOrMore>
203
+ <ref name="locality"/>
204
+ </zeroOrMore>
205
+ </element>
206
+ </define>
207
+ <define name="sourceLocalityStack">
208
+ <element name="sourceLocalityStack">
209
+ <optional>
210
+ <attribute name="connective">
211
+ <choice>
212
+ <value>and</value>
213
+ <value>or</value>
214
+ <value>from</value>
215
+ <value>to</value>
216
+ <value/>
217
+ </choice>
218
+ </attribute>
219
+ </optional>
220
+ <zeroOrMore>
221
+ <ref name="sourceLocality"/>
222
+ </zeroOrMore>
223
+ </element>
224
+ </define>
191
225
  <define name="ul">
192
226
  <element name="ul">
193
227
  <attribute name="id">
@@ -1098,6 +1132,16 @@
1098
1132
  </define>
1099
1133
  </include>
1100
1134
  <!-- end overrides -->
1135
+ <define name="image" combine="choice">
1136
+ <element name="svg">
1137
+ <oneOrMore>
1138
+ <choice>
1139
+ <text/>
1140
+ <ref name="AnyElement"/>
1141
+ </choice>
1142
+ </oneOrMore>
1143
+ </element>
1144
+ </define>
1101
1145
  <define name="MultilingualRenderingType">
1102
1146
  <choice>
1103
1147
  <value>common</value>
@@ -2631,4 +2675,30 @@
2631
2675
  </zeroOrMore>
2632
2676
  </element>
2633
2677
  </define>
2678
+ <define name="XrefBody">
2679
+ <zeroOrMore>
2680
+ <ref name="XrefTarget"/>
2681
+ </zeroOrMore>
2682
+ <oneOrMore>
2683
+ <ref name="PureTextElement"/>
2684
+ </oneOrMore>
2685
+ </define>
2686
+ <define name="XrefTarget">
2687
+ <element name="location">
2688
+ <attribute name="target">
2689
+ <data type="string">
2690
+ <param name="pattern">\i\c*|\c+#\c+</param>
2691
+ </data>
2692
+ </attribute>
2693
+ <attribute name="connective">
2694
+ <choice>
2695
+ <value>and</value>
2696
+ <value>or</value>
2697
+ <value>from</value>
2698
+ <value>to</value>
2699
+ <value/>
2700
+ </choice>
2701
+ </attribute>
2702
+ </element>
2703
+ </define>
2634
2704
  </grammar>
@@ -31,7 +31,7 @@ module RelatonIec
31
31
  all_parts_item = bibitem.to_all_parts
32
32
  parts.reject { |h| h.hit[:code] == hit.hit[:code] }.each do |hi|
33
33
  isobib = RelatonIec::IecBibliographicItem.new(
34
- formattedref: RelatonBib::FormattedRef.new(content: hi.hit[:code])
34
+ formattedref: RelatonBib::FormattedRef.new(content: hi.hit[:code]),
35
35
  )
36
36
  all_parts_item.relation << RelatonBib::DocumentRelation.new(type: "partOf", bibitem: isobib)
37
37
  end
@@ -3,7 +3,7 @@ module RelatonIec
3
3
  TYPES = %w[
4
4
  international-standard technical-specification technical-report
5
5
  publicly-available-specification international-workshop-agreement
6
- guide industry-technical-agreement
6
+ guide industry-technical-agreement system-reference-delivrabble
7
7
  ].freeze
8
8
 
9
9
  FUNCTION = %w[emc safety enviroment quality-assurance].freeze
@@ -25,9 +25,9 @@ module RelatonIec
25
25
  if args[:updates_document_type] &&
26
26
  !TYPES.include?(args[:updates_document_type])
27
27
  warn "[relaton-iec] WARNING: invalid updates_document_type "\
28
- "\"#{args[:updates_document_type]}\""
28
+ "\"#{args[:updates_document_type]}\""
29
29
  warn "[relaton-iec] allowed updates_document_type values are: "\
30
- "#{TYPES.join(', ')}"
30
+ "#{TYPES.join(', ')}"
31
31
  end
32
32
  @function = args.delete :function
33
33
  @updates_document_type = args.delete :updates_document_type
@@ -21,7 +21,7 @@ module RelatonIec
21
21
  # @param part [String, nil] search for packaged stndard if not nil
22
22
  # @return [RelatonIec::HitCollection]
23
23
  def search(text, year = nil, part = nil)
24
- HitCollection.new text.sub(/(^\w+)\//, '\1 '), year&.strip, part
24
+ HitCollection.new text&.sub(/(^\w+)\//, '\1 '), year&.strip, part
25
25
  rescue SocketError, OpenURI::HTTPError, OpenSSL::SSL::SSLError
26
26
  raise RelatonBib::RequestError, "Could not access http://www.iec.ch"
27
27
  end
@@ -32,8 +32,8 @@ module RelatonIec
32
32
  # reference is required
33
33
  # @return [String] Relaton XML serialisation of reference
34
34
  def get(code, year = nil, opts = {}) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
35
- opts[:all_parts] ||= code.match? /\s\(all parts\)/
36
- ref = code.sub /\s\(all parts\)/, ""
35
+ opts[:all_parts] ||= code.match?(/\s\(all parts\)/)
36
+ ref = code.sub(/\s\(all parts\)/, "")
37
37
  if year.nil?
38
38
  /^(?<code1>[^:]+):(?<year1>[^:]+)/ =~ ref
39
39
  unless code1.nil?
@@ -91,10 +91,10 @@ module RelatonIec
91
91
  # @return [RelatonIec::HitCollection]
92
92
  def search_filter(ref, year) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
93
93
  %r{
94
- ^(?<code>\S+[^\d]*\s\d+((?:-\w+)+)?)
95
- (:(?<year1>\d{4}))?
96
- (?<bundle>\+[^\s\/]+)?
97
- (\/(?<corr>AMD\s\d+))?
94
+ ^(?<code>\S+[^\d]*\s\d+(?:-\w+)*)
95
+ (?::(?<year1>\d{4}))?
96
+ (?<bundle>\+[^\s/]+)?
97
+ (?:/(?<corr>AMD\s\d+))?
98
98
  }x =~ ref.upcase
99
99
  year ||= year1
100
100
  corr&.sub! " ", ""
@@ -106,13 +106,12 @@ module RelatonIec
106
106
  end
107
107
  result = search code if result.empty?
108
108
  code = result.text.dup
109
- code&.sub! /((?:-\w+)+)/, ""
109
+ code&.sub!(/((?:-\w+)+)/, "")
110
110
  result.select do |i|
111
111
  %r{
112
- ^(?<code2>\S+[^\d]*\s\d+)((?:-\w+)+)?
113
- (:\d{4})?
114
- (?<bundle2>\+[^\s\/]+)?
115
- (\/(?<corr2>AMD\d+))?
112
+ ^(?<code2>\S+[^\d]*\s\d+)(?:-\w+)*(?::\d{4})?
113
+ (?<bundle2>\+[^\s/]+)?
114
+ (?:/(?<corr2>AMD\d+))?
116
115
  }x =~ i.hit[:code]
117
116
  code == code2 && bundle == bundle2 && corr == corr2
118
117
  end
@@ -17,17 +17,18 @@ module RelatonIec
17
17
 
18
18
  TYPES = {
19
19
  "ISO" => "international-standard",
20
- "TS" => "technicalSpecification",
21
- "TR" => "technicalReport",
22
- "PAS" => "publiclyAvailableSpecification",
23
- "AWI" => "appruvedWorkItem",
24
- "CD" => "committeeDraft",
25
- "FDIS" => "finalDraftInternationalStandard",
26
- "NP" => "newProposal",
27
- "DIS" => "draftInternationalStandard",
28
- "WD" => "workingDraft",
20
+ "TS" => "technical-specification",
21
+ "TR" => "technical-report",
22
+ "PAS" => "publicly-available-specification",
23
+ "AWI" => "appruved-work-item",
24
+ "CD" => "committee-draft",
25
+ "FDIS" => "final-draft-international-standard",
26
+ "NP" => "new-proposal",
27
+ "DIS" => "draft-international-standard",
28
+ "WD" => "working-draft",
29
29
  "R" => "recommendation",
30
30
  "Guide" => "guide",
31
+ "SRD" => "system-reference-delivrabble",
31
32
  }.freeze
32
33
 
33
34
  class << self
@@ -218,9 +219,10 @@ module RelatonIec
218
219
  # @param doc [Nokogiri::HTML::Document]
219
220
  # @return [String]
220
221
  def fetch_type(doc)
221
- doc.at(
222
+ type = doc.at(
222
223
  '//th[contains(., "Publication type")]/following-sibling::td/span',
223
- ).text.downcase.tr " ", "-"
224
+ ).text
225
+ TYPES[type] || type.downcase.tr(" ", "-")
224
226
  end
225
227
 
226
228
  # Fetch titles.
@@ -1,3 +1,3 @@
1
1
  module RelatonIec
2
- VERSION = "1.10.1".freeze
2
+ VERSION = "1.11.2".freeze
3
3
  end
data/relaton_iec.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
27
27
  spec.add_development_dependency "pry-byebug"
28
- spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rake", "~> 13.0"
29
29
  spec.add_development_dependency "rspec", "~> 3.0"
30
30
  spec.add_development_dependency "ruby-jing"
31
31
  spec.add_development_dependency "simplecov"
@@ -33,5 +33,5 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "webmock"
34
34
 
35
35
  spec.add_dependency "addressable"
36
- spec.add_dependency "relaton-iso-bib", "~> 1.10.1"
36
+ spec.add_dependency "relaton-iso-bib", "~> 1.11.0"
37
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.1
4
+ version: 1.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-09 00:00:00.000000000 Z
11
+ date: 2022-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.10.1
145
+ version: 1.11.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 1.10.1
152
+ version: 1.11.0
153
153
  description: 'RelatonIec: retrieve IEC Standards for bibliographic use using the IecBibliographicItem
154
154
  model'
155
155
  email: