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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 734e15765062e2b7f6a00f25f89edec38c560be9c06605066dc8999ba6d46128
4
- data.tar.gz: 3ad6ed8ff24203d521b356c2f5b73c304e501522f8b43b3aa7b7b890c54d59d9
3
+ metadata.gz: 3516244b4f8ca79e358adb6a561ea0d1007590b1fc34686eff2566444e465381
4
+ data.tar.gz: 6ad965bc59a6acf7cfa1a0737ed97bbd994e4fabdb64551eb7bdef6d32411534
5
5
  SHA512:
6
- metadata.gz: c873384b8a5dc7daea84ca0f184c457da397c4e21c9fbd64438328343bdd31481bfd7e4c48193fe074e8863961268f0adb72748e0aa73578cfffa80868366f56
7
- data.tar.gz: 1a9f094a9d8f7739b6a118fb1b789f54eb58e961eab94fb864a604d3736e9dbf0567031372debba753f68fe4d59f43c348687bb6ab1cf747aba045d7abe267ac
6
+ metadata.gz: 822d9b5f9e260d6bec6bbf9fa2891951b10319feca11f5c899431c86143fcdbde0b874ec9fcd598307ffd5b731578f8979d712375f65cfd7092617e5bd3dcf02
7
+ data.tar.gz: 122e43d2a21f50b897204e15d4d497cd95cea23a0de1d25a6efc744ca4316e9c5c09fab681e572e8bf66900a4bd40bcbfdf34ecb19e42168c484ca3bbf852d66
data/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changes log for the Ruby CFF Library
2
2
 
3
+ ## 1.1.0
4
+
5
+ * BibTeX: output months as three letter abbreviations.
6
+
3
7
  ## 1.0.1
4
8
 
5
9
  * Handle missing family or given names for authors.
data/CITATION.cff CHANGED
@@ -1,4 +1,4 @@
1
- # This CITATION.cff file was created by ruby-cff (v 1.0.1).
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.1
24
+ version: 1.1.0
25
25
  doi: 10.5281/zenodo.1184077
26
- date-released: 2022-11-05
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
- def self.format(model:, preferred_citation: true) # rubocop:disable Metrics/AbcSize
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
- "#{key} = {#{value}}"
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
@@ -17,7 +17,7 @@
17
17
  ##
18
18
  module CFF
19
19
  # :nodoc:
20
- VERSION = '1.0.1'
20
+ VERSION = '1.1.0'
21
21
  DEFAULT_SPEC_VERSION = '1.2.0'
22
22
  MIN_VALIDATABLE_VERSION = '1.2.0'
23
23
  end
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.1
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: 2022-11-05 00:00:00.000000000 Z
12
+ date: 2023-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json_schema