relaton-bsi 1.7.pre2 → 1.8.4

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: 2a9dbb231aa5bee1c2d0c60082ef8319396a94cc65d384bb87b3857e510b889d
4
- data.tar.gz: 8a9345054007adae6447d0aaa84f7f8cf6c29a56324e90a47d9df1da556dafad
3
+ metadata.gz: 3e0fb4166ac2e9ff1c644c4e147edf1b6535b02fc3f4304aeb2110f95ab16072
4
+ data.tar.gz: fa5bf3ba88c040260b41d8f47e7b5cfd8f7b32a0ab4d6f568f5d41866ece13a3
5
5
  SHA512:
6
- metadata.gz: 49f0fa4a0b8d3f01cae7cf5d858717ff03f97466bc60834f56ad3b83cbbb4902482cd1870c6e83d6a016963baf99ada7af686bdc0cf20bc18202014a70e20564
7
- data.tar.gz: 7b1f98862ee97a3579fab341279d6fc9bb3d4f2d5225cdda982a3f99f4ed011dcaa3cf0c790d40ac15c5cd3bed6918fc649e6ba79ef4da8b6ec2b06f021ac5e7
6
+ metadata.gz: 253289d6d3ec9022e168345805a1e79d0d6f48130b5d8a75fe78c33ebdf52daf57e6aa797a96d3cf2ea6f61931f8a5c465e11d3f3ad7ccfa4edd1e3655385d87
7
+ data.tar.gz: 289a7a93a4df4617a5c9f14a036bf99d6d46b9e4027fe1a410c0f4ee9f147d0960e0c69d821f8921beda8753b0da77bd445cc04ad2a0bedff32896374e906db2
@@ -16,7 +16,7 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '2.7', '2.6', '2.5', '2.4' ]
19
+ ruby: [ '2.7', '2.6', '2.5' ]
20
20
  os: [ ubuntu-latest, windows-latest, macos-latest ]
21
21
  experimental: [ false ]
22
22
  include:
data/.rubocop.yml CHANGED
@@ -5,6 +5,6 @@
5
5
  inherit_from:
6
6
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
7
  AllCops:
8
- TargetRubyVersion: 2.4
8
+ TargetRubyVersion: 2.5
9
9
  Rails:
10
10
  Enabled: false
data/README.adoc CHANGED
@@ -1,9 +1,7 @@
1
1
  = RelatonBsi retrieve BSI Standards for bibliographic use using the BibliographicItem model
2
2
 
3
3
  image:https://img.shields.io/gem/v/relaton-bsi.svg["Gem Version", link="https://rubygems.org/gems/relaton-bsi"]
4
- image:https://github.com/relaton/relaton-bsi/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton-bsi/actions?workflow=macos"]
5
- image:https://github.com/relaton/relaton-bsi/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/relaton/relaton-bsi/actions?workflow=windows"]
6
- image:https://github.com/relaton/relaton-bsi/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/relaton/relaton-bsi/actions?workflow=ubuntu"]
4
+ image:https://github.com/relaton/relaton-bsi/workflows/rake/badge.svg["Build Status", link="https://github.com/relaton/relaton-bsi/actions?workflow=rake"]
7
5
  image:https://codeclimate.com/github/relaton/relaton-bsi/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/relaton-bsi"]
8
6
  image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-bsi.svg["Pull Requests", link="https://github.com/relaton/relaton-bsi/pulls"]
9
7
  image:https://img.shields.io/github/commits-since/relaton/relaton-bsi/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-bsi/releases"]
@@ -35,7 +33,7 @@ Or install it yourself as:
35
33
  ----
36
34
  require 'relaton_bsi'
37
35
 
38
- hit_collection = RelatonBsi::BsiBibliography.search("BSI BS EN ISO 8848")
36
+ hit_collection = RelatonBsi::BsiBibliography.search("BS EN ISO 8848")
39
37
  => <RelatonBsi::HitCollection:0x007fead49fe1f8 @ref=BS EN ISO 8848 @fetched=false>
40
38
 
41
39
  item = hit_collection[1].fetch
@@ -120,15 +118,15 @@ item.to_xml bibdata: true
120
118
  [source,ruby]
121
119
  ----
122
120
  RelatonBsi::BsiBibliographicItem RelatonBsi::BsiBibliography
123
- [7] pry(main)> RelatonBsi::BsiBibliography.get "BSI BS EN ISO 8848:2021"
124
- [relaton-bsi] ("BSI BS EN ISO 8848:2021") fetching...
125
- [relaton-bsi] ("BSI BS EN ISO 8848:2021") found BS EN ISO 8848:2021
121
+ [7] pry(main)> RelatonBsi::BsiBibliography.get "BS EN ISO 8848:2021"
122
+ [relaton-bsi] ("BS EN ISO 8848:2021") fetching...
123
+ [relaton-bsi] ("BS EN ISO 8848:2021") found BS EN ISO 8848:2021
126
124
  => #<RelatonBsi::BsiBibliographicItem:0x007feb14814ca8
127
125
  ...
128
126
 
129
- RelatonBsi::BsiBibliography.get "BSI BS EN ISO 8848", "2021"
130
- [relaton-bsi] ("BSI BS EN ISO 8848") fetching...
131
- [relaton-bsi] ("BSI BS EN ISO 8848") found BS EN ISO 8848:2021
127
+ RelatonBsi::BsiBibliography.get "BS EN ISO 8848", "2021"
128
+ [relaton-bsi] ("BS EN ISO 8848") fetching...
129
+ [relaton-bsi] ("BS EN ISO 8848") found BS EN ISO 8848:2021
132
130
  => #<RelatonBsi::BsiBibliographicItem:0x007feaf59188a8
133
131
  ...
134
132
  ----
data/lib/relaton_bsi.rb CHANGED
@@ -4,7 +4,7 @@ require_relative "relaton_bsi/version"
4
4
  require "relaton_bsi/bsi_bibliography"
5
5
 
6
6
  module RelatonBsi
7
- # Returns hash of XML reammar
7
+ # Returns hash of XML greammar
8
8
  # @return [String]
9
9
  def self.grammar_hash
10
10
  gem_path = File.expand_path "..", __dir__
@@ -27,11 +27,20 @@ module RelatonBsi
27
27
  # @option opts [Boolean] :bibdata
28
28
  # @option opts [String] :lang language
29
29
  # @return [String] XML
30
- def to_xml(**opts)
30
+ def to_xml(**opts) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
31
31
  super **opts do |b|
32
- if opts[:bibdata]
33
- b.send "price-code", price_code if price_code
34
- b.send "cen-processing", cen_processing unless cen_processing.nil?
32
+ if opts[:bibdata] && (has_ext_attrs? || price_code ||
33
+ !cen_processing.nil?)
34
+ b.ext do
35
+ b.doctype doctype if doctype
36
+ b.horizontal horizontal unless horizontal.nil?
37
+ editorialgroup&.to_xml b
38
+ ics.each { |i| i.to_xml b }
39
+ structuredidentifier&.to_xml b
40
+ b.stagename stagename if stagename
41
+ b.send "price-code", price_code if price_code
42
+ b.send "cen-processing", cen_processing unless cen_processing.nil?
43
+ end
35
44
  end
36
45
  end
37
46
  end
@@ -29,15 +29,9 @@ module RelatonBsi
29
29
  # @param opts [Hash] options; restricted to :all_parts if all-parts reference is required
30
30
  # @return [String] Relaton XML serialisation of reference
31
31
  def get(code, year = nil, opts = {}) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
32
- # if year.nil?
33
- # /^(?<code1>[^\s]+\s[^\s]+)\s\((\d{2}\/)?(?<year1>\d+)\)$/ =~ code
34
- # unless code1.nil?
35
- # code = code1
36
- # year = year1
37
- # end
38
- # end
39
-
40
- ret = bib_get1(code, year, opts)
32
+ c, y = code.split ':'
33
+ year ||= y
34
+ ret = bib_get1(c, year, opts)
41
35
  return nil if ret.nil?
42
36
 
43
37
  # ret = ret.to_most_recent_reference unless year || opts[:keep_year]
@@ -67,8 +61,11 @@ module RelatonBsi
67
61
  end
68
62
 
69
63
  def search_filter(code) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
70
- %r{^BSI\s(?<code1>[^:]+)} =~ code
64
+ # %r{^BSI\s(?<code1>[^:]+)} =~ code
65
+ code1 = code.sub(/^BSI\s/, "")
71
66
  warn "[relaton-bsi] (\"#{code}\") fetching..."
67
+ return [] unless code1
68
+
72
69
  result = search(code)
73
70
  result.select do |i|
74
71
  next true unless i.hit[:code]
@@ -5,7 +5,7 @@ module RelatonBsi
5
5
  def initialize
6
6
  @short = :relaton_bsi
7
7
  @prefix = "BSI"
8
- @defaultprefix = %r{^BSI\s}
8
+ @defaultprefix = %r{^(BSI|BS|PD)\s}
9
9
  @idtype = "BSI"
10
10
  end
11
11
 
@@ -36,8 +36,9 @@ module RelatonBsi
36
36
  # @param doc [Mechanize::Page]
37
37
  # @return [Array<RelatonIsobib::Ics>]
38
38
  def fetch_ics(doc)
39
- ics = doc.at("//tr[th='ICS']/td").text
40
- [RelatonIsoBib::Ics.new(ics)]
39
+ doc.xpath("//tr[th='ICS']/td/node()").map(&:text).reject { |a| a.empty? }.map do |ics|
40
+ RelatonIsoBib::Ics.new(ics)
41
+ end
41
42
  end
42
43
 
43
44
  # Fetch abstracts.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonBsi
4
- VERSION = "1.7.pre2"
4
+ VERSION = "1.8.4"
5
5
  end
data/relaton_bsi.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  "using the BibliographicItem model"
15
15
  spec.homepage = "https://github.com/metanorma/relaton-bsi"
16
16
  spec.license = "BSD-2-Clause"
17
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
17
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
18
18
 
19
19
  spec.metadata["homepage_uri"] = spec.homepage
20
20
  spec.metadata["source_code_uri"] = spec.homepage
@@ -44,6 +44,6 @@ Gem::Specification.new do |spec|
44
44
  spec.add_development_dependency "vcr", "~> 5.0.0"
45
45
  spec.add_development_dependency "webmock"
46
46
 
47
- spec.add_dependency "mechanize"
48
- spec.add_dependency "relaton-iso-bib", "~> 1.7.0"
47
+ spec.add_dependency "mechanize", "~> 2.8.0"
48
+ spec.add_dependency "relaton-iso-bib", "~> 1.8.0"
49
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bsi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.pre2
4
+ version: 1.8.4
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-04-26 00:00:00.000000000 Z
11
+ date: 2021-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml
@@ -98,30 +98,30 @@ dependencies:
98
98
  name: mechanize
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 2.8.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: 2.8.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: relaton-iso-bib
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.7.0
117
+ version: 1.8.0
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.7.0
124
+ version: 1.8.0
125
125
  description: 'RelatonBsi: retrieve BSI Standards for bibliographic use using the BibliographicItem
126
126
  model'
127
127
  email:
@@ -172,14 +172,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
172
  requirements:
173
173
  - - ">="
174
174
  - !ruby/object:Gem::Version
175
- version: 2.4.0
175
+ version: 2.5.0
176
176
  required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ">"
178
+ - - ">="
179
179
  - !ruby/object:Gem::Version
180
- version: 1.3.1
180
+ version: '0'
181
181
  requirements: []
182
- rubygems_version: 3.0.6
182
+ rubygems_version: 3.2.3
183
183
  signing_key:
184
184
  specification_version: 4
185
185
  summary: 'RelatonBsi: retrieve BSI Standards for bibliographic use using the BibliographicItem