bolognese 1.0.13 → 1.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bolognese/metadata_utils.rb +1 -1
- data/lib/bolognese/readers/citeproc_reader.rb +1 -1
- data/lib/bolognese/utils.rb +2 -0
- data/lib/bolognese/version.rb +1 -1
- data/spec/fixtures/citeproc-no-categories.json +21 -0
- data/spec/readers/citeproc_reader_spec.rb +16 -0
- data/spec/writers/citation_writer_spec.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61bf91a4667cb93a203138920b4d7bea7aa2efa141cc651be0d1202080913c52
|
4
|
+
data.tar.gz: a85fde2e4cb5bc8c62fac70504194f0ce87df31d04f142f4c22a86516600aced
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98c224d7eb0b8bfa93acff99c80ae7eb84e53de3d46fe4e11e498aa2429788c41f4e427c8df4babeb4799ff9903c25fcd5d8649d5b08ecc86e03f0ae798da624
|
7
|
+
data.tar.gz: 17563660463f282bd2f2c049a4199adf7e4a65b978ebe03f4ff794100d1759ae4bb0151b985afd9bdca7e713d1778cc6254b123772d3209eddfcdf4800239415
|
data/Gemfile.lock
CHANGED
@@ -125,7 +125,7 @@ module Bolognese
|
|
125
125
|
"issued" => get_date(dates, "Issued") ? get_date_parts(get_date(dates, "Issued")) : nil,
|
126
126
|
"submitted" => Array.wrap(dates).find { |d| d["dateType"] == "Submitted" }.to_h.fetch("__content__", nil),
|
127
127
|
"abstract" => parse_attributes(descriptions, content: "description", first: true),
|
128
|
-
"container-title" => periodical
|
128
|
+
"container-title" => periodical.present? ? periodical["title"] : publisher,
|
129
129
|
"DOI" => doi,
|
130
130
|
"issue" => issue,
|
131
131
|
"page" => [first_page, last_page].compact.join("-").presence,
|
@@ -76,7 +76,7 @@ module Bolognese
|
|
76
76
|
end
|
77
77
|
id = normalize_id(meta.fetch("id", nil))
|
78
78
|
state = id.present? ? "findable" : "not_found"
|
79
|
-
subjects = Array.wrap(meta.fetch("categories")).map do |s|
|
79
|
+
subjects = Array.wrap(meta.fetch("categories", nil)).map do |s|
|
80
80
|
{ "subject" => s }
|
81
81
|
end
|
82
82
|
|
data/lib/bolognese/utils.rb
CHANGED
data/lib/bolognese/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"type": "post-weblog",
|
3
|
+
"id": "https://doi.org/10.5072/4k3m-nyvg",
|
4
|
+
"DOI": "10.5072/4k3m-nyvg",
|
5
|
+
"URL": "https://blog.datacite.org/eating-your-own-dog-food",
|
6
|
+
"title": "Eating your own Dog Food",
|
7
|
+
"container-title": "DataCite Blog",
|
8
|
+
"publisher": "DataCite",
|
9
|
+
"abstract": "Eating your own dog food is a slang term to describe that an organization should itself use the products and services it provides. For DataCite this means that we should use DOIs with appropriate metadata and strategies for long-term preservation for...",
|
10
|
+
"issued": {
|
11
|
+
"date-parts": [
|
12
|
+
[
|
13
|
+
2016, 12, 20
|
14
|
+
]
|
15
|
+
]
|
16
|
+
},
|
17
|
+
"author": [{
|
18
|
+
"family": "Fenner",
|
19
|
+
"given": "Martin"
|
20
|
+
}]
|
21
|
+
}
|
@@ -26,4 +26,20 @@ describe Bolognese::Metadata, vcr: true do
|
|
26
26
|
expect(subject.publication_year).to eq("2016")
|
27
27
|
end
|
28
28
|
end
|
29
|
+
|
30
|
+
context "get citeproc no categories" do
|
31
|
+
it "BlogPosting" do
|
32
|
+
input = fixture_path + "citeproc-no-categories.json"
|
33
|
+
subject = Bolognese::Metadata.new(input: input)
|
34
|
+
expect(subject.valid?).to be true
|
35
|
+
expect(subject.identifier).to eq("https://doi.org/10.5072/4k3m-nyvg")
|
36
|
+
expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
|
37
|
+
expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting")
|
38
|
+
expect(subject.creator).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Martin Fenner", "type"=>"Person"}])
|
39
|
+
expect(subject.titles).to eq([{"title"=>"Eating your own Dog Food"}])
|
40
|
+
expect(subject.descriptions.first["description"]).to start_with("Eating your own dog food")
|
41
|
+
expect(subject.dates).to eq([{"date"=>"2016-12-20", "dateType"=>"Issued"}])
|
42
|
+
expect(subject.publication_year).to eq("2016")
|
43
|
+
end
|
44
|
+
end
|
29
45
|
end
|
@@ -23,7 +23,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
23
23
|
it "Dataset" do
|
24
24
|
input = "https://doi.org/10.5061/DRYAD.8515"
|
25
25
|
subject = Bolognese::Metadata.new(input: input, from: "datacite")
|
26
|
-
expect(subject.citation).to eq("Ollomo, B., Durand, P., Prugnolle, F., Douzery, E. J. P., Arnathau, C., Nkoghe, D., … Renaud, F. (2011). <i>Data from: A new malaria agent in African hominids.</i> (Version 1) [Data set]. Dryad Digital Repository. https://doi.org/10.5061/dryad.8515")
|
26
|
+
expect(subject.citation).to eq("Ollomo, B., Durand, P., Prugnolle, F., Douzery, E. J. P., Arnathau, C., Nkoghe, D., … Renaud, F. (2011). <i>Data from: A new malaria agent in African hominids.</i> (Version 1) [Data set]. <i>Dryad Digital Repository</i>. Dryad Digital Repository. https://doi.org/10.5061/dryad.8515")
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bolognese
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|
@@ -660,6 +660,7 @@ files:
|
|
660
660
|
- spec/datacite_utils_spec.rb
|
661
661
|
- spec/doi_utils_spec.rb
|
662
662
|
- spec/find_from_format_spec.rb
|
663
|
+
- spec/fixtures/citeproc-no-categories.json
|
663
664
|
- spec/fixtures/citeproc.json
|
664
665
|
- spec/fixtures/codemeta.json
|
665
666
|
- spec/fixtures/crosscite.json
|