relaton-iev 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -24
- data/.github/workflows/release.yml +22 -0
- data/Gemfile +1 -0
- data/lib/relaton_iev/version.rb +1 -1
- data/lib/relaton_iev.rb +16 -9
- data/relaton_iev.gemspec +1 -0
- metadata +21 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2cd82b551994504c5482121426073e8091bf352a511f131e70e77d75d06d74f
|
4
|
+
data.tar.gz: c11b0d0a748373256d9c559dc512f7fb0e5addacbea8cd8dc48df8a2e463f811
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ee22fcdc81379b42e6315975181f5ad5223db695ba2c91460ebd3d1157dc9ba338a8fca0884fecbdff586f9d87e8dffd397705ef6061d4681d8e544bd9023ee
|
7
|
+
data.tar.gz: 12a072393a803fa23c50875b643aa56c5342063d1dd2925661d5352fc0a093bf9c87ed63baec3c517c4a788bcb7465c68dbdb25cb7b23f15a1b5ab76682436a7
|
data/.github/workflows/rake.yml
CHANGED
@@ -10,27 +10,4 @@ on:
|
|
10
10
|
|
11
11
|
jobs:
|
12
12
|
rake:
|
13
|
-
|
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
data/lib/relaton_iev/version.rb
CHANGED
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 60050:2011' or @citeas = 'IEC 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(
|
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
|
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(
|
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(
|
42
|
-
|
43
|
-
x["citeas"] = x["citeas"]
|
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
@@ -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 "htmlentities", "~> 4.3.4"
|
35
36
|
spec.add_dependency "nokogiri", "~> 1.13.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
|
+
version: 1.1.5
|
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:
|
11
|
+
date: 2023-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry-byebug
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: htmlentities
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 4.3.4
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 4.3.4
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: nokogiri
|
113
127
|
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.
|
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: []
|