bolognese 0.6.3 → 0.6.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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -4
- data/lib/bolognese/crossref.rb +8 -11
- data/lib/bolognese/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2690851dd5c74b7e9a5b6e0d896b9fdddf0ee447
|
4
|
+
data.tar.gz: 787144fee4b4a236924f6eccd5b70817aec1ae04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b96de50af5318a576b5d2a5f8d17da09bb4bc407137ece77d64f724c6766211360ef50879212c51f36d665766e5d99976344a573237b8fb48f6789d23cfb137c
|
7
|
+
data.tar.gz: bca8c0904a38f753d78ddd214dcadb15f065d823eaba55d3004fea8c20d563b3cb752cdc8cdac25a6881b7a5c5cef89edf448992f2768ffbf45813ab54efa0e1
|
data/Gemfile.lock
CHANGED
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
|
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
|
data/lib/bolognese/crossref.rb
CHANGED
@@ -101,12 +101,9 @@ module Bolognese
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def bibliographic_metadata
|
104
|
-
|
105
|
-
|
106
|
-
|
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
|
data/lib/bolognese/version.rb
CHANGED