relaton-iev 1.1.4 → 1.1.6

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: 5fe2ce99811a0a55a1f458810612cdddc6c496eea33e43a42bc582edaceccde7
4
- data.tar.gz: a1a335641f829d1bc444061806a6982aaa10599aab57fac64223f7af0f328b3d
3
+ metadata.gz: e0619c9879a41243d0c4f23f6b227065d3314052c4dc3c7c245ca04681d53f69
4
+ data.tar.gz: 9494af2352544f18308a3d8d7a16fa524b64f9a580d44f902f5d9735f471ce4e
5
5
  SHA512:
6
- metadata.gz: beb4a621afedd7459552fdcde28dddb87278fd95a9ad9dbc6390410fa7b434abd2823f9ba32f6e0fdbca6eaa3a7119ac77f225ffe7ba5af4ffbad7ad667dea5a
7
- data.tar.gz: f06e7ec49dfb4b2e3bf61a0ae272f632bb7dbdcfdb275275c43b5657f0bb51d11c24cf7db7318b1c9752b00e2f0404956aac7e86ba2cf889f6f5fe96d36a416d
6
+ metadata.gz: 901939408553d30e4bca8fac9e719b2413f4edbcc0433dcc5701044d09dacb5e47f781b8147a91ee5b003bb702913eb15521f777722d9ebddd1436daba15e1ab
7
+ data.tar.gz: 83cd32add7eb3ded410f2d5e3caed88e18b04fe8a42f02b7e624fd508a46ec17ba3f9071932a9adc563e222148271a193f1caa8d772e739d71f6da47706dc25f
@@ -10,27 +10,4 @@ on:
10
10
 
11
11
  jobs:
12
12
  rake:
13
- name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
14
- runs-on: ${{ matrix.os }}
15
- continue-on-error: ${{ matrix.experimental }}
16
- strategy:
17
- fail-fast: false
18
- matrix:
19
- ruby: [ '2.7', '2.6', '2.5', '3.0' ]
20
- os: [ ubuntu-latest, windows-latest, macos-latest ]
21
- experimental: [ false ]
22
- steps:
23
- - uses: actions/checkout@v2
24
- with:
25
- submodules: true
26
-
27
- # https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
28
- - if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
29
- run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
30
-
31
- - uses: ruby/setup-ruby@v1
32
- with:
33
- ruby-version: ${{ matrix.ruby }}
34
- bundler-cache: true
35
-
36
- - run: bundle exec rake
13
+ uses: relaton/support/.github/workflows/rake.yml@master
@@ -0,0 +1,22 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: release
4
+
5
+ on:
6
+ workflow_dispatch:
7
+ inputs:
8
+ next_version:
9
+ description: |
10
+ Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
11
+ required: true
12
+ default: 'skip'
13
+ push:
14
+ tags: [ v* ]
15
+
16
+ jobs:
17
+ release:
18
+ uses: relaton/support/.github/workflows/release.yml@master
19
+ with:
20
+ next_version: ${{ github.event.inputs.next_version }}
21
+ secrets:
22
+ rubygems-api-key: ${{ secrets.RELATON_CI_RUBYGEMS_API_KEY }}
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in relaton_iev.gemspec
4
4
  gemspec
5
+ gem "debug"
@@ -1,3 +1,3 @@
1
1
  module RelatonIev
2
- VERSION = "1.1.4".freeze
2
+ VERSION = "1.1.6".freeze
3
3
  end
data/lib/relaton_iev.rb CHANGED
@@ -1,10 +1,15 @@
1
1
  require "relaton"
2
2
  require "relaton_iev/version"
3
+ require "htmlentities"
3
4
 
4
5
  module RelatonIev
5
6
  class Error < StandardError; end
6
7
 
7
8
  class << self
9
+ IEVPATH = <<~IEV.strip.freeze
10
+ //*[@citeas = 'IEC 60050:2011' or @citeas = 'IEC 60050:2011' or @citeas = 'IEC&#xa0;60050:2011' or @citeas = 'IEC&#xA0;60050:2011']
11
+ IEV
12
+
8
13
  # converts generic IEV citation to citation of IEC 60050-n
9
14
  # assumes IEV citations are of form
10
15
  # <eref type="inline" bibitemid="a" citeas="IEC 60050">
@@ -15,12 +20,12 @@ module RelatonIev
15
20
  # @return [Set<String>]
16
21
  def links_iev2iec60050part(xmldoc)
17
22
  parts = Set.new
18
- xmldoc.xpath("//*[@citeas = 'IEC 60050:2011']").each do |x|
23
+ xmldoc.xpath(IEVPATH).each do |x|
19
24
  m = x&.at(".//locality[@type = 'clause']/referenceFrom")&.text
20
25
  &.sub(/^(\d+).*$/, "\\1") or next
21
26
 
22
27
  parts << m
23
- x["citeas"] = x["citeas"].sub(/60050/, "60050-#{m}")
28
+ x["citeas"] = @c.decode(x["citeas"]).sub(/60050/, "60050-#{m}")
24
29
  x["bibitemid"] = "IEC60050-#{m}"
25
30
  end
26
31
  parts
@@ -29,18 +34,19 @@ module RelatonIev
29
34
  # replace generic IEV reference with references to all extracted
30
35
  # IEV parts
31
36
  #
32
- # @param xmodoc [Nokogiri::XML::Document]
37
+ # @param xml [Nokogiri::XML::Document]
33
38
  # @param parts [Set<String>]
34
39
  # @param iev [Nokogiri::XML::Element]
35
40
  # @param bibdb [Relaton::Db, NilClass]
36
41
  # @return [Nokogiri::XML::Element]
37
- def refs_iev2iec60050part(xmldoc, parts, bibdb = nil)
42
+ def refs_iev2iec60050part(xml, parts, bibdb = nil)
38
43
  new_iev = ""
39
44
  parts.sort.each do |p|
40
45
  hit = bibdb&.fetch("IEC 60050-#{p}", nil, keep_year: true) or next
41
- new_iev += refs_iev2iec60050part1(xmldoc, p, hit)
42
- xmldoc.xpath("//*[@citeas = 'IEC 60050-#{p}:2011']").each do |x|
43
- x["citeas"] = x["citeas"].sub(/:2011$/, ":#{hit.date[0].on(:year)}")
46
+ new_iev += refs_iev2iec60050part1(xml, p, hit)
47
+ xml.xpath(IEVPATH.gsub(/60050/, "60050-#{p}")).each do |x|
48
+ x["citeas"] = @c.decode(x["citeas"])
49
+ .sub(/:2011$/, ":#{hit.date[0].on(:year)}")
44
50
  end
45
51
  end
46
52
  new_iev
@@ -55,8 +61,8 @@ module RelatonIev
55
61
  end
56
62
 
57
63
  def already_contains_ref(xmldoc, part, date)
58
- xmldoc.at("//bibliography//bibitem[not(ancestor::bibitem)]/"\
59
- "docidentifier[@type = 'IEC']"\
64
+ xmldoc.at("//bibliography//bibitem[not(ancestor::bibitem)]/" \
65
+ "docidentifier[@type = 'IEC']" \
60
66
  "[text() = 'IEC 60050-#{part}:#{date}']")
61
67
  end
62
68
 
@@ -64,6 +70,7 @@ module RelatonIev
64
70
  # @param bibdb [Relaton::Db, NilClass]
65
71
  # @return [Nokogiri::XML::Element]
66
72
  def iev_cleanup(xmldoc, bibdb = nil)
73
+ @c = HTMLEntities.new
67
74
  iev = xmldoc.at("//bibitem[docidentifier = 'IEC 60050:2011']") || return
68
75
  parts = links_iev2iec60050part(xmldoc)
69
76
  iev.replace(refs_iev2iec60050part(xmldoc, parts, bibdb))
data/relaton_iev.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  # spec.add_development_dependency "debase"
26
26
  spec.add_development_dependency "pry-byebug"
27
- spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rake", "~> 13.0"
28
28
  spec.add_development_dependency "rspec", "~> 3.0"
29
29
  # spec.add_development_dependency "ruby-debug-ide"
30
30
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency "vcr"
33
33
  spec.add_development_dependency "webmock"
34
34
 
35
- spec.add_dependency "nokogiri", "~> 1.13.0"
35
+ spec.add_dependency "htmlentities", "~> 4.3.4"
36
+ spec.add_dependency "nokogiri", ">= 1.14.0"
36
37
  spec.add_dependency "relaton", ">= 1.6"
37
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iev
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.6
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: 2022-05-11 00:00:00.000000000 Z
11
+ date: 2023-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry-byebug
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -109,19 +109,33 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: nokogiri
112
+ name: htmlentities
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.13.0
117
+ version: 4.3.4
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.13.0
124
+ version: 4.3.4
125
+ - !ruby/object:Gem::Dependency
126
+ name: nokogiri
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 1.14.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 1.14.0
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: relaton
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -144,6 +158,7 @@ extensions: []
144
158
  extra_rdoc_files: []
145
159
  files:
146
160
  - ".github/workflows/rake.yml"
161
+ - ".github/workflows/release.yml"
147
162
  - ".gitignore"
148
163
  - ".rspec"
149
164
  - ".rubocop.yml"
@@ -161,7 +176,7 @@ homepage: https://github.com/metanorma/relaton-iev
161
176
  licenses:
162
177
  - MIT
163
178
  metadata: {}
164
- post_install_message:
179
+ post_install_message:
165
180
  rdoc_options: []
166
181
  require_paths:
167
182
  - lib
@@ -176,8 +191,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
191
  - !ruby/object:Gem::Version
177
192
  version: '0'
178
193
  requirements: []
179
- rubygems_version: 3.3.9
180
- signing_key:
194
+ rubygems_version: 3.1.6
195
+ signing_key:
181
196
  specification_version: 4
182
197
  summary: 'RelatonIev: manipulates IEV references to IEC 60050.'
183
198
  test_files: []