Skip to content

Commit

Permalink
require publisher information in bookdown
Browse files Browse the repository at this point in the history
  • Loading branch information
ThierryO committed May 28, 2024
1 parent d5e05ca commit 0df293b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
9 changes: 5 additions & 4 deletions R/citation_bookdown.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ citation_bookdown <- function(meta) {
cit_meta$meta$language <- yaml$lang
}
extra <- c(
"community", "doi", "keywords", "publication_type"
"community", "doi", "keywords", "publication_type", "publisher"
)
extra <- extra[extra %in% names(yaml)]
cit_meta$meta <- c(cit_meta$meta, yaml[extra])
Expand All @@ -77,7 +77,8 @@ citation_bookdown <- function(meta) {
"publication-workingpaper"
)
c(
"no `keywords` element found"[!has_name(yaml, "keywords")],
"No `keywords` element found"[!has_name(yaml, "keywords")],
"No `publisher` element found"[!has_name(yaml, "publisher")],
paste(
"`publication_type` must be one of following:",
paste(publication_type, collapse = ", "),
Expand All @@ -89,8 +90,8 @@ citation_bookdown <- function(meta) {
) |>
c(cit_meta$errors) -> cit_meta$errors
c(
"no `community` element found"[!has_name(yaml, "community")],
"no `publication_type` element found"[!has_name(yaml, "publication_type")]
"No `community` element found"[!has_name(yaml, "community")],
"No `publication_type` element found"[!has_name(yaml, "publication_type")]
) |>
c(cit_meta$notes) -> cit_meta$notes
return(cit_meta)
Expand Down
1 change: 1 addition & 0 deletions R/upload_zenodo.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ upload_zenodo <- function(path, token, sandbox = TRUE, logger = NULL) {
zen_rec$setPublicationDate(
first_non_null(cit_meta$publication_date, Sys.Date())
)
zen_rec$setPublisher(cit_meta$publisher)

zen_rec <- zen_upload(zenodo, zen_rec, path)
return(invisible(zen_rec))
Expand Down
1 change: 1 addition & 0 deletions inst/bookdown/index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ lang: nl
keywords: checklist; unit test
community: inbo
publication_type: publication-report
publisher: Research Institute for Nature and Forest (INBO)
funder: Research Institute for Nature and Forest (INBO)
rightsholder: Research Institute for Nature and Forest (INBO)
site: bookdown::bookdown_site
Expand Down

0 comments on commit 0df293b

Please sign in to comment.