bolognese 0.14.1 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/Gemfile.lock +26 -12
- data/README.md +8 -1
- data/bolognese.gemspec +4 -1
- data/lib/bolognese.rb +3 -0
- data/lib/bolognese/metadata_utils.rb +23 -0
- data/lib/bolognese/version.rb +1 -1
- data/lib/bolognese/writers/citation_writer.rb +4 -4
- data/lib/bolognese/writers/citeproc_writer.rb +1 -21
- data/spec/writers/citation_writer_spec.rb +8 -8
- metadata +64 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56b32be20dd588df8f23c07a7eb09f45eb2be130b440d7ec495e51808b1fd733
|
4
|
+
data.tar.gz: 32003c5ce802d4d16a68dfe2f6faa590509ae3f1f46e1b7b5a51ce175e6a2623
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c8fbcac163ce7a30c5eb2cdcfcd869c2c1a6b5d6c77c56c639edfa01b2cb17f4e9f09810ebf77399093d1d8626a3d980bbb6d5b939172650eef7a964b6ca1fa
|
7
|
+
data.tar.gz: e2b9346f1bd5e26ed4fdc08876878bf0ddbcd9a381a00d6751eb716c52e314a3b9a747d0ac0f6b43cf25f0e75d515fdfe9645d1e7d744d5629f438c955e1b012
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bolognese (0.
|
4
|
+
bolognese (0.15.1)
|
5
5
|
activesupport (>= 4.2.5, < 6)
|
6
6
|
benchmark_methods (~> 0.7)
|
7
7
|
bibtex-ruby (~> 4.1)
|
8
8
|
builder (~> 3.2, >= 3.2.2)
|
9
|
+
citeproc-ruby (~> 1.1, >= 1.1.10)
|
9
10
|
colorize (~> 0.8.1)
|
11
|
+
csl-styles (~> 1.0, >= 1.0.1.8)
|
12
|
+
edtf (~> 3.0, >= 3.0.4)
|
10
13
|
gender_detector (~> 0.1.2)
|
11
14
|
iso8601 (~> 0.9.1)
|
12
15
|
json-ld (~> 2.1, >= 2.1.2)
|
13
16
|
jsonlint (~> 0.2.0)
|
14
17
|
loofah (~> 2.0, >= 2.0.3)
|
15
18
|
maremma (>= 3.5.7, < 5)
|
16
|
-
namae (~> 0
|
19
|
+
namae (~> 1.0)
|
17
20
|
nokogiri (~> 1.8.1)
|
18
21
|
oj (>= 2.8.3)
|
19
22
|
postrank-uri (~> 1.0, >= 1.0.18)
|
@@ -35,22 +38,33 @@ GEM
|
|
35
38
|
bibtex-ruby (4.4.7)
|
36
39
|
latex-decode (~> 0.0)
|
37
40
|
builder (3.2.3)
|
38
|
-
|
41
|
+
citeproc (1.0.9)
|
42
|
+
namae (~> 1.0)
|
43
|
+
citeproc-ruby (1.1.10)
|
44
|
+
citeproc (~> 1.0, >= 1.0.9)
|
45
|
+
csl (~> 1.5)
|
46
|
+
codeclimate-test-reporter (1.0.9)
|
39
47
|
simplecov (<= 0.13)
|
40
48
|
colorize (0.8.1)
|
41
49
|
concurrent-ruby (1.0.5)
|
42
50
|
crack (0.4.3)
|
43
51
|
safe_yaml (~> 1.0.0)
|
44
52
|
crass (1.0.4)
|
53
|
+
csl (1.5.0)
|
54
|
+
namae (~> 1.0)
|
55
|
+
csl-styles (1.0.1.8)
|
56
|
+
csl (~> 1.0)
|
45
57
|
diff-lcs (1.3)
|
46
58
|
docile (1.1.5)
|
47
|
-
ebnf (1.1.
|
48
|
-
rdf (
|
59
|
+
ebnf (1.1.3)
|
60
|
+
rdf (~> 3.0)
|
49
61
|
sxp (~> 1.0)
|
62
|
+
edtf (3.0.4)
|
63
|
+
activesupport (>= 3.0, < 6.0)
|
50
64
|
excon (0.62.0)
|
51
|
-
faraday (0.15.
|
65
|
+
faraday (0.15.3)
|
52
66
|
multipart-post (>= 1.2, < 3)
|
53
|
-
faraday-encoding (0.0.
|
67
|
+
faraday-encoding (0.0.5)
|
54
68
|
faraday
|
55
69
|
faraday_middleware (0.12.2)
|
56
70
|
faraday (>= 0.7.4, < 1.0)
|
@@ -93,8 +107,8 @@ GEM
|
|
93
107
|
minitest (5.11.3)
|
94
108
|
multi_json (1.13.1)
|
95
109
|
multipart-post (2.0.0)
|
96
|
-
namae (0.
|
97
|
-
nokogiri (1.8.
|
110
|
+
namae (1.0.1)
|
111
|
+
nokogiri (1.8.5)
|
98
112
|
mini_portile2 (~> 2.3.0)
|
99
113
|
oj (2.18.5)
|
100
114
|
postrank-uri (1.0.23)
|
@@ -106,7 +120,7 @@ GEM
|
|
106
120
|
rack-test (0.8.3)
|
107
121
|
rack (>= 1.0, < 3)
|
108
122
|
rake (12.3.1)
|
109
|
-
rdf (3.0.
|
123
|
+
rdf (3.0.4)
|
110
124
|
hamster (~> 3.0)
|
111
125
|
link_header (~> 0.0, >= 0.0.8)
|
112
126
|
rdf-aggregate-repo (2.2.1)
|
@@ -125,7 +139,7 @@ GEM
|
|
125
139
|
rdf-turtle (2.2.2)
|
126
140
|
ebnf (~> 1.1)
|
127
141
|
rdf (>= 2.2, < 4.0)
|
128
|
-
rdf-xsd (3.0.
|
142
|
+
rdf-xsd (3.0.1)
|
129
143
|
rdf (~> 3.0)
|
130
144
|
rspec (3.8.0)
|
131
145
|
rspec-core (~> 3.8.0)
|
@@ -133,7 +147,7 @@ GEM
|
|
133
147
|
rspec-mocks (~> 3.8.0)
|
134
148
|
rspec-core (3.8.0)
|
135
149
|
rspec-support (~> 3.8.0)
|
136
|
-
rspec-expectations (3.8.
|
150
|
+
rspec-expectations (3.8.2)
|
137
151
|
diff-lcs (>= 1.2.0, < 2.0)
|
138
152
|
rspec-support (~> 3.8.0)
|
139
153
|
rspec-mocks (3.8.0)
|
data/README.md
CHANGED
@@ -66,12 +66,19 @@ Bolognese reads and/or writes these metadata formats:
|
|
66
66
|
<td>Yes</td>
|
67
67
|
</tr>
|
68
68
|
<tr>
|
69
|
-
<td><a href='
|
69
|
+
<td><a href='https://citationstyles.org/'>Citeproc JSON</a></td>
|
70
70
|
<td>citeproc</td>
|
71
71
|
<td>application/vnd.citationstyles.csl+json</td>
|
72
72
|
<td>Yes</td>
|
73
73
|
<td>Yes</td>
|
74
74
|
</tr>
|
75
|
+
<tr>
|
76
|
+
<td><a href='https://citationstyles.org/'>Formatted text citation</a></td>
|
77
|
+
<td>citation</td>
|
78
|
+
<td>text/x-bibliography</td>
|
79
|
+
<td>No</td>
|
80
|
+
<td>Yes</td>
|
81
|
+
</tr>
|
75
82
|
<tr>
|
76
83
|
<td><a href='https://codemeta.github.io/'>Codemeta</a></td>
|
77
84
|
<td>codemeta</td>
|
data/bolognese.gemspec
CHANGED
@@ -24,7 +24,10 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_dependency 'bibtex-ruby', '~> 4.1'
|
25
25
|
s.add_dependency 'thor', '~> 0.19'
|
26
26
|
s.add_dependency 'colorize', '~> 0.8.1'
|
27
|
-
s.add_dependency 'namae', '~> 0
|
27
|
+
s.add_dependency 'namae', '~> 1.0'
|
28
|
+
s.add_dependency 'edtf', '~> 3.0', '>= 3.0.4'
|
29
|
+
s.add_dependency 'citeproc-ruby', '~> 1.1', '>= 1.1.10'
|
30
|
+
s.add_dependency 'csl-styles', '~> 1.0', '>= 1.0.1.8'
|
28
31
|
s.add_dependency 'iso8601', '~> 0.9.1'
|
29
32
|
s.add_dependency 'postrank-uri', '~> 1.0', '>= 1.0.18'
|
30
33
|
s.add_dependency 'json-ld', '~> 2.1', '>= 2.1.2'
|
data/lib/bolognese.rb
CHANGED
@@ -339,6 +339,29 @@ module Bolognese
|
|
339
339
|
RDF::Graph.new << JSON::LD::API.toRdf(schema_hsh)
|
340
340
|
end
|
341
341
|
|
342
|
+
def citeproc_hsh
|
343
|
+
{
|
344
|
+
"type" => citeproc_type,
|
345
|
+
"id" => identifier,
|
346
|
+
"categories" => Array.wrap(keywords).map { |k| parse_attributes(k, content: "text", first: true) }.presence,
|
347
|
+
"language" => language,
|
348
|
+
"author" => to_citeproc(author),
|
349
|
+
"editor" => to_citeproc(editor),
|
350
|
+
"issued" => date_published ? get_date_parts(date_published) : nil,
|
351
|
+
"submitted" => date_submitted ? get_date_parts(date_submitted) : nil,
|
352
|
+
"abstract" => parse_attributes(description, content: "text", first: true),
|
353
|
+
"container-title" => container_title,
|
354
|
+
"DOI" => doi,
|
355
|
+
"issue" => issue,
|
356
|
+
"page" => [first_page, last_page].compact.join("-").presence,
|
357
|
+
"publisher" => publisher,
|
358
|
+
"title" => parse_attributes(title, content: "text", first: true),
|
359
|
+
"URL" => b_url,
|
360
|
+
"version" => b_version,
|
361
|
+
"volume" => volume
|
362
|
+
}.compact.symbolize_keys
|
363
|
+
end
|
364
|
+
|
342
365
|
def style
|
343
366
|
@style ||= "apa"
|
344
367
|
end
|
data/lib/bolognese/version.rb
CHANGED
@@ -4,10 +4,10 @@ module Bolognese
|
|
4
4
|
module Writers
|
5
5
|
module CitationWriter
|
6
6
|
def citation
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
cp = CiteProc::Processor.new(style: style, locale: locale, format: 'html')
|
8
|
+
cp.import Array.wrap(citeproc_hsh)
|
9
|
+
bibliography = cp.render :bibliography, id: identifier
|
10
|
+
bibliography.first
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -4,27 +4,7 @@ module Bolognese
|
|
4
4
|
module Writers
|
5
5
|
module CiteprocWriter
|
6
6
|
def citeproc
|
7
|
-
|
8
|
-
"type" => citeproc_type,
|
9
|
-
"id" => identifier,
|
10
|
-
"categories" => Array.wrap(keywords).map { |k| parse_attributes(k, content: "text", first: true) }.presence,
|
11
|
-
"language" => language,
|
12
|
-
"author" => to_citeproc(author),
|
13
|
-
"editor" => to_citeproc(editor),
|
14
|
-
"issued" => date_published ? get_date_parts(date_published) : nil,
|
15
|
-
"submitted" => date_submitted ? get_date_parts(date_submitted) : nil,
|
16
|
-
"abstract" => parse_attributes(description, content: "text", first: true),
|
17
|
-
"container-title" => container_title,
|
18
|
-
"DOI" => doi,
|
19
|
-
"issue" => issue,
|
20
|
-
"page" => [first_page, last_page].compact.join("-").presence,
|
21
|
-
"publisher" => publisher,
|
22
|
-
"title" => parse_attributes(title, content: "text", first: true),
|
23
|
-
"URL" => b_url,
|
24
|
-
"version" => b_version,
|
25
|
-
"volume" => volume
|
26
|
-
}.compact
|
27
|
-
JSON.pretty_generate hsh.presence
|
7
|
+
JSON.pretty_generate citeproc_hsh.presence
|
28
8
|
end
|
29
9
|
end
|
30
10
|
end
|
@@ -9,16 +9,16 @@ describe Bolognese::Metadata, vcr: true do
|
|
9
9
|
subject = Bolognese::Metadata.new(input: input, from: "crossref")
|
10
10
|
expect(subject.style).to eq("apa")
|
11
11
|
expect(subject.locale).to eq("en-US")
|
12
|
-
expect(subject.citation).to eq("Sankar, M., Nieminen, K., Ragni, L., Xenarios, I., & Hardtke, C. S. (2014). Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth.
|
12
|
+
expect(subject.citation).to eq("Sankar, M., Nieminen, K., Ragni, L., Xenarios, I., & Hardtke, C. S. (2014). Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth. <i>ELife</i>, <i>3</i>. https://doi.org/10.7554/elife.01567")
|
13
13
|
end
|
14
14
|
|
15
|
-
it "Journal article vancouver style" do
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
15
|
+
# it "Journal article vancouver style" do
|
16
|
+
# input = "10.7554/eLife.01567"
|
17
|
+
# subject = Bolognese::Metadata.new(input: input, from: "crossref", style: "vancouver", locale: "de-de")
|
18
|
+
# expect(subject.style).to eq("vancouver")
|
19
|
+
# expect(subject.locale).to eq("de-de")
|
20
|
+
# expect(subject.citation).to eq("Sankar M, Nieminen K, Ragni L, Xenarios I, Hardtke CS. Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth. eLife [Internet]. 11. Februar 2014;3. Verfügbar unter: https://elifesciences.org/articles/01567")
|
21
|
+
# end
|
22
22
|
|
23
23
|
it "Dataset" do
|
24
24
|
input = "https://doi.org/10.5061/DRYAD.8515"
|
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: 0.
|
4
|
+
version: 0.15.1
|
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
|
+
date: 2018-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|
@@ -152,14 +152,74 @@ dependencies:
|
|
152
152
|
requirements:
|
153
153
|
- - "~>"
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
version: 0
|
155
|
+
version: '1.0'
|
156
|
+
type: :runtime
|
157
|
+
prerelease: false
|
158
|
+
version_requirements: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - "~>"
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '1.0'
|
163
|
+
- !ruby/object:Gem::Dependency
|
164
|
+
name: edtf
|
165
|
+
requirement: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - "~>"
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '3.0'
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: 3.0.4
|
156
173
|
type: :runtime
|
157
174
|
prerelease: false
|
158
175
|
version_requirements: !ruby/object:Gem::Requirement
|
159
176
|
requirements:
|
160
177
|
- - "~>"
|
161
178
|
- !ruby/object:Gem::Version
|
162
|
-
version: 0
|
179
|
+
version: '3.0'
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: 3.0.4
|
183
|
+
- !ruby/object:Gem::Dependency
|
184
|
+
name: citeproc-ruby
|
185
|
+
requirement: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - "~>"
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '1.1'
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: 1.1.10
|
193
|
+
type: :runtime
|
194
|
+
prerelease: false
|
195
|
+
version_requirements: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - "~>"
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '1.1'
|
200
|
+
- - ">="
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: 1.1.10
|
203
|
+
- !ruby/object:Gem::Dependency
|
204
|
+
name: csl-styles
|
205
|
+
requirement: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
207
|
+
- - "~>"
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '1.0'
|
210
|
+
- - ">="
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
version: 1.0.1.8
|
213
|
+
type: :runtime
|
214
|
+
prerelease: false
|
215
|
+
version_requirements: !ruby/object:Gem::Requirement
|
216
|
+
requirements:
|
217
|
+
- - "~>"
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
version: '1.0'
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: 1.0.1.8
|
163
223
|
- !ruby/object:Gem::Dependency
|
164
224
|
name: iso8601
|
165
225
|
requirement: !ruby/object:Gem::Requirement
|