ropensci / cffr

Generate Citation File Format (cff) Metadata for R Packages
https://docs.ropensci.org/cffr/
GNU General Public License v3.0
25 stars 3 forks source link

Allow to add more authors by role #50

Closed dieghernan closed 1 year ago

dieghernan commented 1 year ago

Description

New parameter in cff_create() and cff_write() that allows to control which roles would appear as "authors" on the CITATION.cff file /cffobject

Related Issue

Close #49

Example

library(cffr)

packageVersion("cffr")
#> [1] '0.4.1.9000'

# Download desc
tempdesc <- file.path(tempdir(), "DESCRIPTION")
download.file(
  "https://raw.githubusercontent.com/Global-Health-Engineering/durbanplasticwaste22/main/DESCRIPTION",
  tempdesc
)

# From
dfile <- desc::desc(tempdesc)
dfile$get_authors()
#> [1] "Raúl Bergen <raul.bergen@me.com> [aut] (<https://orcid.org/0000-0002-0678-6425>)"              
#> [2] "Lars Schöbitz <lschoebitz@ethz.ch> [cre] (<https://orcid.org/0000-0003-2196-5015>)"            
#> [3] "Chiara Meyer-Piening <first.last@example.com> [aut] (<https://orcid.org/0000-0003-2368-7418>)" 
#> [4] "Boynton Lin <lbonyton@ethz.ch> [ctb] (<https://orcid.org/0000-0002-9944-3834>)"                
#> [5] "Elizabeth Tilley <tilleye@ethz.ch> [ctb] (<https://orcid.org/0000-0002-2095-9724>)"            
#> [6] "Marc Kalina <mkalina@ethz.ch> [ctb] (<https://orcid.org/0000-0002-6335-3845>)"                 
#> [7] "Siphiwe Rakgabale <siphiwerakgabale@gmail.com> [ctb] (<https://orcid.org/0009-0007-3253-6327>)"
#> [8] "Sfiso Nduduzo Luvuno <sfisonduduzo.luvuno@gmail.com> [ctb]"                                    
#> [9] "Global Health Engineering [fnd]"

# By default only aut or cre
orig <- cff_create(tempdesc, dependencies = FALSE)

orig$authors
#> - family-names: Bergen
#>   given-names: Raúl
#>   email: raul.bergen@me.com
#>   orcid: https://orcid.org/0000-0002-0678-6425
#> - family-names: Schöbitz
#>   given-names: Lars
#>   email: lschoebitz@ethz.ch
#>   orcid: https://orcid.org/0000-0003-2196-5015
#> - family-names: Meyer-Piening
#>   given-names: Chiara
#>   email: first.last@example.com
#>   orcid: https://orcid.org/0000-0003-2368-7418

# Now add ctb and founders
mod <- cff_create(tempdesc,
  authors_roles = c("aut", "cre", "ctb", "fnd"), dependencies = FALSE
)

mod$authors
#> - family-names: Bergen
#>   given-names: Raúl
#>   email: raul.bergen@me.com
#>   orcid: https://orcid.org/0000-0002-0678-6425
#> - family-names: Schöbitz
#>   given-names: Lars
#>   email: lschoebitz@ethz.ch
#>   orcid: https://orcid.org/0000-0003-2196-5015
#> - family-names: Meyer-Piening
#>   given-names: Chiara
#>   email: first.last@example.com
#>   orcid: https://orcid.org/0000-0003-2368-7418
#> - family-names: Lin
#>   given-names: Boynton
#>   email: lbonyton@ethz.ch
#>   orcid: https://orcid.org/0000-0002-9944-3834
#> - family-names: Tilley
#>   given-names: Elizabeth
#>   email: tilleye@ethz.ch
#>   orcid: https://orcid.org/0000-0002-2095-9724
#> - family-names: Kalina
#>   given-names: Marc
#>   email: mkalina@ethz.ch
#>   orcid: https://orcid.org/0000-0002-6335-3845
#> - family-names: Rakgabale
#>   given-names: Siphiwe
#>   email: siphiwerakgabale@gmail.com
#>   orcid: https://orcid.org/0009-0007-3253-6327
#> - family-names: Luvuno
#>   given-names: Sfiso Nduduzo
#>   email: sfisonduduzo.luvuno@gmail.com
#> - name: Global Health Engineering

Created on 2023-04-17 with reprex v2.0.2