bolognese 0.6.3 → 0.6.4

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
  SHA1:
3
- metadata.gz: 019af5df5c06f424579440313912c3841dd717ae
4
- data.tar.gz: 9cd1726770f9685335c7bc5afb7b053e618a1c4e
3
+ metadata.gz: 2690851dd5c74b7e9a5b6e0d896b9fdddf0ee447
4
+ data.tar.gz: 787144fee4b4a236924f6eccd5b70817aec1ae04
5
5
  SHA512:
6
- metadata.gz: 35f06b9c7e9e3960a54614fdc9c16da563da9cf9496b95279c5cb4258cc042d8fcd67214147f857f242e967be4eff83cb57e0143edbf2931e22e33572779ed20
7
- data.tar.gz: 429b51e24ff0db4669d6f0d2a6e6c7aee00e7a7d35ba6e2b09f784b1da63533c1bcf83f4bd8907c03802073c53391d3cf71fd547abb201ee95d69775bd13a0ff
6
+ metadata.gz: b96de50af5318a576b5d2a5f8d17da09bb4bc407137ece77d64f724c6766211360ef50879212c51f36d665766e5d99976344a573237b8fb48f6789d23cfb137c
7
+ data.tar.gz: bca8c0904a38f753d78ddd214dcadb15f065d823eaba55d3004fea8c20d563b3cb752cdc8cdac25a6881b7a5c5cef89edf448992f2768ffbf45813ab54efa0e1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (0.6.3)
4
+ bolognese (0.6.4)
5
5
  activesupport (~> 4.2, >= 4.2.5)
6
6
  bibtex-ruby (~> 4.1)
7
7
  builder (~> 3.2, >= 3.2.2)
data/README.md CHANGED
@@ -8,9 +8,9 @@ Ruby gem and command-line utility for conversion of DOI metadata from and to dif
8
8
 
9
9
  ## Features
10
10
 
11
- Bolognese reads and writes these metadata formats.
11
+ Bolognese reads and/or writes these metadata formats:
12
12
 
13
- <table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides" class="table table-bordered table-striped">
13
+ <table class="table table-bordered table-striped">
14
14
  <thead>
15
15
  <tr>
16
16
  <th>Format</th>
@@ -94,10 +94,9 @@ Show all commands with `bolognese help`:
94
94
 
95
95
  ```
96
96
  Commands:
97
+ bolognese # convert metadata
97
98
  bolognese --version, -v # print the version
98
99
  bolognese help [COMMAND] # Describe available commands or one specific command
99
- bolognese open file # read metadata from file
100
- bolognese read id # read metadata for ID
101
100
  ```
102
101
 
103
102
  ## Examples
@@ -101,12 +101,9 @@ module Bolognese
101
101
  end
102
102
 
103
103
  def bibliographic_metadata
104
- if metadata.dig("crossref", "journal", "journal_article").present?
105
- metadata.dig("crossref", "journal", "journal_article")
106
- else
107
- k = metadata.fetch("crossref", {}).keys.last
108
- metadata.dig("crossref", k).presence || {}
109
- end
104
+ metadata.dig("crossref", "journal", "journal_article").presence ||
105
+ metadata.dig("crossref", "conference", "conference_paper").presence ||
106
+ metadata.dig("crossref", metadata.fetch("crossref", {}).keys.last).presence || {}
110
107
  end
111
108
 
112
109
  def program_metadata
@@ -174,7 +171,7 @@ module Bolognese
174
171
 
175
172
  def people(contributor_role)
176
173
  person = bibliographic_metadata.dig("contributors", "person_name")
177
- Array(person).select { |a| a["contributor_role"] == contributor_role }.map do |a|
174
+ Array.wrap(person).select { |a| a["contributor_role"] == contributor_role }.map do |a|
178
175
  { "@type" => "Person",
179
176
  "@id" => parse_attribute(a["ORCID"]),
180
177
  "givenName" => a["given_name"],
@@ -188,14 +185,14 @@ module Bolognese
188
185
  { "@type" => "Organization",
189
186
  "@id" => normalize_id(f.dig("assertion", "assertion", "__content__")),
190
187
  "name" => f.dig("assertion", "__content__").strip }.compact
191
- end
188
+ end.presence
192
189
  end
193
190
 
194
191
  def date_published
195
- pub_date = bibliographic_metadata.fetch("publication_date", nil) ||
196
- bibliographic_metadata.fetch("acceptance_date", nil)
192
+ pub_date = Array.wrap(bibliographic_metadata.fetch("publication_date", nil)).presence ||
193
+ Array.wrap(bibliographic_metadata.fetch("acceptance_date", nil))
197
194
  if pub_date.present?
198
- get_date_from_parts(pub_date["year"], pub_date["month"], pub_date["day"])
195
+ get_date_from_parts(pub_date.first["year"], pub_date.first["month"], pub_date.first["day"])
199
196
  else
200
197
  nil
201
198
  end
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "0.6.3"
2
+ VERSION = "0.6.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner