cff 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +7 -0
- data/CITATION.cff +3 -3
- data/README.md +20 -1
- data/lib/cff/formatters/apalike.rb +18 -2
- data/lib/cff/formatters/bibtex.rb +1 -0
- data/lib/cff/util.rb +3 -1
- data/lib/cff/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 734e15765062e2b7f6a00f25f89edec38c560be9c06605066dc8999ba6d46128
|
4
|
+
data.tar.gz: 3ad6ed8ff24203d521b356c2f5b73c304e501522f8b43b3aa7b7b890c54d59d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c873384b8a5dc7daea84ca0f184c457da397c4e21c9fbd64438328343bdd31481bfd7e4c48193fe074e8863961268f0adb72748e0aa73578cfffa80868366f56
|
7
|
+
data.tar.gz: 1a9f094a9d8f7739b6a118fb1b789f54eb58e961eab94fb864a604d3736e9dbf0567031372debba753f68fe4d59f43c348687bb6ab1cf747aba045d7abe267ac
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changes log for the Ruby CFF Library
|
2
2
|
|
3
|
+
## 1.0.1
|
4
|
+
|
5
|
+
* Handle missing family or given names for authors.
|
6
|
+
* Handle authors with only an alias for a name.
|
7
|
+
* Add install instructions to the README.
|
8
|
+
* Add a note to the README re output format changes.
|
9
|
+
|
3
10
|
## 1.0.0
|
4
11
|
|
5
12
|
* Add `type` to top-level CFF model.
|
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.0.1).
|
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.0.1
|
25
25
|
doi: 10.5281/zenodo.1184077
|
26
|
-
date-released: 2022-
|
26
|
+
date-released: 2022-11-05
|
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
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ A Ruby library for creating, editing, validating and converting CITATION.cff fil
|
|
5
5
|
|
6
6
|
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1184077.svg)](https://doi.org/10.5281/zenodo.1184077)
|
7
7
|
[![Gem Version](https://badge.fury.io/rb/cff.svg)](https://badge.fury.io/rb/cff)
|
8
|
-
[![Tests](https://github.com/citation-file-format/ruby-cff/actions/workflows/
|
8
|
+
[![Tests](https://github.com/citation-file-format/ruby-cff/actions/workflows/tests.yml/badge.svg)](https://github.com/citation-file-format/ruby-cff/actions/workflows/ruby.yml)
|
9
9
|
[![Linter](https://github.com/citation-file-format/ruby-cff/actions/workflows/lint.yml/badge.svg)](https://github.com/citation-file-format/ruby-cff/actions/workflows/lint.yml)
|
10
10
|
[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
|
11
11
|
[![Maintainability](https://api.codeclimate.com/v1/badges/6bb4c661bfb4971260ba/maintainability)](https://codeclimate.com/github/citation-file-format/ruby-cff/maintainability)
|
@@ -21,6 +21,23 @@ See the [CITATION.cff documentation](https://citation-file-format.github.io/) fo
|
|
21
21
|
|
22
22
|
See the [full API documentation](https://citation-file-format.github.io/ruby-cff/) for more details about Ruby CFF.
|
23
23
|
|
24
|
+
### Installation
|
25
|
+
|
26
|
+
Add this line to your application's Gemfile:
|
27
|
+
```ruby
|
28
|
+
gem 'cff'
|
29
|
+
```
|
30
|
+
|
31
|
+
And then execute:
|
32
|
+
```shell
|
33
|
+
$ bundle
|
34
|
+
```
|
35
|
+
|
36
|
+
Or install it yourself with:
|
37
|
+
```shell
|
38
|
+
$ gem install cff
|
39
|
+
```
|
40
|
+
|
24
41
|
### Quick start
|
25
42
|
|
26
43
|
You can quickly build and save a CFF index like this:
|
@@ -192,6 +209,8 @@ Due to the different expectations of different publication venues, the citation
|
|
192
209
|
|
193
210
|
From version 1.0.0 onwards, the principles of [semantic versioning](https://semver.org/) are applied when numbering releases with new features or breaking changes.
|
194
211
|
|
212
|
+
Minor or stylistic changes to output formats are not considered "breaking" for the purposes of library versioning.
|
213
|
+
|
195
214
|
### Developing Ruby CFF
|
196
215
|
|
197
216
|
Please see our [Code of Conduct](https://github.com/citation-file-format/ruby-cff/blob/main/CODE_OF_CONDUCT.md) and our [contributor guidelines](https://github.com/citation-file-format/ruby-cff/blob/main/CONTRIBUTING.md).
|
@@ -136,9 +136,25 @@ module CFF
|
|
136
136
|
|
137
137
|
particle =
|
138
138
|
author.name_particle.empty? ? '' : "#{author.name_particle} "
|
139
|
-
suffix = author.name_suffix.empty? ? '
|
139
|
+
suffix = author.name_suffix.empty? ? '' : ", #{author.name_suffix}"
|
140
140
|
|
141
|
-
"#{particle}#{
|
141
|
+
"#{particle}#{format_name(author)}#{suffix}"
|
142
|
+
end
|
143
|
+
|
144
|
+
# Format a name using an alias if needs be.
|
145
|
+
# https://blog.apastyle.org/apastyle/2012/02/how-to-cite-pseudonyms.html
|
146
|
+
def self.format_name(author)
|
147
|
+
if author.family_names.empty?
|
148
|
+
if author.given_names.empty?
|
149
|
+
author.alias
|
150
|
+
else
|
151
|
+
author.given_names
|
152
|
+
end
|
153
|
+
elsif author.given_names.empty?
|
154
|
+
author.family_names
|
155
|
+
else
|
156
|
+
"#{author.family_names}, #{initials(author.given_names)}."
|
157
|
+
end
|
142
158
|
end
|
143
159
|
end
|
144
160
|
end
|
@@ -176,6 +176,7 @@ module CFF
|
|
176
176
|
|
177
177
|
def self.format_actor(author)
|
178
178
|
return "{#{author.name}}" if author.is_a?(Entity)
|
179
|
+
return author.alias if author.family_names.empty? && author.given_names.empty?
|
179
180
|
|
180
181
|
particle =
|
181
182
|
author.name_particle.empty? ? '' : "#{author.name_particle} "
|
data/lib/cff/util.rb
CHANGED
@@ -40,9 +40,11 @@ module CFF
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
# Currently need to make some sort of guess as to whether an actor
|
44
|
+
# is a Person or Entity. This isn't perfect, but works 99.99% I think.
|
43
45
|
def build_actor_collection!(source)
|
44
46
|
source.map! do |s|
|
45
|
-
s.has_key?('
|
47
|
+
s.has_key?('name') ? Entity.new(s) : Person.new(s)
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
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.0.1
|
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-
|
12
|
+
date: 2022-11-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json_schema
|
@@ -242,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
242
|
- !ruby/object:Gem::Version
|
243
243
|
version: '0'
|
244
244
|
requirements: []
|
245
|
-
rubygems_version: 3.
|
245
|
+
rubygems_version: 3.3.23
|
246
246
|
signing_key:
|
247
247
|
specification_version: 4
|
248
248
|
summary: A Ruby library for manipulating CITATION.cff files.
|