diff --git a/CITATION.cff b/CITATION.cff index 2d9289e..d2bc655 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -8,7 +8,7 @@ message: 'To cite package "cffr" in publications use:' type: software license: GPL-3.0-or-later title: 'cffr: Generate Citation File Format (''cff'') Metadata for R Packages' -version: 1.1.0 +version: 1.1.0.9000 doi: 10.21105/joss.03900 identifiers: - type: doi @@ -143,9 +143,6 @@ references: email: jeroen@berkeley.edu orcid: https://orcid.org/0000-0002-4035-0289 year: '2024' - identifiers: - - type: url - value: https://arxiv.org/abs/1403.2805 doi: 10.32614/CRAN.package.jsonlite version: '>= 1.7.2' - type: software diff --git a/DESCRIPTION b/DESCRIPTION index cf64c61..db23ce7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: cffr Title: Generate Citation File Format ('cff') Metadata for R Packages -Version: 1.1.0 +Version: 1.1.0.9000 Authors@R: c( person("Diego", "Hernangómez", , "diego.hernangomezherrero@gmail.com", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0001-8457-4658")), diff --git a/NEWS.md b/NEWS.md index e63b3f9..ea4391c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# cffr (development version) + +- Adapt extraction of orcid to **R \> 4.4.1**. + # cffr 1.1.0 - Now **cffr** adds automatically dois to packages on **CRAN** (e.g. diff --git a/R/as_cff_person.R b/R/as_cff_person.R index ec75956..edfa35d 100644 --- a/R/as_cff_person.R +++ b/R/as_cff_person.R @@ -170,7 +170,8 @@ as_cff_person <- function(x, ...) { #' @rdname as_cff_person #' @order 2 as_cff_person.default <- function(x, ...) { - x <- clean_str(x) + # Check if this is protected + if (!inherits(x, "Bibtex")) x <- clean_str(x) if (is.null(x)) { return(NULL) } @@ -197,7 +198,14 @@ as_cff_person.person <- function(x, ...) { #' @rdname as_cff_person #' @order 4 as_cff_person.character <- function(x, ...) { - test_x <- clean_str(x) + # Maybe is protected ... + if (any(grepl("{", x, fixed = TRUE))) { + test_x <- x + } else { + test_x <- clean_str(x) + } + + if (is.null(test_x)) { return(NULL) } diff --git a/R/utils-persons.R b/R/utils-persons.R index ee52d45..14a5d27 100644 --- a/R/utils-persons.R +++ b/R/utils-persons.R @@ -360,6 +360,11 @@ extract_person_comments <- function(person) { # guess orcid orcid <- url_comment[grepl("orcid.org/", url_comment)] + # Case for R > 4.4.1 + if ("orcid" %in% names(comm_cff)) { + orcid <- clean_str(comm_cff$orcid) + } + # Get the first non-orcid url web <- url_comment[!grepl("orcid.org/", url_comment)][1] diff --git a/README.Rmd b/README.Rmd index 6b53a89..deaea65 100644 --- a/README.Rmd +++ b/README.Rmd @@ -63,7 +63,7 @@ knitr::include_graphics("vignettes/tweet-1.png") *--- Nat Friedman (\@natfriedman) July 27, 2021* See [Enhanced support for citations on -GitHub](https://github.blog/2021-08-19-enhanced-support-citations-github/) +GitHub](https://github.blog/news-insights/company-news/enhanced-support-citations-github/) [@smith2021] for more info. ### Related projects diff --git a/README.md b/README.md index f89cdec..cbd2b86 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ interest: *— Nat Friedman (@natfriedman) July 27, 2021* See [Enhanced support for citations on -GitHub](https://github.blog/2021-08-19-enhanced-support-citations-github/) +GitHub](https://github.blog/news-insights/company-news/enhanced-support-citations-github/) ([Smith 2021](#ref-smith2021)) for more info. ### Related projects @@ -73,7 +73,7 @@ file and the `CITATION` file (if present) of your package. Note that **cffr** works best if your package pass `R CMD check/devtools::check()`. -As per 2024-07-23 there are at least 290 repos on GitHub using **cffr**. +As per 2024-08-09 there are at least 290 repos on GitHub using **cffr**. [Check them out here](https://github.com/search?q=cffr%20path%3A**%2FCITATION.cff&type=code). @@ -229,6 +229,7 @@ test <- cff_create("rmarkdown") url: https://github.com/rstudio/rmarkdown repository: https://CRAN.R-project.org/package=rmarkdown repository-code: https://github.com/rstudio/rmarkdown + commit: '2.27' url: https://pkgs.rstudio.com/rmarkdown/ date-released: '2024-05-17' contact: @@ -394,9 +395,6 @@ test <- cff_create("rmarkdown") email: jeroen@berkeley.edu orcid: https://orcid.org/0000-0002-4035-0289 year: '2024' - identifiers: - - type: url - value: https://arxiv.org/abs/1403.2805 doi: 10.32614/CRAN.package.jsonlite - type: software title: knitr @@ -572,27 +570,6 @@ test <- cff_create("rmarkdown") given-names: Michael year: '2024' doi: 10.32614/CRAN.package.digest - - type: software - title: dygraphs - abstract: 'dygraphs: Interface to ''Dygraphs'' Interactive Time Series Charting - Library' - notes: Suggests - url: https://github.com/rstudio/dygraphs - repository: https://CRAN.R-project.org/package=dygraphs - authors: - - family-names: Vanderkam - given-names: Dan - website: http://dygraphs.com/ - - family-names: Allaire - given-names: JJ - - family-names: Owen - given-names: Jonathan - - family-names: Gromer - given-names: Daniel - - family-names: Thieurmel - given-names: Benoit - year: '2024' - doi: 10.32614/CRAN.package.dygraphs - type: software title: fs abstract: 'fs: Cross-Platform File System Operations Based on ''libuv''' @@ -610,27 +587,6 @@ test <- cff_create("rmarkdown") email: csardi.gabor@gmail.com year: '2024' doi: 10.32614/CRAN.package.fs - - type: software - title: rsconnect - abstract: 'rsconnect: Deploy Docs, Apps, and APIs to ''Posit Connect'', ''shinyapps.io'', - and ''RPubs''' - notes: Suggests - url: https://rstudio.github.io/rsconnect/ - repository: https://CRAN.R-project.org/package=rsconnect - authors: - - family-names: Atkins - given-names: Aron - email: aron@posit.co - - family-names: Allen - given-names: Toph - - family-names: Wickham - given-names: Hadley - - family-names: McPherson - given-names: Jonathan - - family-names: Allaire - given-names: JJ - year: '2024' - doi: 10.32614/CRAN.package.rsconnect - type: software title: downlit abstract: 'downlit: Syntax Highlighting and Automatic Linking' @@ -644,20 +600,6 @@ test <- cff_create("rmarkdown") year: '2024' doi: 10.32614/CRAN.package.downlit version: '>= 0.4.0' - - type: software - title: katex - abstract: 'katex: Rendering Math to HTML, ''MathML'', or R-Documentation Format' - notes: Suggests - url: https://docs.ropensci.org/katex/ - repository: https://CRAN.R-project.org/package=katex - authors: - - family-names: Ooms - given-names: Jeroen - email: jeroen@berkeley.edu - orcid: https://orcid.org/0000-0002-4035-0289 - year: '2024' - doi: 10.32614/CRAN.package.katex - version: '>= 1.4.0' - type: software title: sass abstract: 'sass: Syntactically Awesome Style Sheets (''Sass'')' @@ -773,19 +715,6 @@ test <- cff_create("rmarkdown") email: davis@posit.co year: '2024' doi: 10.32614/CRAN.package.vctrs - - type: software - title: cleanrmd - abstract: 'cleanrmd: Clean Class-Less ''R Markdown'' HTML Documents' - notes: Suggests - url: https://pkg.garrickadenbuie.com/cleanrmd/ - repository: https://CRAN.R-project.org/package=cleanrmd - authors: - - family-names: Aden-Buie - given-names: Garrick - email: garrick@adenbuie.com - orcid: https://orcid.org/0000-0002-7111-0077 - year: '2024' - doi: 10.32614/CRAN.package.cleanrmd - type: software title: withr abstract: 'withr: Run Code ''With'' Temporarily Modified Global State' @@ -937,7 +866,8 @@ for more info. ## References -
+
diff --git a/codemeta.json b/codemeta.json index 0fb0c41..9b00f30 100644 --- a/codemeta.json +++ b/codemeta.json @@ -8,13 +8,13 @@ "codeRepository": "https://github.com/ropensci/cffr", "issueTracker": "https://github.com/ropensci/cffr/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "1.1.0", + "version": "1.1.0.9000", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", "url": "https://r-project.org" }, - "runtimePlatform": "R version 4.4.1 (2024-06-14)", + "runtimePlatform": "R Under development (unstable) (2024-08-07 r86984 ucrt)", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -200,7 +200,7 @@ }, "isPartOf": "https://ropensci.org", "keywords": ["attribution", "citation", "credit", "citation-files", "cff", "metadata", "r", "r-package", "citation-file-format", "rstats", "ropensci", "cran"], - "fileSize": "1604.704KB", + "fileSize": "1623.607KB", "citation": [ { "@type": "ScholarlyArticle", diff --git a/data/cran_to_spdx.rda b/data/cran_to_spdx.rda index 2555f31..91770a2 100644 Binary files a/data/cran_to_spdx.rda and b/data/cran_to_spdx.rda differ diff --git a/inst/schemaorg.json b/inst/schemaorg.json index 4c9f2e2..0c2ca89 100644 --- a/inst/schemaorg.json +++ b/inst/schemaorg.json @@ -26,6 +26,6 @@ "name": "Comprehensive R Archive Network (CRAN)", "url": "https://cran.r-project.org" }, - "runtimePlatform": "R version 4.4.1 (2024-06-14)", - "version": "1.1.0" + "runtimePlatform": "R Under development (unstable) (2024-08-07 r86984 ucrt)", + "version": "1.1.0.9000" } diff --git a/man/cff_class.Rd b/man/cff_class.Rd index af0a4c1..68026d5 100644 --- a/man/cff_class.Rd +++ b/man/cff_class.Rd @@ -162,8 +162,9 @@ ref_list #> - family-names: Gao #> given-names: Charlie #> year: '2024' -#> notes: R package version 2.3.9 -#> url: https://github.com/vubiostat/r-yaml/ +#> notes: R package version 2.3.10 +#> url: https://CRAN.R-project.org/package=yaml +#> doi: 10.32614/CRAN.package.yaml class(ref_list) #> [1] "cff_ref_lst" "cff" @@ -336,13 +337,14 @@ toBibtex(cit) #> title = \{yaml: Methods to Convert R Data to YAML and Back\}, #> author = \{Shawn P Garbett and Jeremy Stephens and Kirill Simonov and Yihui Xie and Zhuoer Dong and Hadley Wickham and Jeffrey Horner and \{reikoch\} and Will Beasley and Brendan O'Connor and Gregory R. Warnes and Michael Quinn and Zhian N. Kamvar and Charlie Gao\}, #> year = \{2024\}, -#> note = \{R package version 2.3.9\}, -#> url = \{https://github.com/vubiostat/r-yaml/\}, +#> note = \{R package version 2.3.10\}, +#> url = \{https://CRAN.R-project.org/package=yaml\}, +#> doi = \{10.32614/CRAN.package.yaml\}, #> \} # cff_pers, cff_pers_lst toBibtex(two_persons) -#> [1] "person, A and \{An entity\}" +#> person, A and \{An entity\} }\if{html}{\out{
}} } diff --git a/tests/testthat/_snaps/cff_create.md b/tests/testthat/_snaps/cff_create.md index 9d94f0e..6578e1a 100644 --- a/tests/testthat/_snaps/cff_create.md +++ b/tests/testthat/_snaps/cff_create.md @@ -328,13 +328,11 @@ - family-names: Boettiger given-names: Carl email: cboettig@gmail.com - orcid: https://orcid.org/0000-0002-1642-628X url: https://httpbin.org/status/404 contact: - family-names: Boettiger given-names: Carl email: cboettig@gmail.com - orcid: https://orcid.org/0000-0002-1642-628X keywords: - metadata - codemeta diff --git a/tests/testthat/_snaps/methods.md b/tests/testthat/_snaps/methods.md index 1bd0b5a..eb19545 100644 --- a/tests/testthat/_snaps/methods.md +++ b/tests/testthat/_snaps/methods.md @@ -1109,19 +1109,19 @@ Code toBibtex(sev_auth) Output - [1] "{The Big Bopper} and Sinatra, Frank and Martin, Dean and Davis, Jr., Sammy" + {The Big Bopper} and Sinatra, Frank and Martin, Dean and Davis, Jr., Sammy --- Code toBibtex(single) Output - [1] "person, A" + person, A --- Code toBibtex(single) Output - [1] "{A and B co}" + {A and B co} diff --git a/tests/testthat/_snaps/utils-create.md b/tests/testthat/_snaps/utils-create.md index e6367ef..0c356ee 100644 --- a/tests/testthat/_snaps/utils-create.md +++ b/tests/testthat/_snaps/utils-create.md @@ -1034,7 +1034,6 @@ - family-names: Boettiger given-names: Carl email: cboettig@gmail.com - orcid: https://orcid.org/0000-0002-1642-628X abstract: Codemeta defines a 'JSON-LD' format for describing software metadata. This package provides utilities to generate, parse, and modify codemeta.jsonld files automatically for R packages. @@ -1043,7 +1042,6 @@ - family-names: Boettiger given-names: Carl email: cboettig@gmail.com - orcid: https://orcid.org/0000-0002-1642-628X keywords: - metadata - codemeta diff --git a/tests/testthat/test-cff_create.R b/tests/testthat/test-cff_create.R index a4f8093..e679ebf 100644 --- a/tests/testthat/test-cff_create.R +++ b/tests/testthat/test-cff_create.R @@ -295,6 +295,10 @@ test_that("Parsing many persons", { test_that("Parsing wrong urls", { + rvers <- getRversion() + skip_if(rvers <= "4.4.1", "Snapshot created with R 4.5.0") + skip_on_cran() + desc_path <- system.file("examples/DESCRIPTION_wrong_urls", package = "cffr") a_cff <- cff_create(desc_path, diff --git a/tests/testthat/test-methods.R b/tests/testthat/test-methods.R index ba0d9e4..36a19e5 100644 --- a/tests/testthat/test-methods.R +++ b/tests/testthat/test-methods.R @@ -189,6 +189,7 @@ test_that("as.person method", { }) test_that("as.person method names and particles", { + skip_on_cran() str <- "von Wicksteed, III, P. H. and {The translator factory}" cf <- as_cff_person(str) @@ -227,6 +228,9 @@ test_that("head and tail", { }) test_that("toBibtex", { + rvers <- getRversion() + skip_if(rvers <= "4.4.1", "Snapshot created with R 4.5.0") + # Create several alternatives descobj <- cff_read_description(system.file("examples/DESCRIPTION_basic", package = "cffr" diff --git a/tests/testthat/test-utils-create.R b/tests/testthat/test-utils-create.R index b69c295..62b02e6 100644 --- a/tests/testthat/test-utils-create.R +++ b/tests/testthat/test-utils-create.R @@ -1,4 +1,8 @@ test_that("Merge all DESCRIPTION files with CITATION_basic", { + rvers <- getRversion() + skip_if(rvers <= "4.4.1", "Snapshot created with R 4.5.0") + skip_on_cran() + allfiles <- list.files( system.file("examples", package = "cffr"), pattern = "^DESC", full.names = TRUE