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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c03256162a043a8d8842d3cd31d95dad25487cdde4992b34d44951c650421c3d
4
- data.tar.gz: '0295b78c2fbfaaa848e07bb46fabfed6a4ea44c0af0f5e865bf1b25333a4e376'
3
+ metadata.gz: 29eb84a194e2b30d8c1c96245b684aa095db3e318bad16f2b79b5a5ac82d3b94
4
+ data.tar.gz: 9ebd46ccc359db4e25d963569d489f2e8f9ae50e6c76fc3fb77e09ce947525cb
5
5
  SHA512:
6
- metadata.gz: f34e505b97d03f6e8ed481ee87036e51d8748e81e9ab77ea78fda8c7764eca21942a033a06c5e363b0ffacee648e3125cf93a1254897ab60512877836177ce3c
7
- data.tar.gz: 9266cb080c0e888b9f6ffaa151d5bc118a6f3b73655cf3f9c8f9d1727dd98e779eef2047f977d492f54c668b58d5f23663374bf2adb8fe306b97f06558b3e973
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonIso
4
- VERSION = "1.9.0"
4
+ VERSION = "1.9.1"
5
5
  end
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.0
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-08-26 00:00:00.000000000 Z
11
+ date: 2021-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug