cff 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/CITATION.cff +3 -3
- data/lib/cff/formatters/bibtex.rb +11 -3
- data/lib/cff/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3516244b4f8ca79e358adb6a561ea0d1007590b1fc34686eff2566444e465381
|
4
|
+
data.tar.gz: 6ad965bc59a6acf7cfa1a0737ed97bbd994e4fabdb64551eb7bdef6d32411534
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 822d9b5f9e260d6bec6bbf9fa2891951b10319feca11f5c899431c86143fcdbde0b874ec9fcd598307ffd5b731578f8979d712375f65cfd7092617e5bd3dcf02
|
7
|
+
data.tar.gz: 122e43d2a21f50b897204e15d4d497cd95cea23a0de1d25a6efc744ca4316e9c5c09fab681e572e8bf66900a4bd40bcbfdf34ecb19e42168c484ca3bbf852d66
|
data/CHANGES.md
CHANGED
data/CITATION.cff
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# This CITATION.cff file was created by ruby-cff (v 1.0
|
1
|
+
# This CITATION.cff file was created by ruby-cff (v 1.1.0).
|
2
2
|
# Gem: https://rubygems.org/gems/cff
|
3
3
|
# CFF: https://citation-file-format.github.io/
|
4
4
|
|
@@ -21,9 +21,9 @@ keywords:
|
|
21
21
|
- metadata
|
22
22
|
- citation file format
|
23
23
|
- CFF
|
24
|
-
version: 1.0
|
24
|
+
version: 1.1.0
|
25
25
|
doi: 10.5281/zenodo.1184077
|
26
|
-
date-released:
|
26
|
+
date-released: 2023-04-10
|
27
27
|
license: Apache-2.0
|
28
28
|
repository-artifact: https://rubygems.org/gems/cff
|
29
29
|
repository-code: https://github.com/citation-file-format/ruby-cff
|
@@ -38,7 +38,14 @@ module CFF
|
|
38
38
|
'unpublished' => %w[doi note!]
|
39
39
|
}.freeze
|
40
40
|
|
41
|
-
|
41
|
+
# Convert months to three letter abbreviations, as per
|
42
|
+
# https://www.bibtex.com/f/month-field/. Need to downcase from the
|
43
|
+
# built-in set.
|
44
|
+
MONTHS_MAP = Date::ABBR_MONTHNAMES.map do |month|
|
45
|
+
month.downcase unless month.nil?
|
46
|
+
end.freeze
|
47
|
+
|
48
|
+
def self.format(model:, preferred_citation: true) # rubocop:disable Metrics
|
42
49
|
model = select_and_check_model(model, preferred_citation)
|
43
50
|
return if model.nil?
|
44
51
|
|
@@ -50,7 +57,7 @@ module CFF
|
|
50
57
|
publication_data_from_model(model, publication_type, values)
|
51
58
|
|
52
59
|
month, year = month_and_year_from_model(model)
|
53
|
-
values['month'] = month
|
60
|
+
values['month'] = MONTHS_MAP[month.to_i] unless month.empty?
|
54
61
|
values['year'] = year
|
55
62
|
|
56
63
|
values['url'] = url(model)
|
@@ -59,7 +66,8 @@ module CFF
|
|
59
66
|
|
60
67
|
values.reject! { |_, v| v.empty? }
|
61
68
|
sorted_values = values.sort.map do |key, value|
|
62
|
-
|
69
|
+
value = "{#{value}}" unless key == 'month'
|
70
|
+
"#{key} = #{value}"
|
63
71
|
end
|
64
72
|
sorted_values.insert(0, generate_citekey(values))
|
65
73
|
|
data/lib/cff/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Haines
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json_schema
|