relaton-cen 1.14.1 → 1.16.1

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: 97f7e94eea61650c826d444f99d41dd11b0a506b9b5f26b552034db3c5790e69
4
- data.tar.gz: 6490ba9f131c3411b1c3b891a9fd7c9b254d6bfafcfc999d47c0405d53ad2eae
3
+ metadata.gz: a64d7b3c77fcd73b38bc5ce62313141e51da3b0f784532b6ff10da1069a7c528
4
+ data.tar.gz: 6186b2913635bc27fc7cf8ea86961985a809063dc36ca60d75a78976b89949b5
5
5
  SHA512:
6
- metadata.gz: a6fd2c4264184ee2f48a305307234dc7a9d4ccdf8ad5d2073676dd2813868b40996069664231618a1ad791e91e7f715b3084e765746480584eab9cc4f8a42c0c
7
- data.tar.gz: 2fc22a3cbf50790f86fc567eb116344dc0a447f5a476fcc11eb3d61ab451e054efb92906aa46c594ea36d1825d7d146db793f51796d7b8e32c93335fcbb8cfb6
6
+ metadata.gz: ae0b06db552199faef6afda209aa35918b4b486a04e8979c4554527443ac29122e4c6dcb0597e6438898a4dbda24596e7ea436b4810e4becd57eda9415b23e5b
7
+ data.tar.gz: 7a7644ba895afbfe99c9b5601a1cff601ebd7ee00f5ff842507d3f36f2ecd3ae53ecf054c162ac7d852ad435536997df827040604b15fa5f1f7039bb04b024fb
@@ -5,6 +5,7 @@ name: rake
5
5
  on:
6
6
  push:
7
7
  branches: [ master, main ]
8
+ tags: [ v* ]
8
9
  pull_request:
9
10
 
10
11
  jobs:
@@ -7,7 +7,8 @@ on:
7
7
  inputs:
8
8
  next_version:
9
9
  description: |
10
- Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
10
+ Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc).
11
+ Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version
11
12
  required: true
12
13
  default: 'skip'
13
14
  repository_dispatch:
data/.gitignore CHANGED
@@ -6,6 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /vendor/
9
10
 
10
11
  # rspec failure tracking
11
12
  .rspec_status
data/Gemfile CHANGED
@@ -14,5 +14,5 @@ gem "rubocop-performance", "~> 1.11.0"
14
14
  gem "rubocop-rails", "~> 2.10.0"
15
15
  gem "ruby-jing"
16
16
  gem "simplecov"
17
- gem "vcr", "~> 5.0.0"
18
- gem "webmock"
17
+ gem "vcr", "~> 6.2.0"
18
+ gem "webmock", "~> 3.19.0"
data/README.adoc CHANGED
@@ -10,7 +10,7 @@ RelatonCen is a Ruby gem that implements the https://github.com/metanorma/metano
10
10
 
11
11
  == Installation
12
12
 
13
- Add this line to your application's Gemfile:
13
+ Add this line to your application's `Gemfile`:
14
14
 
15
15
  [source,ruby]
16
16
  ----
@@ -19,14 +19,22 @@ gem 'relaton-cen'
19
19
 
20
20
  And then execute:
21
21
 
22
- $ bundle install
22
+ [source,sh]
23
+ ----
24
+ $ bundle install
25
+ ----
23
26
 
24
27
  Or install it yourself as:
25
28
 
26
- $ gem install relaton-cen
29
+ [source,sh]
30
+ ----
31
+ $ gem install relaton-cen
32
+ ----
27
33
 
28
34
  == Usage
29
35
 
36
+ For CENELEC standards, use references with the prefix `CEN/CLC`. For example, `CEN/CLC Guide 6`.
37
+
30
38
  === Search for a standard using keywords
31
39
 
32
40
  [source,ruby]
@@ -42,7 +50,24 @@ item = hit_collection[0].fetch
42
50
  ...
43
51
  ----
44
52
 
53
+ === Get a standard by its code
54
+
55
+ [source,ruby]
56
+ ----
57
+ > RelatonCen::CenBibliography.get "CEN/CLC Guide 6"
58
+ [relaton-cen] (CEN/CLC Guide 6) fetching...
59
+ [isoics] code   not found in ICS list
60
+ [relaton-cen] (CEN/CLC Guide 6) `found CEN/CLC Guide 6`
61
+ =>
62
+ #<RelatonCen::BibliographicItem:0x000000011371cb90
63
+ @abstract=
64
+ [#<RelatonBib::FormattedString:0x000000011371c5f0
65
+ @content=
66
+ "ISO/IEC Guide 71:2014 provides guidance to standards..."
67
+ ----
68
+
45
69
  === XML serialization
70
+
46
71
  [source,ruby]
47
72
  ----
48
73
  item.to_xml
@@ -53,7 +78,9 @@ item.to_xml
53
78
  </bibitem>"
54
79
  ----
55
80
 
56
- With `bibdata: true` option XML output wrapped with `bibdata` element and `ext` element added.
81
+ With `bibdata: true` option XML output wrapped with `bibdata` element and `ext`
82
+ element added.
83
+
57
84
  [source,ruby]
58
85
  ----
59
86
  item.to_xml bibdata: true
@@ -79,22 +106,24 @@ item.link
79
106
  ----
80
107
 
81
108
  === Get code, and year
109
+
82
110
  [source,ruby]
83
111
  ----
84
112
  RelatonCen::CenBibliography.get "CEN ISO/TS 21003-7:2019"
85
- [relaton-cen] ("CEN ISO/TS 21003-7") fetching...
86
- [relaton-cen] ("CEN ISO/TS 21003-7") found CEN ISO/TS 21003-7:2019
113
+ [relaton-cen] (CEN ISO/TS 21003-7) fetching...
114
+ [relaton-cen] (CEN ISO/TS 21003-7) found CEN `ISO/TS 21003-7:2019`
87
115
  => #<RelatonIsoBib::IsoBibliographicItem:0x00007fadcd596c58
88
116
  ...
89
117
 
90
118
  RelatonCen::CenBibliography.get "CEN ISO/TS 21003-7", "2019"
91
- [relaton-cen] ("CEN ISO/TS 21003-7") fetching...
92
- [relaton-cen] ("CEN ISO/TS 21003-7") found CEN ISO/TS 21003-7:2019
119
+ [relaton-cen] (CEN ISO/TS 21003-7) fetching...
120
+ [relaton-cen] (CEN ISO/TS 21003-7) found CEN `ISO/TS 21003-7:2019`
93
121
  => #<RelatonIsoBib::IsoBibliographicItem:0x00007fadcd5df9f8
94
122
  ...
95
123
  ----
96
124
 
97
125
  === Create bibliographic item form YAML
126
+
98
127
  [source,ruby]
99
128
  ----
100
129
  hash = YAML.load_file 'spec/fixtures/bibdata.yaml'
@@ -107,6 +136,7 @@ hash = YAML.load_file 'spec/fixtures/bibdata.yaml'
107
136
  ----
108
137
 
109
138
  === Create bibliographic item from XML
139
+
110
140
  [source,ruby]
111
141
  ----
112
142
  RelatonCen::XMLParser.from_xml File.read("spec/fixtures/bibdata.xml", encoding: "UTF-8")
@@ -114,6 +144,7 @@ RelatonCen::XMLParser.from_xml File.read("spec/fixtures/bibdata.xml", encoding:
114
144
  ...
115
145
  ----
116
146
 
147
+
117
148
  == Development
118
149
 
119
150
  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.
data/grammars/biblio.rng CHANGED
@@ -1283,7 +1283,7 @@
1283
1283
  <value>mergedInto</value>
1284
1284
  <value>splits</value>
1285
1285
  <value>splitInto</value>
1286
- <value>instance</value>
1286
+ <value>instanceOf</value>
1287
1287
  <value>hasInstance</value>
1288
1288
  <value>exemplarOf</value>
1289
1289
  <value>hasExemplar</value>
@@ -101,8 +101,9 @@ module RelatonCen
101
101
  result = search_filter(code) || return
102
102
  ret = isobib_results_filter(result, year)
103
103
  if ret[:ret]
104
- warn "[relaton-cen] (\"#{code}\") found #{ret[:ret].docidentifier.first&.id}"
105
- ret[:ret]
104
+ bib = year ? ret[:ret] : ret[:ret].to_most_recent_reference
105
+ warn "[relaton-cen] (#{code}) found `#{bib.docidentifier.first&.id}`"
106
+ bib
106
107
  else
107
108
  fetch_ref_err(code, year, ret[:years])
108
109
  end
@@ -22,7 +22,7 @@ module RelatonCen
22
22
  search_page = agent.get "#{DOMAIN}f?p=205:105:0:::::"
23
23
  form = search_page.at "//form[@id='wwvFlowForm']"
24
24
  skip_inputs = %w[f11 essentialCookies]
25
- req_body = form.xpath(".//input").map do |f|
25
+ req_body = form.xpath(".//input").filter_map do |f|
26
26
  next if f[:name].empty? || skip_inputs.include?(f[:name])
27
27
 
28
28
  val = case f[:value]
@@ -39,7 +39,7 @@ module RelatonCen
39
39
  else
40
40
  "#{f[:name]}=#{val}"
41
41
  end
42
- end.compact.join("&")
42
+ end.join("&")
43
43
  resp = agent.post form[:action], req_body
44
44
  @array = hits resp
45
45
  sort
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonCen
4
- VERSION = "1.14.1"
4
+ VERSION = "1.16.1"
5
5
  end
data/relaton_cen.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.require_paths = ["lib"]
33
33
 
34
34
  spec.add_dependency "mechanize", "~> 2.8.0"
35
- spec.add_dependency "relaton-iso-bib", "~> 1.14.0"
35
+ spec.add_dependency "relaton-iso-bib", "~> 1.16.0"
36
36
 
37
37
  # For more information and examples about making a new gem, checkout our
38
38
  # guide at: https://bundler.io/guides/creating_gem.html
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-cen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.1
4
+ version: 1.16.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: 2023-05-20 00:00:00.000000000 Z
11
+ date: 2023-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.14.0
33
+ version: 1.16.0
34
34
  type: :runtime
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: 1.14.0
40
+ version: 1.16.0
41
41
  description: 'RelatonCen: retrieve Cenelec Standards for bibliographic use using the
42
42
  IsoBibliographicItem model'
43
43
  email: