From 553f2c5c5a478bea53568795734d9df5eece2b86 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Mon, 13 Sep 2021 22:21:41 +0200 Subject: [PATCH] factor out text to email closing #221 closing #212 closing #61 closing #5 starting #220 #217 #172 #47 opens #281 --- NAMESPACE | 1 + R/email.R | 147 +++++++++++++++--- R/report.R | 10 +- inst/i18n/translation.json | 52 ++++++- .../templates/bericht/skeleton/skeleton.Rmd | 19 +-- .../templates/report/skeleton/skeleton.Rmd | 19 +-- man/{smtp_send_mc.Rd => email.Rd} | 97 ++++++++---- man/emailReport.Rd | 5 +- man/mcApp.Rd | 5 +- man/mcControls.Rd | 5 +- man/render_email.Rd | 49 ------ man/report.Rd | 14 +- man/runMetacheck.Rd | 5 +- tests/testthat/test-email.R | 8 + tests/testthat/test-report.R | 6 +- 15 files changed, 280 insertions(+), 162 deletions(-) rename man/{smtp_send_mc.Rd => email.Rd} (76%) delete mode 100644 man/render_email.Rd diff --git a/NAMESPACE b/NAMESPACE index d904a598..4a84bc34 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -33,6 +33,7 @@ export(mcControlsUI) export(mc_langs) export(md_data_attachment) export(metrics_overview) +export(render_and_send) export(render_and_send_async) export(render_email) export(render_report) diff --git a/R/email.R b/R/email.R index 45100648..6d5ede04 100644 --- a/R/email.R +++ b/R/email.R @@ -1,52 +1,152 @@ -#' Render email -#' @param dois Character vector of DOIs +#' Send metacheck results as an parametrised email +#' @family communicate +#' @name email +NULL + +#' @describeIn email Compose +#' @inheritParams blastula::compose_email +#' @inheritParams mcControlsServer +mc_compose_email <- function(body = "Lorem", translator = mc_translator()) { + biblids::stopifnot_i18n(translator) + blastula::compose_email( + header = blastula::blocks( + blastula::block_title(translator$translate("Metacheck Results")), + block_text_centered(translator$translate( + "Here are your open access metadata compliance test results." + )) + ), + body = body, + footer = blastula::blocks( + # newsletter is only available in german + if (translator$get_translation_language() == "de") { + list( + newsletter = block_text_centered_vec( + translator$translate("Stay tuned for new metacheck features."), + blastula::add_cta_button( + url = "https://subugoe.github.io/hoad/newsletter.html", + text = translator$translate("Subscribe to our newsletter") + ) + ), + blastula::block_spacer() + ) + }, + disclaimer = block_text_centered_vec( + translator$translate( + # TODO https://github.com/subugoe/metacheck/issues/282 + # line breaking this breaks the translation + # but should live in long docs anyway + "Metacheck supports your workflows to check OA metadata deposited by publishers, but it cannot conclusively check funding eligibility of OA publications." + ), + translator$translate( + "Please consult the funding conditions of the respective funder." + ) + ), + support = block_text_centered_vec( + translator$translate("Need help interpreting your results?"), + translator$translate( + "[Get additional support](https://subugoe.github.io/metacheck/articles/help.html)" + ) + ), + copyright = block_text_centered_vec( + "\u00A9", + paste0( + "[", + translator$translate("G\u00F6ttingen State and University Library"), + "]", + "(https://www.sub.uni-goettingen.de)" + ), + lubridate::year(lubridate::now()) + ), + funding = block_text_centered_vec( + translator$translate("Funded by the"), + paste0( + "[", + translator$translate("German Research Foundation"), + "]", + "(https://www.dfg.de)" + ) + ), + data = block_text_centered_vec( + translator$translate("Based on data by"), + "[Crossref](https://crossref.org)" + ), + links = blastula::block_social_links( + mc_social_link("website", "http://subugoe.github.io/metacheck"), + mc_social_link( + "email", + "mailto:metacheck-support@sub.uni-goettingen.de" + ), + mc_social_link("GitHub", "http://github.com/subugoe/metacheck"), + mc_social_link("Twitter", "https://twitter.com/subugoe") + ) + ), + title = "metacheck results" + ) +} + +#' Defaults for social links +#' @noRd +mc_social_link <- purrr::partial(blastula::social_link, variant = "dark_gray") + +#' Centered block text +#' @noRd +block_text_centered <- purrr::partial(blastula::block_text, align = "center") + +#' Vectorised helper +#' @noRd +block_text_centered_vec <- function(...) { + block_text_centered(blastula::md(paste(..., collapse = " "))) +} + +#' @describeIn email Render #' @param session_id Character vector to identify current shiny session #' @inheritParams report -#' @family communicate #' @export -render_email <- function(dois, lang = "en", session_id = NULL) { - email <- blastula::compose_email( - header = "metacheck: Open Access Metadata Compliance Checker", - # suppression is dangerous hack-fix for +render_email <- function(dois = tu_dois(), + translator = mc_translator(), + session_id = NULL) { + email <- mc_compose_email( + # suppression is dangerous hack-fix for # https://github.com/subugoe/metacheck/issues/138 # otherwise, tests are illegibly noisy body = suppressWarnings( blastula::render_email( - input = path_report_rmd(lang), + input = path_report_rmd(lang = translator$get_translation_language()), render_options = list( params = list( dois = dois, - session_id = session_id + session_id = session_id, + translator = translator ) ) )$html_html ), - footer = blastula::md(c( - "Email sent on ", format(Sys.time(), "%a %b %d %X %Y"), "." - )) + translator = translator ) # TODO enable https://github.com/subugoe/metacheck/issues/276 # email <- add_attachment_xlsx(email, session_id = session_id) email } -#' @describeIn render_email Render and send +#' @describeIn email Render and send +#' @inheritDotParams render_email #' @inheritParams smtp_send_mc -render_and_send <- function(dois, to, lang) { +#' @export +render_and_send <- function(to, translator = mc_translator(), ...) { email <- render_email( - dois, # used to disambiguate excel file names, see #83 session_id = as.character(floor(runif(1) * 1e20)), - lang = lang + translator = translator, + ... ) - smtp_send_mc(to = to, email) + smtp_send_mc(to = to, email = email, translator = translator) } -#' @describeIn render_email Render and send asynchronously +#' @describeIn email Render and send asynchronously #' @export -render_and_send_async <- function(dois, to, lang) { +render_and_send_async <- function(...) { promises::future_promise( - render_and_send(dois = dois, to = to, lang), + render_and_send(...), seed = TRUE ) NULL @@ -71,12 +171,9 @@ xlsx_path <- function(session_id = NULL) { # sending ==== -#' Send out email +#' @describeIn email Send #' @inheritParams blastula::smtp_send #' @inheritDotParams blastula::smtp_send -#' @inheritParams mcControlsServer -#' @family communicate -#' @keywords internal #' @export smtp_send_mc <- function(email = blastula::prepare_test_message(), to = throwaway, @@ -262,7 +359,7 @@ emailReportServer <- function(id, render_and_send_async( to = input$recipient, dois = dois(), - lang = lang() + translator = translWithLang() ) } }) diff --git a/R/report.R b/R/report.R index 1d6b6eac..b6296523 100644 --- a/R/report.R +++ b/R/report.R @@ -39,13 +39,15 @@ draft_report <- function(lang = mc_langs, ...) { #' @param dois #' Vector of DOIs, as created by, or coerceable to [biblids::doi()]. #' @inheritDotParams rmarkdown::render +#' @inheritParams mcControlsServer #' @export -render_report <- function(dois = tu_dois(), lang = mc_langs, ...) { +render_report <- function(dois = tu_dois(), translator = mc_translator(), ...) { + stopifnot(!shiny::is.reactive(dois)) + checkmate::assert_vector(dois, min.len = 1, null.ok = FALSE) dois <- biblids::as_doi(dois) - checkmate::assert_vector(dois, min.len = 2, null.ok = FALSE) rmarkdown::render( - input = path_report_rmd(lang = lang), - params = list(dois = dois), + input = path_report_rmd(lang = translator$get_translation_language()), + params = list(dois = dois, translator = translator), ... ) } diff --git a/inst/i18n/translation.json b/inst/i18n/translation.json index 52c12c97..290b2573 100644 --- a/inst/i18n/translation.json +++ b/inst/i18n/translation.json @@ -93,8 +93,56 @@ "de": "Ihre DOIs wurden erfolgreich versendet." }, { - "en": "Metacheck: Your OA Metadata Compliance Check Results", - "de": "Metacheck: Ihr OA Metadaten Schnelltest Ergebnis" + "en": "metacheck: Your Open Access Metadata Compliance Test Results", + "de": "metacheck: Ihr Open Access Metadaten Schnelltest Ergebnis" + }, + { + "en": "Metacheck Results", + "de": "Metacheck Ergebnisse" + }, + { + "en": "Here are your open access metadata compliance test results.", + "de": "Hier sind die Ergebnisse Ihres Open Access Metadaten Schnelltests." + }, + { + "en": "Stay tuned for new metacheck features.", + "de": "Bleiben Sie auf dem Laufenden für neue Metacheck Funktionen." + }, + { + "en": "Subscribe to our newsletter", + "de": "Newsletter Abonnieren" + }, + { + "en": "Metacheck supports your workflows to check OA metadata deposited by publishers, but it cannot conclusively check funding eligibility of OA publications.", + "de": "Metacheck unterstützt Sie bei der Überprüfung von Verlagsmetadaten, bietet aber keine abschließenden Aussagen zur Förderfähigkeit von OA Publikationen bzw. deren Kosten." + }, + { + "en": "Please consult the funding conditions of the respective funder.", + "de": "Dazu sind die Förderbedingungen der jeweiligen Förderer heranzuziehen." + }, + { + "en": "Need help interpreting your results?", + "de": "Haben Sie Fragen zur Interpretation ihrer Ergebnisse?" + }, + { + "en": "[Get additional support](https://subugoe.github.io/metacheck/articles/help.html).", + "de": "[Erhalten Sie weitere Unterstützung](https://subugoe.github.io/metacheck/articles/hilfe.html)." + }, + { + "en": "G\u00F6ttingen State and University Library", + "de": "Staats- und Universitätsbibliothek Göttingen" + }, + { + "en": "Funded by the", + "de": "Gefördert durch die" + }, + { + "en": "German Research Foundation", + "de": "Deutsche Forschungsgemeinschaft" + }, + { + "en": "Based on data by", + "de": "Basierend auf Daten erhoben von" } ] } diff --git a/inst/rmarkdown/templates/bericht/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/bericht/skeleton/skeleton.Rmd index 451ff194..9aac53f8 100644 --- a/inst/rmarkdown/templates/bericht/skeleton/skeleton.Rmd +++ b/inst/rmarkdown/templates/bericht/skeleton/skeleton.Rmd @@ -2,6 +2,7 @@ title: "Metacheck Bericht" params: dois: !r metacheck:::tu_dois() + translator: !r metacheck::mc_translator() session_id: NULL --- @@ -11,12 +12,9 @@ params: knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) library(metacheck) lang <- "de" +translator <- params$translator ``` -Hier sind die Ergebnisse der automatischen Open Access Metadaten Überprüfung. - -Die unten stehenden Abschnitte aggregieren die Testergebnisse. -Die Ergebnisse für jeden einzelnen DOI entnehmen Sie der beigefügten Exceltabelle. ## Vorabprüfung @@ -100,7 +98,7 @@ Grundsätzlich können mehrere Förderer je Artikel vermerkt sein. Der prozentuale Anteil bezieht sich auf die Anzahl der überprüften Artikel mit Crossref-Metadaten. -### Datenanhang +### Individual Results Beigefügt finden Sie ein Excel-Spreadsheet mit Metadaten auf Artikelebene für weitere Analysen. Es umfasst folgende Datenblätter: @@ -111,17 +109,6 @@ Es umfasst folgende Datenblätter: - `funder_info`: Förderinformationen lt. Crossref - `pretest`: Ergebnisse der Vorabprüfung -Weitere Informationen, wie das Ergebnis des Schnelltests zu interpretieren ist, finden Sie auf unserer [Webseite](https://subugoe.github.io/metacheck/articles/methode.html). - -**Bitte beachten Sie, dass der Schnelltest eine Workflowunterstützung bei der Überprüfung von Verlagsmetadaten ist. -Der Schnelltest trifft keine abschließenden Aussagen zur Förderfähigkeit von Open-Access-Publikationen bzw. deren Kosten. -Dazu sind die Förderbedingungen der jeweiligen Förderer heranzuziehen.** - -Bei Fragen und Anregungen stehen wir Ihnen gerne unter metacheck-support@sub.uni-goettingen.de zur Verfügung. - -Viele Grüße - -Ihr HOAD-Team ```{r export} md_data_attachment( diff --git a/inst/rmarkdown/templates/report/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/report/skeleton/skeleton.Rmd index 461d996e..9f084fd8 100644 --- a/inst/rmarkdown/templates/report/skeleton/skeleton.Rmd +++ b/inst/rmarkdown/templates/report/skeleton/skeleton.Rmd @@ -2,21 +2,17 @@ title: "Metacheck Report" params: dois: !r metacheck:::tu_dois() + translator: !r metacheck::mc_translator() session_id: NULL --- - - ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) library(metacheck) lang <- "en" +translator <- params$translator ``` -Here are the results of the automatic open access metadata compliance check. - -The below sections aggregate the test results. -You can results for each individual DOI in the attached spreadsheet. ## Pretest @@ -97,7 +93,7 @@ Crossref metadata can include more than one funder for each DOI. The percentage share refers to the total number of checked DOIs. -### Attachment +### Individual Results Please find attached an excel spreadsheet with individual results for every DOI. It includes these sheets: @@ -108,15 +104,6 @@ It includes these sheets: - `funder_info`: Funding information from Crossref - `pretest`: Results of the pretest -**Metacheck supports workflows to check publisher metadata. -It does not conclusively assert funding eligibility of open access publications. -Please consult the funding conditions of the respective funder.** - -For questions, support and sugggestions for improvements, please contact us at metacheck-support@sub.uni-goettingen.de. - -Best regards, - -Your HOAD-Team ```{r export} md_data_attachment( diff --git a/man/smtp_send_mc.Rd b/man/email.Rd similarity index 76% rename from man/smtp_send_mc.Rd rename to man/email.Rd index bf506361..a11f1492 100644 --- a/man/smtp_send_mc.Rd +++ b/man/email.Rd @@ -1,9 +1,22 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/email.R -\name{smtp_send_mc} +\name{email} +\alias{email} +\alias{mc_compose_email} +\alias{render_email} +\alias{render_and_send} +\alias{render_and_send_async} \alias{smtp_send_mc} -\title{Send out email} +\title{Send metacheck results as an parametrised email} \usage{ +mc_compose_email(body = "Lorem", translator = mc_translator()) + +render_email(dois = tu_dois(), translator = mc_translator(), session_id = NULL) + +render_and_send(to, translator = mc_translator(), ...) + +render_and_send_async(...) + smtp_send_mc( email = blastula::prepare_test_message(), to = throwaway, @@ -14,29 +27,11 @@ smtp_send_mc( ) } \arguments{ -\item{email}{The email message object, as created by the \code{\link[blastula:compose_email]{compose_email()}} -function. The object's class is \code{email_message}.} - -\item{to}{A vector of email addresses serving as primary recipients for the -message. For secondary recipients, use the \code{cc} and \code{bcc} arguments. A -named character vector can be used to specify the recipient names along -with the their email address (e.g., \code{c("Jane Doe" = "jane_doe@example.com")}).} - -\item{from}{The email address of the sender. Often this needs to be the same -email address that is associated with the account actually sending the -message. As with \code{to}, \code{cc}, and \code{bcc}, we can either supply a single email -address or use a named character vector with the sender name and email -address (e.g., \code{c("John Doe" = "john_doe@example.com")}).} - -\item{credentials}{One of three credential helper functions must be used -here: (1) \code{\link[blastula:credential_helpers]{creds()}}, (2) \code{\link[blastula:credential_helpers]{creds_key()}}, or (3) \code{\link[blastula:credential_helpers]{creds_file()}}. The first, -\code{\link[blastula:credential_helpers]{creds()}}, allows for a manual specification of SMTP configuration and -credentials within that helper function. This is the most secure method for -supplying credentials as they aren't written to disk. The \code{\link[blastula:credential_helpers]{creds_key()}} -function is used if credentials are stored in the system-wide key-value -store, through use of the \code{\link[blastula:create_smtp_creds_key]{create_smtp_creds_key()}} function. The -\code{\link[blastula:credential_helpers]{creds_file()}} helper function relies on a credentials file stored on disk. -Such a file is created using the \code{\link[blastula:create_smtp_creds_file]{create_smtp_creds_file()}} function.} +\item{body}{The three layout sections for an email message +(ordered from top to bottom). Markdown text can be supplied to each of +these by using the \code{\link[blastula:md]{md()}} text helper function. Alternatively, we can +supply a set of \verb{block_*()} calls enclosed within the \code{\link[blastula:blocks]{blocks()}} function +to take advantage of precomposed HTML blocks.} \item{translator}{A \link[shiny.i18n:Translator]{shiny.i18n::Translator} object or \code{NULL} for english-only defaults. Strings inside the module UI are marked as translateable. @@ -45,8 +40,17 @@ or can create your own \code{translator} using \link[shiny.i18n:Translator]{shin This must not be a reactive, it is only set at shiny startup. To update the language reactively \emph{during} a shiny session, see \code{lang}.} +\item{dois}{Vector of DOIs, as created by, or coerceable to \code{\link[biblids:doi]{biblids::doi()}}.} + +\item{session_id}{Character vector to identify current shiny session} + +\item{to}{A vector of email addresses serving as primary recipients for the +message. For secondary recipients, use the \code{cc} and \code{bcc} arguments. A +named character vector can be used to specify the recipient names along +with the their email address (e.g., \code{c("Jane Doe" = "jane_doe@example.com")}).} + \item{...}{ - Arguments passed on to \code{\link[blastula:smtp_send]{blastula::smtp_send}} + Arguments passed on to \code{\link[=render_email]{render_email}}, \code{\link[blastula:smtp_send]{blastula::smtp_send}} \describe{ \item{\code{subject}}{The subject of the message, which is usually a brief summary of the topic of the message. If not provided, an empty string will be used @@ -75,18 +79,53 @@ call be printed? While the username and password will likely be echoed during the exchange, such information is encoded and won't be stored on the user's system.} }} + +\item{email}{The email message object, as created by the \code{\link[blastula:compose_email]{compose_email()}} +function. The object's class is \code{email_message}.} + +\item{from}{The email address of the sender. Often this needs to be the same +email address that is associated with the account actually sending the +message. As with \code{to}, \code{cc}, and \code{bcc}, we can either supply a single email +address or use a named character vector with the sender name and email +address (e.g., \code{c("John Doe" = "john_doe@example.com")}).} + +\item{credentials}{One of three credential helper functions must be used +here: (1) \code{\link[blastula:credential_helpers]{creds()}}, (2) \code{\link[blastula:credential_helpers]{creds_key()}}, or (3) \code{\link[blastula:credential_helpers]{creds_file()}}. The first, +\code{\link[blastula:credential_helpers]{creds()}}, allows for a manual specification of SMTP configuration and +credentials within that helper function. This is the most secure method for +supplying credentials as they aren't written to disk. The \code{\link[blastula:credential_helpers]{creds_key()}} +function is used if credentials are stored in the system-wide key-value +store, through use of the \code{\link[blastula:create_smtp_creds_key]{create_smtp_creds_key()}} function. The +\code{\link[blastula:credential_helpers]{creds_file()}} helper function relies on a credentials file stored on disk. +Such a file is created using the \code{\link[blastula:create_smtp_creds_file]{create_smtp_creds_file()}} function.} } \description{ -Send out email +Send metacheck results as an parametrised email +} +\section{Related Functions and Methods}{ +\subsection{Functions}{ +\itemize{ +\item \code{mc_compose_email}: Compose +} +\itemize{ +\item \code{render_email}: Render } +\itemize{ +\item \code{render_and_send}: Render and send +} +\itemize{ +\item \code{render_and_send_async}: Render and send asynchronously +} +\itemize{ +\item \code{smtp_send_mc}: Send +}}} + \seealso{ Other communicate: \code{\link{emailReport}()}, \code{\link{mcApp}()}, \code{\link{mcControls}}, -\code{\link{render_email}()}, \code{\link{report}}, \code{\link{runMetacheck}()} } \concept{communicate} -\keyword{internal} diff --git a/man/emailReport.Rd b/man/emailReport.Rd index 54721118..4324efd8 100644 --- a/man/emailReport.Rd +++ b/man/emailReport.Rd @@ -62,12 +62,11 @@ Email Report through a Shiny Module \seealso{ Other communicate: +\code{\link{email}}, \code{\link{mcApp}()}, \code{\link{mcControls}}, -\code{\link{render_email}()}, \code{\link{report}}, -\code{\link{runMetacheck}()}, -\code{\link{smtp_send_mc}()} +\code{\link{runMetacheck}()} } \concept{communicate} \keyword{internal} diff --git a/man/mcApp.Rd b/man/mcApp.Rd index 3a9cf977..3911b3b0 100644 --- a/man/mcApp.Rd +++ b/man/mcApp.Rd @@ -12,10 +12,9 @@ Shiny webapp for metacheck \seealso{ Other communicate: \code{\link{emailReport}()}, +\code{\link{email}}, \code{\link{mcControls}}, -\code{\link{render_email}()}, \code{\link{report}}, -\code{\link{runMetacheck}()}, -\code{\link{smtp_send_mc}()} +\code{\link{runMetacheck}()} } \concept{communicate} diff --git a/man/mcControls.Rd b/man/mcControls.Rd index 367a7c65..f2ffdc04 100644 --- a/man/mcControls.Rd +++ b/man/mcControls.Rd @@ -41,10 +41,9 @@ Enter metacheck controls through a shiny module \seealso{ Other communicate: \code{\link{emailReport}()}, +\code{\link{email}}, \code{\link{mcApp}()}, -\code{\link{render_email}()}, \code{\link{report}}, -\code{\link{runMetacheck}()}, -\code{\link{smtp_send_mc}()} +\code{\link{runMetacheck}()} } \concept{communicate} diff --git a/man/render_email.Rd b/man/render_email.Rd deleted file mode 100644 index bd0f03b0..00000000 --- a/man/render_email.Rd +++ /dev/null @@ -1,49 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/email.R -\name{render_email} -\alias{render_email} -\alias{render_and_send} -\alias{render_and_send_async} -\title{Render email} -\usage{ -render_email(dois, lang = "en", session_id = NULL) - -render_and_send(dois, to, lang) - -render_and_send_async(dois, to, lang) -} -\arguments{ -\item{dois}{Character vector of DOIs} - -\item{lang}{Character scalar giving the anguage of the report. -\emph{Not} reactive as in \code{\link[=mcControlsServer]{mcControlsServer()}}.} - -\item{session_id}{Character vector to identify current shiny session} - -\item{to}{A vector of email addresses serving as primary recipients for the -message. For secondary recipients, use the \code{cc} and \code{bcc} arguments. A -named character vector can be used to specify the recipient names along -with the their email address (e.g., \code{c("Jane Doe" = "jane_doe@example.com")}).} -} -\description{ -Render email -} -\section{Related Functions and Methods}{ -\subsection{Functions}{ -\itemize{ -\item \code{render_and_send}: Render and send -} -\itemize{ -\item \code{render_and_send_async}: Render and send asynchronously -}}} - -\seealso{ -Other communicate: -\code{\link{emailReport}()}, -\code{\link{mcApp}()}, -\code{\link{mcControls}}, -\code{\link{report}}, -\code{\link{runMetacheck}()}, -\code{\link{smtp_send_mc}()} -} -\concept{communicate} diff --git a/man/report.Rd b/man/report.Rd index 4ae29654..eac261ee 100644 --- a/man/report.Rd +++ b/man/report.Rd @@ -8,7 +8,7 @@ \usage{ draft_report(lang = mc_langs, ...) -render_report(dois = tu_dois(), lang = mc_langs, ...) +render_report(dois = tu_dois(), translator = mc_translator(), ...) } \arguments{ \item{lang}{Character scalar giving the anguage of the report. @@ -99,6 +99,13 @@ pandoc command line and others. To only suppress printing of the last }} \item{dois}{Vector of DOIs, as created by, or coerceable to \code{\link[biblids:doi]{biblids::doi()}}.} + +\item{translator}{A \link[shiny.i18n:Translator]{shiny.i18n::Translator} object or \code{NULL} for english-only defaults. +Strings inside the module UI are marked as translateable. +You can pass a translator object included in the package, +or can create your own \code{translator} using \link[shiny.i18n:Translator]{shiny.i18n::Translator}. +This must not be a reactive, it is only set at shiny startup. +To update the language reactively \emph{during} a shiny session, see \code{lang}.} } \description{ Helper functions to generate a metacheck report. @@ -116,10 +123,9 @@ Useful for manual edits; equivalent to opening a new template in RStudio. \seealso{ Other communicate: \code{\link{emailReport}()}, +\code{\link{email}}, \code{\link{mcApp}()}, \code{\link{mcControls}}, -\code{\link{render_email}()}, -\code{\link{runMetacheck}()}, -\code{\link{smtp_send_mc}()} +\code{\link{runMetacheck}()} } \concept{communicate} diff --git a/man/runMetacheck.Rd b/man/runMetacheck.Rd index 9a6b11ce..26a21872 100644 --- a/man/runMetacheck.Rd +++ b/man/runMetacheck.Rd @@ -51,10 +51,9 @@ Start web application \seealso{ Other communicate: \code{\link{emailReport}()}, +\code{\link{email}}, \code{\link{mcApp}()}, \code{\link{mcControls}}, -\code{\link{render_email}()}, -\code{\link{report}}, -\code{\link{smtp_send_mc}()} +\code{\link{report}} } \concept{communicate} diff --git a/tests/testthat/test-email.R b/tests/testthat/test-email.R index 10e8cf3f..cc1b057f 100644 --- a/tests/testthat/test-email.R +++ b/tests/testthat/test-email.R @@ -1,3 +1,11 @@ +test_that("email without body can be composed", { + # pretty bad test + expect_s3_class( + mc_compose_email(), + "blastula_message" + ) +}) + test_that("email can be rendered", { # pretty bad test expect_s3_class( diff --git a/tests/testthat/test-report.R b/tests/testthat/test-report.R index a88e5a34..b8d164bd 100644 --- a/tests/testthat/test-report.R +++ b/tests/testthat/test-report.R @@ -15,10 +15,6 @@ test_that("draft can be created from template", { test_that("parametrised report can be rendered", { expect_invisible( - render_report( - dois = tu_dois(), - output_file = withr::local_tempfile(), - quiet = TRUE - ) + render_report(output_file = withr::local_tempfile(), quiet = TRUE) ) })