Skip to content

Commit

Permalink
a devtools::release style submit_rjournal() for yesno questions
Browse files Browse the repository at this point in the history
  • Loading branch information
huizezhang-sherry committed Sep 7, 2023
1 parent fe9d475 commit ee40664
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 27 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

export(check_abstract)
export(check_bib_doi)
export(check_bib_title)
export(check_cover_letter)
export(check_csl)
export(check_filenames)
Expand All @@ -21,6 +20,7 @@ export(rjournal_pdf_article)
export(rjournal_pdf_issue)
export(rjournal_web_article)
export(rjournal_web_issue)
export(submit_rjournal)
export(zip_paper)
import(stringr)
importFrom(BiocManager,version)
Expand Down
22 changes: 0 additions & 22 deletions R/check.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#' available on CRAN
#' * \code{check_bib_doi}: whether bib entries have DOI or URL included, uncless
#' can't sourced online
#' * \code{check_bib_title}: all the titles in the reference should be
#' * \code{check_csl}: no additional csl file should be used
#' consistent, either in sentence (preferred) or title case
#'
Expand Down Expand Up @@ -104,7 +103,6 @@ Please specify the file directory that contains the article {.field .tex} file."
check_pkg_label(pkg)
check_packages_available(path)
check_bib_doi(path)
check_bib_title(path)
check_csl(path)

## Show a numeric summary of successes, errors and notes
Expand Down Expand Up @@ -499,26 +497,6 @@ check_bib_doi <- function(path){

}

#' @rdname checks
#' @export
check_bib_title <- function(path){
bib_list <- read_bib(path)
bib_title <- lapply(bib_list, function(x) x$title)
bib_id <- lapply(bib_list, function(x) x$id)
bib_title2 <- str_remove_all(bib_title, "\\[.+?\\]\\{.nocase\\}") |>
str_replace(pattern = " R | R\\}", replacement = " ")

dt <- do.call(rbind, lapply(bib_title2, check_sentence_case))
res <- paste0(bib_id[!dt[["in_sentence_case"]]], collapse = ", ")
if (nchar(res) == 0){
log_success("All the references are properly formatted in sentence case.")
} else{
log_warning("The reference title associated with the following ids may not
be formatted properly in sentence case: {res}.")
}

}

#' @rdname checks
#' @export
check_csl <- function(path){
Expand Down
31 changes: 31 additions & 0 deletions R/questionnaire.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#' Submit a paper to the R Journal
#'
#' This is a last-minute self-serve check function, similar to
#' [devtools::release()], for handling R Journal styling that can be difficult
#' with automatic checks.
#'
#' @export
submit_rjournal <- function(){

if (!yesno(
"Have you checked .bib file titles? They need to be:
1) package name should be protected, i.e. {ggplot2} and always in lower case,
2) the programming language R should be protected, i.e. {R}, and
3) both sentence or title case are accepteable but need to be consistent")){
return(invisible())
}

if (!yesno(
"Have you include the automatic check results (with `initial_check_article`)
in the motivation letter? Checks with WARNINGs and ERRORs need to be
commented with reasons.")){
return(invisible())
}

if (yesno("Ready to submit?")){
browseURL("https://docs.google.com/forms/d/e/1FAIpQLSeqtHH0g9JhrNEwT4ScqVAQe6Qq4om1-EfUqBe12YsPrrB6WQ/viewform")
return(invisible())
}


}
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ reference:
contents:
- zip_paper
- prepare_submission
- submit_rjournal
- title: Tools for building journal issues and website
desc: Functions for the editor to produce issues from several articles
contents:
Expand Down
4 changes: 0 additions & 4 deletions man/checks.Rd

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

13 changes: 13 additions & 0 deletions man/submit_rjournal.Rd

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

0 comments on commit ee40664

Please sign in to comment.