Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CITATION.cff format #1987

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export(use_build_ignore)
export(use_c)
export(use_cc0_license)
export(use_ccby_license)
export(use_cff)
export(use_circleci)
export(use_circleci_badge)
export(use_citation)
Expand Down
22 changes: 22 additions & 0 deletions R/cff.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#' Create Citation File Format
#'
#' `use_cff()` ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be fleshed out.

#'
#' @seealso The Turing way [tutorial on CFF](https://book.the-turing-way.org/communication/citable/citable-cffinit.html).
#' @export
#' @examples
#' \dontrun{
#' use_cff()
#' }
use_cff <- function() {
check_is_package() # CM: Other functions start with this, but not sure if I need it
use_template(
"CITATION-template.cff",
"CITATION.cff",
open = TRUE
)

ui_bullets(c(
"_" = "Edit `CITATION.cff` (see {.url https://book.the-turing-way.org/communication/citable/citable-cffinit.html} and {.url https://citation-file-format.github.io/cff-initializer-javascript/#/})."
))
}
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ reference:
- use_test_helper
- use_vignette
- use_addin
- use_cff
- use_citation
- use_tutorial
- use_author
Expand Down
17 changes: 17 additions & 0 deletions inst/templates/CITATION-template.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# YAML 1.2
---
cff-version: "1.2.0"
title: ""
authors:
-
family-names:
given-names:
orcid: "https://orcid.org/0000-0000-0000-0000"
date-released: 20??-MM-DD
doi: <insert your DOI here>
version: ""
repository-code: ""
keywords:
- keyword1
message: "If you use this software, please cite it using these metadata."
license:
19 changes: 19 additions & 0 deletions man/use_cff.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions tests/testthat/test-cff.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test_that("use_cff() creates promised file", {
create_local_package()
use_cff()
expect_proj_file("CITATION.cff")
})
Loading