relaton-iso 1.9.0 → 1.9.1
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.
- checksums.yaml +4 -4
- data/README.adoc +12 -0
- data/lib/relaton_iso/iso_bibliography.rb +6 -6
- data/lib/relaton_iso/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29eb84a194e2b30d8c1c96245b684aa095db3e318bad16f2b79b5a5ac82d3b94
|
4
|
+
data.tar.gz: 9ebd46ccc359db4e25d963569d489f2e8f9ae50e6c76fc3fb77e09ce947525cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7f9ed212717dbf26fd10f8c041d4a182afa4212f9d961c1a7d8dfde3b41d6ad28123feddf2efb405223ae5aac3ec5e07ec12563c597ed2f03c5288270608fd5
|
7
|
+
data.tar.gz: 117fb353efb5922529713e747a4ec6a1de144693ba5af0063b46a2b1ab7814631211a00659705ebc106a8d12b0a2fe338a5c0911ab6fee3b7b48bb41b4e6f727
|
data/README.adoc
CHANGED
@@ -259,6 +259,18 @@ item.title lang: 'fr'
|
|
259
259
|
@script=["Latn"]>
|
260
260
|
----
|
261
261
|
|
262
|
+
=== Typed links
|
263
|
+
|
264
|
+
Each ISO document has `src` type link and optional `obp`, `rss`, and `pub` link types.
|
265
|
+
|
266
|
+
[source,ruby]
|
267
|
+
----
|
268
|
+
item.link
|
269
|
+
=> [#<RelatonBib::TypedUri:0x00007ffdf001eb90 @content=#<Addressable::URI:0xaa0 URI:https://www.iso.org/standard/53798.html>, @type="src">,
|
270
|
+
#<RelatonBib::TypedUri:0x00007ffdf001e960 @content=#<Addressable::URI:0xab4 URI:https://www.iso.org/obp/ui/#!iso:std:53798:en>, @type="obp">,
|
271
|
+
#<RelatonBib::TypedUri:0x00007ffdf001e7a8 @content=#<Addressable::URI:0xac8 URI:https://www.iso.org/contents/data/standard/05/37/53798.detail.rss>, @type="rss">]
|
272
|
+
----
|
273
|
+
|
262
274
|
== Development
|
263
275
|
|
264
276
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -26,14 +26,14 @@ module RelatonIso
|
|
26
26
|
# reference is required, :keep_year if undated reference should
|
27
27
|
# return actual reference with year
|
28
28
|
# @return [String] Relaton XML serialisation of reference
|
29
|
-
def get(ref, year = nil, opts = {}) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
29
|
+
def get(ref, year = nil, opts = {}) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity,Metrics/AbcSize
|
30
30
|
code = ref.gsub(/\u2013/, "-")
|
31
31
|
# %r{\s(?<num>\d+)(?:-(?<part>[\d-]+))?(?::(?<year1>\d{4}))?} =~ code
|
32
32
|
_, _part, year1, = ref_components ref
|
33
33
|
year ||= year1
|
34
34
|
code.sub! " (all parts)", ""
|
35
35
|
opts[:all_parts] ||= $~ && opts[:all_parts].nil?
|
36
|
-
opts[:keep_year] ||= opts[:keep_year].nil?
|
36
|
+
# opts[:keep_year] ||= opts[:keep_year].nil?
|
37
37
|
# code.sub!("#{num}-#{part}", num) if opts[:all_parts] && part
|
38
38
|
# if %r[^ISO/IEC DIR].match? code
|
39
39
|
# return RelatonIec::IecBibliography.get(code, year, opts)
|
@@ -42,7 +42,7 @@ module RelatonIso
|
|
42
42
|
ret = isobib_get1(code, year, opts)
|
43
43
|
return nil if ret.nil?
|
44
44
|
|
45
|
-
if year || opts[:keep_year] || opts[:all_parts]
|
45
|
+
if year && opts[:keep_year].nil? || opts[:keep_year] || opts[:all_parts]
|
46
46
|
ret
|
47
47
|
else
|
48
48
|
ret.to_most_recent_reference
|
@@ -143,11 +143,11 @@ module RelatonIso
|
|
143
143
|
# @param code [String]
|
144
144
|
# @param opts [Hash]
|
145
145
|
# @return [RelatonIso::HitCollection]
|
146
|
-
def search_code(result, code, opts) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity
|
146
|
+
def search_code(result, code, opts) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,PerceivedComplexity
|
147
147
|
code1, part1, _, corr1, coryear1 = ref_components code
|
148
148
|
result.select do |i|
|
149
149
|
code2, part2, _, corr2, coryear2 = ref_components i.hit[:title]
|
150
|
-
code1 == code2 && (opts[:all_parts] && part2 || !opts[:all_parts] && part1 == part2) &&
|
150
|
+
code1 == code2 && ((opts[:all_parts] && part2) || (!opts[:all_parts] && part1 == part2)) &&
|
151
151
|
corr1 == corr2 && (!coryear1 || coryear1 == coryear2)
|
152
152
|
end
|
153
153
|
end
|
@@ -164,7 +164,7 @@ module RelatonIso
|
|
164
164
|
def isobib_results_filter(result, year, opts)
|
165
165
|
missed_years = []
|
166
166
|
hits = result.reduce!([]) do |hts, h|
|
167
|
-
if !year || %r{:(?<iyear>\d{4})(?!.*:\d{4})} =~ h.hit[:title] && iyear == year
|
167
|
+
if !year || (%r{:(?<iyear>\d{4})(?!.*:\d{4})} =~ h.hit[:title] && iyear == year)
|
168
168
|
hts << h
|
169
169
|
else
|
170
170
|
missed_years << iyear
|
data/lib/relaton_iso/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-iso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.1
|
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-
|
11
|
+
date: 2021-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|