relaton-bib 1.7.1 → 1.7.2

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: e9ebdb538f6fb256157a23a01994bb4654df470e7d9abe245d8de7ff88d5fecf
4
- data.tar.gz: 56e5146c1d0a6f0c02c12d17d30a3041bb3eabff1b54e0c6f0478f7c7a4743ac
3
+ metadata.gz: b3035696b10da4bcbf4adf75f8eca150fe15ffa9a729b21f721307d6d4e03c63
4
+ data.tar.gz: 9b43ee47cd051f7cfbff05e14f8a31eaaf0dbce1721e105356a6c215dc22ab40
5
5
  SHA512:
6
- metadata.gz: 692cce83ac3ce023196a5dd6a06ed30a07cfb442407c02249e948866932db7d0c81a49a7aa8b34afa05c995e9cbcbccdbb7141bd10e699657b545ec3d906918a
7
- data.tar.gz: c823d2926c8c50810c2989de01f06afbd47e104ff458269d8c17db79e2281550d499d5f267fa1324924005a15de86111b52c2b3cc62142140d09fb9526b14025
6
+ metadata.gz: e12995f779d549a6e014815b6f4249d7e0528282192c5ef7da6ab40c1bc624278d3ead2f3fedb01bba09d60576424beead0a01e21a6f7e8209362e175e458a2e
7
+ data.tar.gz: 7a7b94d82f2dc38d772dc09da89eacc80c5860e4748b2f240a94dd8f7b7d7a7f949ac4508cdfbfa20f81fb8e1b63c5a61ad959258601717a3aaf0a5957be22d9
@@ -0,0 +1,46 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: rake
4
+
5
+ on:
6
+ push:
7
+ branches: [ master, main ]
8
+ tags: [ v* ]
9
+ pull_request:
10
+
11
+ jobs:
12
+ rake:
13
+ name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
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', '2.4' ]
20
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
21
+ experimental: [ false ]
22
+ include:
23
+ - ruby: '3.0'
24
+ os: 'ubuntu-latest'
25
+ experimental: true
26
+ - ruby: '3.0'
27
+ os: 'windows-latest'
28
+ experimental: true
29
+ - ruby: '3.0'
30
+ os: 'macos-latest'
31
+ experimental: true
32
+ steps:
33
+ - uses: actions/checkout@v2
34
+ with:
35
+ submodules: true
36
+
37
+ # https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
38
+ - if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
39
+ run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
40
+
41
+ - uses: ruby/setup-ruby@v1
42
+ with:
43
+ ruby-version: ${{ matrix.ruby }}
44
+ bundler-cache: true
45
+
46
+ - run: bundle exec rake
@@ -197,23 +197,23 @@ module RelatonBib
197
197
  @title = TypedTitleStringCollection.new(args[:title])
198
198
 
199
199
  @date = (args[:date] || []).map do |d|
200
- d.is_a?(Hash) ? BibliographicDate.new(d) : d
200
+ d.is_a?(Hash) ? BibliographicDate.new(**d) : d
201
201
  end
202
202
 
203
203
  @contributor = (args[:contributor] || []).map do |c|
204
204
  if c.is_a? Hash
205
- e = c[:entity].is_a?(Hash) ? Organization.new(c[:entity]) : c[:entity]
205
+ e = c[:entity].is_a?(Hash) ? Organization.new(**c[:entity]) : c[:entity]
206
206
  ContributionInfo.new(entity: e, role: c[:role])
207
207
  else c
208
208
  end
209
209
  end
210
210
 
211
211
  @abstract = (args[:abstract] || []).map do |a|
212
- a.is_a?(Hash) ? FormattedString.new(a) : a
212
+ a.is_a?(Hash) ? FormattedString.new(**a) : a
213
213
  end
214
214
 
215
215
  @copyright = args.fetch(:copyright, []).map do |c|
216
- c.is_a?(Hash) ? CopyrightAssociation.new(c) : c
216
+ c.is_a?(Hash) ? CopyrightAssociation.new(**c) : c
217
217
  end
218
218
 
219
219
  @docidentifier = args[:docid] || []
@@ -229,7 +229,7 @@ module RelatonBib
229
229
  @status = args[:docstatus]
230
230
  @relation = DocRelationCollection.new(args[:relation] || [])
231
231
  @link = args.fetch(:link, []).map do |s|
232
- if s.is_a?(Hash) then TypedUri.new(s)
232
+ if s.is_a?(Hash) then TypedUri.new(**s)
233
233
  elsif s.is_a?(String) then TypedUri.new(content: s)
234
234
  else s
235
235
  end
@@ -1,4 +1,8 @@
1
- require "bibtex"
1
+ if RUBY_VERSION < "3"
2
+ require "bibtex"
3
+ else
4
+ warn "[relaton-bib] WARNING: BibTex isn't supported with Ruby 3+"
5
+ end
2
6
  require "iso639"
3
7
 
4
8
  module RelatonBib
@@ -101,14 +105,14 @@ module RelatonBib
101
105
  if bibtex["organization"]
102
106
  contributor << {
103
107
  entity: { name: bibtex.organization.to_s },
104
- role: [{ type: "distributor", description: ["sponsor"] }]
108
+ role: [{ type: "distributor", description: ["sponsor"] }],
105
109
  }
106
110
  end
107
111
 
108
112
  if bibtex["school"]
109
113
  contributor << {
110
114
  entity: { name: bibtex.school.to_s },
111
- role: [{ type: "distributor", description: ["sponsor"] }]
115
+ role: [{ type: "distributor", description: ["sponsor"] }],
112
116
  }
113
117
  end
114
118
  contributor
@@ -30,7 +30,7 @@ module RelatonBib
30
30
  end
31
31
 
32
32
  @owner = owner.map do |o|
33
- o.is_a?(Hash) ? ContributionInfo.new(entity: Organization.new(o)) : o
33
+ o.is_a?(Hash) ? ContributionInfo.new(entity: Organization.new(**o)) : o
34
34
  end
35
35
 
36
36
  @from = Date.strptime(from.to_s, "%Y") if from.to_s.match? /\d{4}/
@@ -18,7 +18,7 @@ module RelatonBib
18
18
  # RelatonBib::SourceLocalityStack>] :source_locality
19
19
  # @option relation [RelatonBib::BibliographicItem, NillClass] :bibitem (nil)
20
20
  def initialize(relation)
21
- @array = relation.map { |r| r.is_a?(Hash) ? DocumentRelation.new(r) : r }
21
+ @array = relation.map { |r| r.is_a?(Hash) ? DocumentRelation.new(**r) : r }
22
22
  end
23
23
 
24
24
  # @todo We don't have replace type anymore. Suppose we should update this
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module RelatonBib
3
4
  # Document status.
4
5
  class DocumentStatus
@@ -54,7 +55,7 @@ module RelatonBib
54
55
  # @return [RelatonBib::DocumentStatus::Stage]
55
56
  def stage_new(stg)
56
57
  if stg.is_a?(Stage) then stg
57
- elsif stg.is_a?(Hash) then Stage.new(stg)
58
+ elsif stg.is_a?(Hash) then Stage.new(**stg)
58
59
  elsif stg.is_a?(String) then Stage.new(value: stg)
59
60
  end
60
61
  end
@@ -97,7 +97,7 @@ module RelatonBib
97
97
  return unless ret[:place]
98
98
 
99
99
  ret[:place] = array(ret[:place]).map do |pl|
100
- pl.is_a?(String) ? Place.new(name: pl) : Place.new(pl)
100
+ pl.is_a?(String) ? Place.new(name: pl) : Place.new(**pl)
101
101
  end
102
102
  end
103
103
 
@@ -146,7 +146,7 @@ module RelatonBib
146
146
  ret[:biblionote] = array(ret[:biblionote])
147
147
  .reduce(BiblioNoteCollection.new([])) do |mem, n|
148
148
  mem << if n.is_a?(String) then BiblioNote.new content: n
149
- else BiblioNote.new(n)
149
+ else BiblioNote.new(**n)
150
150
  end
151
151
  end
152
152
  end
@@ -247,10 +247,10 @@ module RelatonBib
247
247
  script: d[:script], format: d[:format] }
248
248
  else { content: d }
249
249
  end
250
- FormattedString.new cnt
250
+ FormattedString.new **cnt
251
251
  end
252
252
  Affiliation.new(
253
- organization: Organization.new(org_hash_to_bib(a[:organization])),
253
+ organization: Organization.new(**org_hash_to_bib(a[:organization])),
254
254
  description: a[:description]
255
255
  )
256
256
  end
@@ -288,7 +288,7 @@ module RelatonBib
288
288
  ret[:relation] = array(ret[:relation])
289
289
  ret[:relation]&.each do |r|
290
290
  if r[:description]
291
- r[:description] = FormattedString.new r[:description]
291
+ r[:description] = FormattedString.new **r[:description]
292
292
  end
293
293
  relation_bibitem_hash_to_bib(r)
294
294
  relation_locality_hash_to_bib(r)
@@ -309,7 +309,7 @@ module RelatonBib
309
309
  # @param item_hash [Hash]
310
310
  # @return [RelatonBib::BibliographicItem]
311
311
  def bib_item(item_hash)
312
- BibliographicItem.new item_hash
312
+ BibliographicItem.new **item_hash
313
313
  end
314
314
 
315
315
  # @param rel [Hash] relation
@@ -356,26 +356,26 @@ module RelatonBib
356
356
  end
357
357
  s[:abbreviation] &&
358
358
  s[:abbreviation] = localizedstring(s[:abbreviation])
359
- Series.new(s)
359
+ Series.new(**s)
360
360
  end
361
361
  end
362
362
 
363
363
  # @param title [Hash]
364
364
  # @return [RelatonBib::TypedTitleString]
365
365
  def typed_title_strig(title)
366
- TypedTitleString.new title
366
+ TypedTitleString.new **title
367
367
  end
368
368
 
369
369
  # @param ret [Hash]
370
370
  def medium_hash_to_bib(ret)
371
- ret[:medium] = Medium.new(ret[:medium]) if ret[:medium]
371
+ ret[:medium] = Medium.new(**ret[:medium]) if ret[:medium]
372
372
  end
373
373
 
374
374
  # @param ret [Hash]
375
375
  def classification_hash_to_bib(ret)
376
376
  if ret[:classification]
377
377
  ret[:classification] = array(ret[:classification]).map do |cls|
378
- Classification.new cls
378
+ Classification.new **cls
379
379
  end
380
380
  end
381
381
  end
@@ -409,7 +409,7 @@ module RelatonBib
409
409
  return unless ret[:editorialgroup]
410
410
 
411
411
  technical_committee = array(ret[:editorialgroup]).map do |wg|
412
- TechnicalCommittee.new WorkGroup.new(wg)
412
+ TechnicalCommittee.new WorkGroup.new(**wg)
413
413
  end
414
414
  ret[:editorialgroup] = EditorialGroup.new technical_committee
415
415
  end
@@ -418,7 +418,7 @@ module RelatonBib
418
418
  def ics_hash_to_bib(ret)
419
419
  return unless ret[:ics]
420
420
 
421
- ret[:ics] = array(ret[:ics]).map { |ics| ICS.new ics }
421
+ ret[:ics] = array(ret[:ics]).map { |ics| ICS.new **ics }
422
422
  end
423
423
 
424
424
  # @param ret [Hash]
@@ -427,7 +427,7 @@ module RelatonBib
427
427
 
428
428
  sids = array(ret[:structuredidentifier]).map do |si|
429
429
  si[:agency] = array si[:agency]
430
- StructuredIdentifier.new si
430
+ StructuredIdentifier.new **si
431
431
  end
432
432
  ret[:structuredidentifier] = StructuredIdentifierCollection.new sids
433
433
  end
@@ -485,7 +485,7 @@ module RelatonBib
485
485
  # @return [RelatonBib::FormattedRef]
486
486
  def formattedref(frf)
487
487
  if frf.is_a?(Hash)
488
- RelatonBib::FormattedRef.new(frf)
488
+ RelatonBib::FormattedRef.new(**frf)
489
489
  else
490
490
  RelatonBib::FormattedRef.new(content: frf)
491
491
  end
@@ -82,7 +82,7 @@ module RelatonBib
82
82
  @subdivision = (args[:subdivision] || []).map do |sd|
83
83
  localized_string sd
84
84
  end
85
- @identifier = args.fetch(:identifier, [])
85
+ @identifier = args.fetch(:identifier, [])
86
86
  end
87
87
 
88
88
  # @param opts [Hash]
@@ -8,7 +8,7 @@ module RelatonBib
8
8
  # @param title [Array<RelatonBib::TypedTitleString, Hash>]
9
9
  def initialize(title = [])
10
10
  @array = (title || []).map do |t|
11
- t.is_a?(Hash) ? TypedTitleString.new(t) : t
11
+ t.is_a?(Hash) ? TypedTitleString.new(**t) : t
12
12
  end
13
13
  end
14
14
 
@@ -96,12 +96,12 @@ module RelatonBib
96
96
  fsargs = args.select do |k, _v|
97
97
  %i[content language script format].include? k
98
98
  end
99
- @title = FormattedString.new(fsargs)
99
+ @title = FormattedString.new(**fsargs)
100
100
  end
101
101
  end
102
102
 
103
103
  # @param title [String]
104
- # @return [Array<self>]
104
+ # @return [TypedTitleStringCollection]
105
105
  def self.from_string(title, lang = nil, script = nil)
106
106
  types = %w[title-intro title-main title-part]
107
107
  ttls = split_title(title)
@@ -1,3 +1,3 @@
1
1
  module RelatonBib
2
- VERSION = "1.7.1".freeze
2
+ VERSION = "1.7.2".freeze
3
3
  end
@@ -326,7 +326,7 @@ module RelatonBib
326
326
 
327
327
  # @param item [Nokogiri::XML::Element]
328
328
  # @return [Array<RelatonBib::CopyrightAssociation>]
329
- def fetch_copyright(item)
329
+ def fetch_copyright(item) # rubocop:disable Metrics/AbcSize
330
330
  item.xpath("./copyright").map do |cp|
331
331
  owner = cp.xpath("owner").map do |o|
332
332
  ContributionInfo.new entity: get_org(o.at("organization"))
@@ -376,7 +376,7 @@ module RelatonBib
376
376
  # @param item_hash [Hash]
377
377
  # @return [RelatonBib::BibliographicItem]
378
378
  def bib_item(item_hash)
379
- BibliographicItem.new item_hash
379
+ BibliographicItem.new **item_hash
380
380
  end
381
381
 
382
382
  # @param rel [Nokogiri::XML::Element]
@@ -453,7 +453,7 @@ module RelatonBib
453
453
 
454
454
  # @param ext [Nokogiri::XML::Element]
455
455
  # @return [RelatonBib::StructuredIdentifierCollection]
456
- def fetch_structuredidentifier(ext) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity
456
+ def fetch_structuredidentifier(ext) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
457
457
  return unless ext
458
458
 
459
459
  sids = ext.xpath("structuredidentifier").map do |si|
data/relaton-bib.gemspec CHANGED
@@ -24,13 +24,13 @@ Gem::Specification.new do |spec|
24
24
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
25
25
 
26
26
  spec.add_development_dependency "byebug"
27
- spec.add_development_dependency "debase"
27
+ spec.add_development_dependency "debase" if RUBY_VERSION < "3"
28
28
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
29
29
  spec.add_development_dependency "rake", "~> 10.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
- spec.add_development_dependency "ruby-debug-ide"
31
+ spec.add_development_dependency "ruby-debug-ide" if RUBY_VERSION < "3"
32
32
  spec.add_development_dependency "ruby-jing"
33
- spec.add_development_dependency "simplecov"
33
+ spec.add_development_dependency "simplecov" if RUBY_VERSION < "3"
34
34
 
35
35
  spec.add_dependency "addressable"
36
36
  spec.add_dependency "bibtex-ruby"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-23 00:00:00.000000000 Z
11
+ date: 2021-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -185,9 +185,7 @@ executables: []
185
185
  extensions: []
186
186
  extra_rdoc_files: []
187
187
  files:
188
- - ".github/workflows/macos.yml"
189
- - ".github/workflows/ubuntu.yml"
190
- - ".github/workflows/windows.yml"
188
+ - ".github/workflows/rake.yml"
191
189
  - ".gitignore"
192
190
  - ".gitmodules"
193
191
  - ".hound.yml"
@@ -1,40 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: macos
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- branches: [ '**' ]
10
-
11
- jobs:
12
- test-macos:
13
- name: Test on Ruby ${{ matrix.ruby }} macOS
14
- runs-on: macos-latest
15
- strategy:
16
- fail-fast: false
17
- matrix:
18
- ruby: [ '2.6', '2.5', '2.4' ]
19
- steps:
20
- - uses: actions/checkout@master
21
- - name: Checkout submodules
22
- shell: bash
23
- run: |
24
- auth_header="$(git config --local --get http.https://github.com/.extraheader)"
25
- git submodule sync --recursive
26
- git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
27
- - name: Use Ruby
28
- uses: actions/setup-ruby@v1
29
- with:
30
- ruby-version: ${{ matrix.ruby }}
31
- architecture: 'x64'
32
- - name: Update gems
33
- run: |
34
- sudo gem install bundler --force
35
- ruby -v | grep 2.5 && bundle config set build.debase --with-cflags="-Wno-error=implicit-function-declaration"
36
- ruby -v | grep 2.5 && bundle config set build.ruby-debug-ide --with-cflags="-Wno-error=implicit-function-declaration"
37
- bundle install --jobs 4 --retry 3
38
- - name: Run specs
39
- run: |
40
- bundle exec rake
@@ -1,39 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: ubuntu
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- branches: [ '**' ]
10
-
11
- jobs:
12
- test-linux:
13
- name: Test on Ruby ${{ matrix.ruby }} Ubuntu
14
- runs-on: ubuntu-latest
15
- strategy:
16
- fail-fast: false
17
- matrix:
18
- ruby: [ '2.6', '2.5', '2.4' ]
19
- steps:
20
- - uses: actions/checkout@master
21
- - name: Checkout submodules
22
- shell: bash
23
- run: |
24
- auth_header="$(git config --local --get http.https://github.com/.extraheader)"
25
- git submodule sync --recursive
26
- git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
27
- - name: Use Ruby
28
- uses: actions/setup-ruby@v1
29
- with:
30
- ruby-version: ${{ matrix.ruby }}
31
- architecture: 'x64'
32
- - name: Update gems
33
- run: |
34
- gem install bundler
35
- bundle install --jobs 4 --retry 3
36
- - name: Run specs
37
- run: |
38
- unset JAVA_TOOL_OPTIONS
39
- bundle exec rake
@@ -1,41 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: windows
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- branches: [ '**' ]
10
-
11
- jobs:
12
- test-windows:
13
- name: Test on Ruby ${{ matrix.ruby }} Windows
14
- runs-on: windows-latest
15
- strategy:
16
- fail-fast: false
17
- matrix:
18
- ruby: [ '2.6', '2.5', '2.4' ]
19
- steps:
20
- - uses: actions/checkout@master
21
- - name: Checkout submodules
22
- shell: bash
23
- run: |
24
- auth_header="$(git config --local --get http.https://github.com/.extraheader)"
25
- git submodule sync --recursive
26
- git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
27
- - name: Use Ruby
28
- uses: actions/setup-ruby@v1
29
- with:
30
- ruby-version: ${{ matrix.ruby }}
31
- architecture: 'x64'
32
- - name: Update gems
33
- shell: pwsh
34
- run: |
35
- gem install bundler
36
- bundle config --local path vendor/bundle
37
- bundle update
38
- bundle install --jobs 4 --retry 3
39
- - name: Run specs
40
- run: |
41
- bundle exec rake