diff --git a/.Rbuildignore b/.Rbuildignore index 8b7f729a..b47a7af9 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -15,6 +15,7 @@ Dockerfile ^data-raw$ ^docs$ ^man-roxygen$ +^organisation.yml$ ^pkgdown$ create_docker.sh docker diff --git a/.github/workflows/check_on_branch.yml b/.github/workflows/check_on_branch.yml index 0792184c..2f09f443 100644 --- a/.github/workflows/check_on_branch.yml +++ b/.github/workflows/check_on_branch.yml @@ -17,4 +17,4 @@ jobs: permissions: contents: read steps: - - uses: inbo/actions/check_pkg@checklist-0.3.2 + - uses: inbo/actions/check_pkg@checklist-0.3.6 diff --git a/.github/workflows/check_on_different_r_os.yml b/.github/workflows/check_on_different_r_os.yml index 08bcdbba..10c4a14f 100644 --- a/.github/workflows/check_on_different_r_os.yml +++ b/.github/workflows/check_on_different_r_os.yml @@ -42,10 +42,9 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 - uses: r-lib/actions/setup-r-dependencies@v2 - - - uses: r-lib/actions/check-r-package@v2 with: extra-packages: any::rcmdcheck + needs: check - uses: r-lib/actions/check-r-package@v2 with: diff --git a/.github/workflows/check_on_main.yml b/.github/workflows/check_on_main.yml index 4f5c8e5e..d5a137b5 100644 --- a/.github/workflows/check_on_main.yml +++ b/.github/workflows/check_on_main.yml @@ -16,4 +16,4 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: inbo/actions/check_pkg@checklist-0.3.2 + - uses: inbo/actions/check_pkg@checklist-0.3.6 diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 55e24138..4613d59d 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -16,7 +16,7 @@ jobs: - name: checkout uses: actions/checkout@v2 - name: build examples - uses: inbo/actions/render_inbomd@inbomd-0.6.0 + uses: inbo/actions/render_inbomd@inbomd-0.6.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} EXAMPLE_BRANCH: main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3b2f57d3..9b10b9f6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,27 +5,26 @@ on: tags: - v* workflow_run: - workflows: ["check package on main"] + workflows: ["check package on main with checklist"] types: - completed jobs: - - build: + publish: runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v3 - - name: Get tag message + - name: Get tag run: | + git fetch --tags --force TAG=$(git tag --contains $(git rev-parse HEAD)) - TAG_BODY=$(git tag --contains {{ github.sha }} -n100 | awk '(NR>1)') - echo "TAG=$TAG" >> $GITHUB_OUTPUT - echo "TAG_BODY=$TAG_BODY" >> $GITHUB_OUTPUT - id: tag-body + TAG_BODY=$(git tag --contains $(git rev-parse HEAD) --format='%(contents)') + echo "tag=$TAG" >> $GITHUB_ENV + echo "$TAG_BODY" > body.md - uses: ncipollo/release-action@v1 with: - name: Release ${{ steps.tag-body.outputs.TAG }} - tag: ${{ steps.tag-body.outputs.TAG }} - body: ${{ steps.tag-body.outputs.TAG_BODY }} + name: Release ${{ env.tag }} + tag: ${{ env.tag }} + bodyFile: body.md diff --git a/.gitignore b/.gitignore index c8a934b0..ba579eff 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ *_files .DS_Store .RData +.Renviron .Rhistory .Rproj.user .Ruserdata diff --git a/.zenodo.json b/.zenodo.json index 89ddb811..c60b7231 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "INBOmd: Markdown Templates for INBO", - "version": "0.6.1", + "version": "0.6.2", "license": "GPL-3.0", "upload_type": "software", "description": "

Several templates to generate reports, presentations and posters.<\/p>", @@ -15,16 +15,19 @@ "contributors": [ { "name": "Onkelinx, Thierry", + "affiliation": "Research Institute for Nature and Forest (INBO)", "orcid": "0000-0001-8804-4216", "type": "ContactPerson" }, { "name": "Vanderhaeghe, Floris", + "affiliation": "Research Institute for Nature and Forest (INBO)", "orcid": "0000-0002-6378-6229", "type": "ProjectMember" }, { "name": "Lommelen, Els", + "affiliation": "Research Institute for Nature and Forest (INBO)", "orcid": "0000-0002-3481-5684", "type": "ProjectMember" }, @@ -36,6 +39,7 @@ "creators": [ { "name": "Onkelinx, Thierry", + "affiliation": "Research Institute for Nature and Forest (INBO)", "orcid": "0000-0001-8804-4216" } ], diff --git a/CITATION.cff b/CITATION.cff index d184f141..f66cbab6 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,9 +1,10 @@ cff-version: 1.2.0 message: If you use this software, please cite it using these metadata. -title: 'INBOmd: Markdown Templates for INBO' +title: "INBOmd: Markdown Templates for INBO" authors: - given-names: Thierry family-names: Onkelinx + affiliation: Research Institute for Nature and Forest (INBO) orcid: 0000-0001-8804-4216 keywords: - markdown @@ -13,15 +14,16 @@ keywords: contact: - given-names: Thierry family-names: Onkelinx + affiliation: Research Institute for Nature and Forest (INBO) orcid: 0000-0001-8804-4216 doi: 10.5281/zenodo.842223 license: GPL-3.0 repository-code: https://github.com/inbo/INBOmd/ type: software -abstract: Several templates to generate reports, presentations and posters. +abstract: "Several templates to generate reports, presentations and posters." identifiers: - type: doi value: 10.5281/zenodo.842223 - type: url - value: [] -version: 0.6.1 + value: https://inbo.github.io/INBOmd/ +version: 0.6.2 diff --git a/DESCRIPTION b/DESCRIPTION index df4bdab3..c89b1d6f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,21 +1,24 @@ Type: Package Package: INBOmd Title: Markdown Templates for INBO -Version: 0.6.1 +Version: 0.6.2 Authors@R: c( person("Thierry", "Onkelinx", , "thierry.onkelinx@inbo.be", role = c("aut", "cre"), - comment = c(ORCID = "0000-0001-8804-4216")), + comment = c(ORCID = "0000-0001-8804-4216", affiliation = "Research Institute for Nature and Forest (INBO)")), person("Floris", "Vanderhaeghe", , "floris.vanderhaeghe@inbo.be", role = "ctb", - comment = c(ORCID = "0000-0002-6378-6229")), + comment = c(ORCID = "0000-0002-6378-6229", affiliation = "Research Institute for Nature and Forest (INBO)")), person("Els", "Lommelen", , "els.lommelen@inbo.be", role = "ctb", - comment = c(ORCID = "0000-0002-3481-5684")), + comment = c(ORCID = "0000-0002-3481-5684", affiliation = "Research Institute for Nature and Forest (INBO)")), person("Research Institute for Nature and Forest (INBO)", , , "info@inbo.be", role = c("cph", "fnd")) ) Description: Several templates to generate reports, presentations and posters. License: GPL-3 -URL: https://github.com/inbo/inbomd, https://doi.org/10.5281/zenodo.842223 +URL: https://inbo.github.io/INBOmd/, https://github.com/inbo/inbomd, + https://doi.org/10.5281/zenodo.842223 BugReports: https://github.com/inbo/inbomd/issues +Depends: + R (>= 3.5.0) Imports: assertthat, bookdown (>= 0.23.4), diff --git a/Dockerfile b/Dockerfile index adfe40c8..977e14e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -108,6 +108,13 @@ RUN apt-get update \ r-cran-tinytex \ r-cran-webshot +## Install textshape +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + libfribidi-dev \ + libharfbuzz-dev \ + && Rscript -e 'remotes::install_cran("textshape")' + ## Install ragg RUN apt-get update \ && apt-get install -y --no-install-recommends \ @@ -176,7 +183,11 @@ RUN Rscript -e 'remotes::install_cran("lipsum")' RUN Rscript -e 'remotes::install_cran("here")' ## Install gert -RUN Rscript -e 'remotes::install_cran("gert")' +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + libcurl4-openssl-dev \ + libssl-dev \ + && Rscript -e 'remotes::install_cran("gert")' ## Install webshot dependency RUN Rscript -e 'webshot::install_phantomjs()' @@ -200,6 +211,9 @@ RUN mkdir ${HOME}/.fonts \ && fc-cache -fv \ && Rscript -e 'tinytex:::updmap()' +## Install kableExtra +RUN Rscript -e 'remotes::install_cran("kableExtra")' + ## Install current version of INBOmd COPY .Rbuildignore inbomd/.Rbuildignore COPY DESCRIPTION inbomd/DESCRIPTION diff --git a/NAMESPACE b/NAMESPACE index a0ca9e38..8b55d6d3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -47,6 +47,7 @@ importFrom(bookdown,gitbook) importFrom(bookdown,pdf_book) importFrom(checklist,ask_yes_no) importFrom(checklist,menu_first) +importFrom(checklist,organisation) importFrom(checklist,read_checklist) importFrom(checklist,use_author) importFrom(dplyr,"%>%") @@ -72,7 +73,7 @@ importFrom(knitr,kable) importFrom(knitr,opts_current) importFrom(knitr,opts_knit) importFrom(pdftools,pdf_convert) -importFrom(qrcode,qrcode_gen) +importFrom(qrcode,qr_code) importFrom(rmarkdown,includes_to_pandoc_args) importFrom(rmarkdown,knitr_options) importFrom(rmarkdown,output_format) diff --git a/NEWS.md b/NEWS.md index 48094b0c..889ea4a5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,25 @@ +# INBOmd 0.6.2 + +* `pdf_report()`, `gitbook()` and `epub_book()` gain an option to create + internal reports with a different colophon. +* `pdf_report()` and `gitbook()` gain a watermark argument. + It adds a text watermark in the margin of every page. + An automatic watermark appears when one of the required colophon fields is + missing. + Adding the information for all required colophon fields will remove this + automatic watermark. +* All INBO personnel must display proper affiliation and ORCID. +* Bugfixes + # INBOmd 0.6.1 +* INBO authors and reviewers now must use their `orcid` and a standardised + `affiliation`. + We infer INBO membership from the author's email address. +* `create_report()` and `add_author()` will set the INBO author affiliation in + the language of the report. * `slides()` no longer requires a reviewer. +* Install missing `TinyTeX` installation or packages. * Bugfixes in `create_report()`. # INBOmd 0.6.0 diff --git a/R/add_author.R b/R/add_author.R index e88a315d..8d88a2c0 100644 --- a/R/add_author.R +++ b/R/add_author.R @@ -20,6 +20,13 @@ add_author <- function(path = ".") { path(path, "index.Rmd") |> readLines() -> index + lang <- grep("^lang:", index) + assert_that(length(lang) > 0, msg = "No `lang:` entry found in yaml header") + assert_that( + length(lang) == 1, msg = "Multiple `lang:` entries found in yaml header" + ) + lang <- gsub("lang: ", "", index[lang]) + author <- grep("^author:", index) assert_that( length(author) > 0, msg = "No `author:` entry found in yaml header" @@ -27,7 +34,7 @@ add_author <- function(path = ".") { assert_that( length(author) == 1, msg = "Multiple `author:` entries found in yaml header" ) - use_author() |> + check_author(lang = lang) |> author2yaml(corresponding = FALSE) -> extra top <- grep("^\\w+:", index) - 1 insert <- head(top[top > author], 1) diff --git a/R/create_report.R b/R/create_report.R index 4b7b240e..162cdd2b 100644 --- a/R/create_report.R +++ b/R/create_report.R @@ -14,7 +14,8 @@ #' @family utils #' @export #' @importFrom assertthat assert_that is.string noNA -#' @importFrom checklist ask_yes_no menu_first read_checklist use_author +#' @importFrom checklist ask_yes_no menu_first organisation read_checklist +#' use_author #' @importFrom fs dir_create file_copy is_dir is_file path #' @importFrom gert git_find create_report <- function(path = ".", shortname) { @@ -37,6 +38,16 @@ msg = "The report name folder may only contain lower case letters, digits and _" msg = "The report name folder already exists." ) + lang <- c(nl = "Dutch", en = "English", fr = "French") + lang <- names(lang)[ + menu_first(lang, title = "What is the main language of the report?") + ] + style <- c("INBO", "Vlaanderen") + style <- ifelse( + lang != "nl", "Flanders", + style[menu_first(style, title = "Which style to use?")] + ) + # build new yaml readline(prompt = "Enter the title: ") |> gsub(pattern = "[\"|']", replacement = "") |> @@ -47,10 +58,10 @@ msg = "The report name folder may only contain lower case letters, digits and _" gsub(pattern = "[\"|']", replacement = "") -> subtitle yaml <- c(yaml, paste("subtitle:", subtitle)[subtitle != ""]) cat("Please select the corresponding author") - authors <- use_author() + authors <- check_author(lang = lang) c(yaml, "author:", author2yaml(authors, corresponding = TRUE)) -> yaml while (isTRUE(ask_yes_no("Add another author?", default = FALSE))) { - author <- use_author() + author <- check_author(lang = lang) authors[, c("given", "family", "email")] |> rbind(author[, c("given", "family", "email")]) |> anyDuplicated() -> duplo @@ -66,7 +77,7 @@ msg = "The report name folder may only contain lower case letters, digits and _" cat("Please select the reviewer") duplo <- 1 while (duplo > 0) { - author <- use_author() + author <- check_author(lang = lang) authors[, c("given", "family", "email")] |> rbind(author[, c("given", "family", "email")]) |> anyDuplicated() -> duplo @@ -80,6 +91,8 @@ msg = "The report name folder may only contain lower case letters, digits and _" lang <- names(lang)[ menu_first(lang, title = "What is the main language of the report?") ] + org <- organisation$new() + aff <- org$get_organisation[["inbo.be"]]$affiliation[lang] style <- c("INBO", "Vlaanderen") style <- ifelse( lang != "nl", "Flanders", @@ -106,8 +119,7 @@ msg = "The report name folder may only contain lower case letters, digits and _" "lof: TRUE"[ask_yes_no("Do you want a list of figures?", default = FALSE)], "lot: TRUE"[ask_yes_no("Do you want a list of tables?", default = FALSE)], keywords, "community: \"inbo\"", "publication_type: report", - "funder: Research Institute for Nature and Forest (INBO)", - "rightsholder: Research Institute for Nature and Forest (INBO)", + paste("funder:", aff), paste("rightsholder:", aff), "bibliography: references.bib", "link-citations: TRUE", "site: bookdown::bookdown_site", "output:", " INBOmd::gitbook: default", " INBOmd::pdf_report: default", " INBOmd::epub_book: default", @@ -245,7 +257,7 @@ author2yaml <- function(author, corresponding = FALSE) { yaml <- c(yaml, sprintf(" orcid: \"%s\"", author$orcid)) } if (!is.na(author$affiliation) && author$affiliation != "") { - yaml <- c(yaml, paste(" affiliation: \"%s\"", author$affiliation)) + yaml <- c(yaml, sprintf(" affiliation: \"%s\"", author$affiliation)) } if (!corresponding) { return(paste(yaml, collapse = "\n")) @@ -280,3 +292,22 @@ add_address <- function(type = "client") { sprintf("%s_logo: %s", type, logo)[logo != ""] ) } + +#' @importFrom checklist use_author +check_author <- function(lang = "nl") { + person <- use_author() + if (is_inbo(person) && !person$affiliation %in% inbo_affiliation) { + paste0("`", inbo_affiliation, "`", collapse = "; ") |> + sprintf(fmt = "INBO staff must use one of %s as affiliation.") |> + cat("Please update the author information.", "\n", sep = " ") + person <- check_author(lang = "nl") + person$affiliation <- inbo_affiliation[lang] + } + if (is_inbo(person) && is.na(person$orcid)) { + cat( + "INBO staff must provide an ORCID.", + "Please update the author information.", "\n", sep = " " + ) + person <- check_author(lang = "nl") + } +} diff --git a/R/ebook.R b/R/ebook.R index 2fd17cf1..0a715ef6 100644 --- a/R/ebook.R +++ b/R/ebook.R @@ -15,6 +15,10 @@ epub_book <- function() { yaml_front_matter() |> validate_persons(reviewer = TRUE) |> validate_rightsholder() -> fm + assert_that( + has_name(fm, "reportnr"), has_name(fm, "year"), + has_name(fm, "cover_description") + ) style <- ifelse(has_name(fm, "style"), fm$style, "INBO") assert_that(length(style) == 1) assert_that(style %in% c("INBO", "Vlaanderen", "Flanders"), @@ -40,7 +44,6 @@ epub_book <- function() { style == "Flanders" || lang == "nl", msg = "Use style: Flanders when the language is not nl" ) - validate_doi(ifelse(has_name(fm, "doi"), fm$doi, "1.1/1")) pandoc_args <- c( "--csl", @@ -50,6 +53,16 @@ epub_book <- function() { "--lua-filter", system.file(file.path("pandoc", "translations.lua"), package = "INBOmd") ) + if ( + has_name(fm, "public_report") && !fm$public_report + ) { + pandoc_variable_arg("pagefootmessage", fm$reportnr) |> + c(pandoc_variable_arg("internal", "true")) |> + c(pandoc_args) -> pandoc_args + } else { + assert_that(has_name(fm, "depotnr"), has_name(fm, "doi")) + validate_doi(fm$doi) + } file.path("css_styles", c("fonts", "img")) |> system.file(package = "INBOmd") |> list.files(full.names = TRUE) -> fonts diff --git a/R/gitbook.R b/R/gitbook.R index 340b0915..caefac4e 100644 --- a/R/gitbook.R +++ b/R/gitbook.R @@ -53,7 +53,6 @@ gitbook <- function(code_folding = c("none", "show", "hide")) { split_by %in% c("chapter+number", "section+number"), msg = "`split_by` must be either 'chapter+number' or `section+number`" ) - validate_doi(ifelse(has_name(fm, "doi"), fm$doi, "1.1/1")) pandoc_args <- c( "--csl", @@ -63,6 +62,29 @@ gitbook <- function(code_folding = c("none", "show", "hide")) { "--lua-filter", system.file(file.path("pandoc", "translations.lua"), package = "INBOmd") ) + + draft <- !all(c("cover_description", "year") %in% names(fm)) + validate_doi(ifelse(has_name(fm, "doi"), fm$doi, "1.1/1")) + if ( + has_name(fm, "public_report") && !fm$public_report + ) { + c(pandoc_variable_arg("internal", "true")) |> + c(pandoc_args) -> pandoc_args + } else { + draft <- draft && !all(c("depotnr", "doi", "reportnr") %in% names(fm)) + c(fm$doi, "!!! missing DOI !!!") |> + head(1) |> + pandoc_variable_arg(name = "doi") |> + c(pandoc_args) -> pandoc_args + } + if (draft) { + c(en = "DRAFT", fr = "CONCEPTION", nl = "ONTWERP")[lang] |> + c(fm$watermark) |> + paste(collapse = "
") |> + pandoc_variable_arg(name = "watermark") |> + c(pandoc_args) -> pandoc_args + } + assert_that( getwd() |> path("index.Rmd") |> @@ -100,6 +122,7 @@ gitbook <- function(code_folding = c("none", "show", "hide")) { pandoc_variable_arg("corresponding", fm$corresponding), pandoc_variable_arg("shortauthor", fm$shortauthor) ) + template <- system.file( file.path("template", "report.html"), package = "INBOmd" ) @@ -110,7 +133,7 @@ gitbook <- function(code_folding = c("none", "show", "hide")) { template = template, extra_dependencies = list(inbomd_dep), code_folding = code_folding ) - post <- config$post_processor # in case a post processor have been defined + op <- config$post_processor # in case a post processor have been defined config$post_processor <- function(metadata, input, output, clean, verbose) { file(output, encoding = "UTF-8") |> readLines() -> x @@ -119,7 +142,7 @@ gitbook <- function(code_folding = c("none", "show", "hide")) { x <- c(head(x, i - 1), "", tail(x, -i + 1)) } writeLines(x, output) - post(metadata, input, output, clean, verbose) + op(metadata, input, output, clean, verbose) } config$clean_supporting <- TRUE return(config) diff --git a/R/pdf_report.R b/R/pdf_report.R index 82a26799..6861ffa8 100644 --- a/R/pdf_report.R +++ b/R/pdf_report.R @@ -25,50 +25,70 @@ pdf_report <- function( yaml_front_matter() |> validate_persons(reviewer = TRUE) |> validate_rightsholder() -> fm - floatbarrier <- ifelse(has_name(fm, "floatbarrier"), fm$floatbarrier, NA) - assert_that(length(floatbarrier) == 1) + stopifnot( + "`internal` option in yaml is not allowed" = !has_name(fm, "internal"), + "`pagefootmessage` option in yaml is not allowed" = + !has_name(fm, "pagefootmessage") + ) + style <- list(INBO = "nl", Vlaanderen = "nl", Flanders = c("en", "fr")) + languages <- c(nl = "dutch", en = "english", fr = "french") + hide_defaults <- list(internal = FALSE, lof = FALSE, lot = FALSE) + defaults <- c( + hide_defaults, style = names(style)[1], public_report = TRUE, +# use the first language of the style when set +# otherwise use the first language of the first style + lang = unlist(style[fm$style]) |> + c(style[[1]]) |> + head(1) |> + unname(), + floatbarrier = NA, watermark = NULL, + other_lang = list(names(languages)) + ) + extra <- !names(defaults) %in% names(fm) + fm <- c(fm, defaults[extra]) + + assert_that(length(fm$floatbarrier) == 1) assert_that( - floatbarrier %in% c(NA, "section", "subsection", "subsubsection"), + fm$floatbarrier %in% c(NA, "section", "subsection", "subsubsection"), msg = "Allowed options for `floatbarrier` are missing, 'section', 'subsection' and 'subsubsection'" ) - style <- ifelse(has_name(fm, "style"), fm$style, "INBO") stopifnot( - "`style` is not a string" = is.string(style), - "`style` is not a string" = noNA(style), - "`style` must be one of 'INBO', 'Vlaanderen' or 'Flanders'" = - style %in% c("INBO", "Vlaanderen", "Flanders") - ) - lang <- ifelse( - has_name(fm, "lang"), fm$lang, ifelse(style == "Flanders", "en", "nl") + "`style` is not a string" = is.string(fm$style), + "`style` is not a string" = noNA(fm$style), + "`style` must be one of 'INBO', 'Vlaanderen', 'Flanders'" = + fm$style %in% names(style) ) - assert_that(length(lang) == 1) - languages <- c(nl = "dutch", en = "english", fr = "french") + assert_that(length(fm$lang) == 1) assert_that( - lang %in% names(languages), + fm$lang %in% names(languages), msg = paste( "`lang` must be one of:", paste(sprintf("'%s' (%s)", names(languages), languages), collapse = ", ") ) ) assert_that( - style != "Flanders" || lang != "nl", - msg = "Use style: Vlaanderen when the main language is Dutch" + fm$lang %in% style[[fm$style]], + msg = vapply( + names(style), FUN.VALUE = character(1), style = style, + FUN = function(s, style) { + sprintf("`%s`", style[[s]]) |> + paste(collapse = ", ") |> + sprintf(fmt = "%2$s: %1$s", s) + } + ) |> + paste(collapse = "; ") |> + sprintf(fmt = "Available combinations of `style` and `lang`\n%s") ) - other_lang <- fm$other_lang - if (is.null(other_lang)) { - other_lang <- names(languages) - } - other_lang <- other_lang[other_lang != lang] + fm$other_lang <- fm$other_lang[fm$other_lang != fm$lang] assert_that( - all(other_lang %in% names(languages)), + all(fm$other_lang %in% names(languages)), msg = paste( "all `other_lang` must be in this list:", paste(sprintf("'%s' (%s)", names(languages), languages), collapse = ", ") ) ) - validate_doi(ifelse(has_name(fm, "doi"), fm$doi, "1.1/1")) path("pandoc", "inbo_rapport.tex") |> system.file(package = "INBOmd") -> template @@ -76,22 +96,8 @@ pdf_report <- function( "research-institute-for-nature-and-forest.csl", package = "INBOmd" ) - style <- ifelse(style == "Flanders" & lang == "fr", "Flandre", style) - args <- c( - "--template", template, pandoc_variable_arg("documentclass", "report"), - switch( - style, - Flanders = pandoc_variable_arg("style", "flanders_report"), - Flandre = pandoc_variable_arg("style", "flandre_report"), - Vlaanderen = pandoc_variable_arg("style", "vlaanderen_report"), - INBO = pandoc_variable_arg("style", "inbo_report") - ), - pandoc_variable_arg("corresponding", fm$corresponding), - pandoc_variable_arg("shortauthor", gsub("\\&", "\\\\&", fm$shortauthor)), - pandoc_variable_arg( - "babel", paste(languages[c(other_lang, lang)], collapse = ",") - ), + "--template", template, ifelse( compareVersion(as.character(pandoc_version()), "2") < 0, "--latex-engine", "--pdf-engine" @@ -101,14 +107,60 @@ pdf_report <- function( ) args <- args[args != ""] - if (has_name(fm, "lof") && isTRUE(fm$lof)) { - args <- c(args, pandoc_variable_arg("lof", TRUE)) + draft <- !all(c("cover_description", "year") %in% names(fm)) + if (!fm$public_report) { + Sys.time() |> + format("%Y-%m-%d %H:%M:%S") |> + c(fm$reportnr) |> + tail(1) -> fm$pagefootmessage + fm$internal <- TRUE + } else { + if (has_name(fm, "doi")) { + validate_doi(fm$doi) + draft <- draft && !all(c("depotnr", "doi", "reportnr") %in% names(fm)) + } else { + draft <- TRUE + fm$doi <- "!!! missing DOI !!!" + } + fm$pagefootmessage <- fm$doi } - if (has_name(fm, "lot") && isTRUE(fm$lot)) { - args <- c(args, pandoc_variable_arg("lot", TRUE)) + if (draft) { + c(en = "DRAFT", fr = "CONCEPTION", nl = "ONTWERP")[fm$lang] |> + c(fm$watermark) |> + paste(collapse = "\\\\") -> fm$watermark } + + fm[names(fm) %in% names(hide_defaults)] |> + unlist() -> to_hide + fm[names(to_hide)[!to_hide]] <- NULL + var_arg <- c( + documentclass = "report", + style = c( + Flanders_en = "flanders_report", Flanders_fr = "flandre_report", + Vlaanderen_nl = "vlaanderen_report", INBO_nl = "inbo_report" + )[paste(fm$style, fm$lang, sep = "_")] |> + unname(), + fm[ + c( + "corresponding", "doi", "internal", "lof", "lot", "watermark", + "pagefootmessage" + ) + ], + shortauthor = gsub("\\&", "\\\\&", fm$shortauthor), + babel = paste(languages[c(fm$other_lang, fm$lang)], collapse = ",") + ) + var_arg <- var_arg[!vapply(var_arg, is.null, logical(1))] + vapply( + seq_along(var_arg), FUN.VALUE = character(2), var_arg = var_arg, + FUN = function(i, var_arg) { + pandoc_variable_arg(names(var_arg)[i], var_arg[i]) + } + ) |> + as.vector() |> + c(args) -> args + vars <- switch( - floatbarrier, section = "", subsection = c("", "sub"), + fm$floatbarrier, section = "", subsection = c("", "sub"), subsubsection = c("", "sub", "subsub") ) floating <- lapply( @@ -250,7 +302,6 @@ validate_persons <- function(yaml, reviewer = TRUE) { c(tail(shortauthor, 1)) |> paste(collapse = " & ") -> yaml$shortauthor } - shortauthor <- paste(shortauthor, "") assert_that( length(corresponding) == 1, msg = "A single corresponding author is required." @@ -282,29 +333,54 @@ contact_person <- function(person) { gsub("\\1.", person$name$given, perl = TRUE) |> sprintf(fmt = "%2$s, %1$s", person$name$family) -> shortauthor if (!has_name(person, "orcid")) { + if (is_inbo(person)) { + sprintf( + "`orcid` required for %s %s", person$name$given, person$name$family + ) |> + stop(call. = FALSE) + } sprintf( "No `orcid` found for %s %s", person$name$given, person$name$family ) |> warning(call. = FALSE) } if (!has_name(person, "affiliation")) { + if (is_inbo(person)) { + sprintf( + "`affiliation` required for %s %s.\nMust be one of %s", + person$name$given, person$name$family, + paste0("`", inbo_affiliation, "`", collapse = "; ") + ) |> + stop(call. = FALSE) + } sprintf( "No `affiliation` found for %s %s", person$name$given, person$name$family ) |> warning(call. = FALSE) + } else { + if (is_inbo(person) && !person$affiliation %in% inbo_affiliation) { + sprintf( + "`affiliation` for %s %s must be one of %s", person$name$given, + person$name$family, paste0("`", inbo_affiliation, "`", collapse = "; ") + ) |> + stop(call. = FALSE) + } } if (is.null(person$corresponding) || !person$corresponding) { return(shortauthor) } assert_that( - "email" %in% names(person), + has_name(person, "email"), msg = "no `email` provided for the corresponding author." ) sprintf("%s<%s>", shortauthor, person$email) } #' @importFrom assertthat assert_that has_name is.string noNA +#' @importFrom checklist organisation validate_rightsholder <- function(yaml) { + org <- organisation$new() + aff <- org$get_organisation[["inbo.be"]]$affiliation stopifnot( "no `funder` found" = has_name(yaml, "funder"), "`funder` is not a string" = is.string(yaml$funder), @@ -312,8 +388,6 @@ validate_rightsholder <- function(yaml) { "no `rightsholder` found" = has_name(yaml, "rightsholder"), "`rightsholder` is not a string" = is.string(yaml$rightsholder), "`rightsholder` is not a string" = noNA(yaml$rightsholder), -"Research Institute for Nature and Forest (INBO) not defined as rightsholder" = - yaml$rightsholder == "Research Institute for Nature and Forest (INBO)", "no `community` found" = has_name(yaml, "community"), "`community` must be a string separated by `; `" = is.string(yaml$community), @@ -322,6 +396,13 @@ validate_rightsholder <- function(yaml) { "no `keywords` found" = has_name(yaml, "keywords"), "`keywords` must be a string separated by `; `" = is.string(yaml$keywords) ) + assert_that( + yaml$rightsholder %in% aff, + msg = sprintf( + "rightsholder must be one of the following\n%s", + paste(aff, collapse = "\n") + ) + ) return(yaml) } @@ -345,3 +426,11 @@ check_license <- function() { } return(invisible(NULL)) } + +#' @importFrom assertthat has_name +is_inbo <- function(person) { + if (!has_name(person, "email")) { + return(FALSE) + } + grepl("inbo.be$", person$email, ignore.case = TRUE) +} diff --git a/R/poster.R b/R/poster.R index 4080f464..ff6fe967 100644 --- a/R/poster.R +++ b/R/poster.R @@ -32,7 +32,7 @@ #' @importFrom utils compareVersion #' @importFrom grDevices pdf dev.off #' @importFrom graphics par image -#' @importFrom qrcode qrcode_gen +#' @importFrom qrcode qr_code #' @family output poster <- function( subtitle, @@ -91,11 +91,11 @@ poster <- function( extra$ORCID, function(this_orcid) { url <- paste0("https://orcid.org/", this_orcid$ID) - qr <- qrcode_gen(url, plotQRcode = FALSE, dataOutput = TRUE) + qr <- qr_code(url) qr_file <- sprintf("orcid-qr-%s.pdf", gsub(" ", "-", this_orcid$name)) pdf(qr_file, width = 1.4, height = 1.4) par(mai = rep(0, 4), mar = rep(0, 4)) - image(qr, asp = 1, col = c("#C04384", "#FFFFFF"), axes = FALSE) + plot(qr, col = c("#C04384", "#FFFFFF")) dev.off() c( this_orcid$name, @@ -112,11 +112,11 @@ poster <- function( extra$DOI, function(this_doi) { url <- paste0("https://doi.org/", this_doi$ID) - qr <- qrcode_gen(url, plotQRcode = FALSE, dataOutput = TRUE) + qr <- qr_code(url) qr_file <- sprintf("doi-qr-%s.pdf", gsub(" ", "-", this_doi$name)) pdf(qr_file, width = 1.4, height = 1.4) par(mai = rep(0, 4), mar = rep(0, 4)) - image(qr, asp = 1, col = c("#C04384", "#FFFFFF"), axes = FALSE) + plot(qr, col = c("#C04384", "#FFFFFF")) dev.off() c( this_doi$name, diff --git a/R/sysdata.rda b/R/sysdata.rda new file mode 100644 index 00000000..9ebb2dde Binary files /dev/null and b/R/sysdata.rda differ diff --git a/inst/CITATION b/inst/CITATION index 504c4e17..0503542b 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -2,12 +2,12 @@ citHeader("To cite `INBOmd` in publications please use:") # begin checklist entry bibentry( bibtype = "Manual", - title = "INBOmd: Markdown Templates for INBO. Version 0.6.1", + title = "INBOmd: Markdown Templates for INBO. Version 0.6.2", author = c( author = c(person(given = "Thierry", family = "Onkelinx"))), year = 2023, - url = "https://github.com/inbo/INBOmd/", + url = "https://inbo.github.io/INBOmd/", abstract = "Several templates to generate reports, presentations and posters.", - textVersion = "Onkelinx, Thierry (2023) INBOmd: Markdown Templates for INBO. Version 0.6.1. https://github.com/inbo/INBOmd/", + textVersion = "Onkelinx, Thierry (2023) INBOmd: Markdown Templates for INBO. Version 0.6.2. https://inbo.github.io/INBOmd/", keywords = "markdown; bookdown; corporate identity; template", doi = "10.5281/zenodo.842223", ) diff --git a/inst/local_tex/tex/latex/inbogeneric_2015/inbogeneric_2015.sty b/inst/local_tex/tex/latex/inbogeneric_2015/inbogeneric_2015.sty index 3ec35aba..54ff82c8 100644 --- a/inst/local_tex/tex/latex/inbogeneric_2015/inbogeneric_2015.sty +++ b/inst/local_tex/tex/latex/inbogeneric_2015/inbogeneric_2015.sty @@ -91,12 +91,40 @@ \RequirePackage{threeparttablex} \RequirePackage{makecell} -% settings for CSL -\newenvironment{CSLReferences}[2]% - {}% - {\par} - % settings for CSL \newenvironment{cslreferences}[2]% {}% {\par} + +\NewDocumentCommand\citeproctext{}{} +\NewDocumentCommand\citeproc{mm}{% + \begingroup\def\citeproctext{#2}\cite{#1}\endgroup} +\makeatletter + % allow citations to break across lines + \let\@cite@ofmt\@firstofone + % avoid brackets around text for \cite: + \def\@biblabel#1{} + \def\@cite#1#2{{#1\if@tempswa , #2\fi}} +\makeatother +\newlength{\cslhangindent} +\setlength{\cslhangindent}{1.5em} +\newlength{\csllabelwidth} +\setlength{\csllabelwidth}{3em} +\newenvironment{CSLReferences}[2] % #1 hanging-indent, #2 entry-spacing + {\begin{list}{}{% + \setlength{\itemindent}{0pt} + \setlength{\leftmargin}{0pt} + \setlength{\parsep}{0pt} + % turn on hanging indent if param 1 is 1 + \ifodd #1 + \setlength{\leftmargin}{\cslhangindent} + \setlength{\itemindent}{-1\cslhangindent} + \fi + % set entry spacing + \setlength{\itemsep}{#2\baselineskip}}} + {\end{list}} +\RequirePackage{calc} +\newcommand{\CSLBlock}[1]{\hfill\break\parbox[t]{\linewidth}{\strut\ignorespaces#1\strut}} +\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{\strut#1\strut}} +\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{\strut#1\strut}} +\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1} diff --git a/inst/local_tex/tex/latex/inborapport_2015/flanders_report.sty b/inst/local_tex/tex/latex/inborapport_2015/flanders_report.sty index f8da7f1e..eb8c246a 100644 --- a/inst/local_tex/tex/latex/inborapport_2015/flanders_report.sty +++ b/inst/local_tex/tex/latex/inborapport_2015/flanders_report.sty @@ -14,8 +14,12 @@ \fancyhead{} \fancyfoot{} \fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be/en}{www.vlaanderen.be}}}} -\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename \textbf{ \thepage} / \textbf{\pageref*{LastPage}}}} -\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}} +\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename~\textbf{\thepage}~/~\textbf{\pageref*{LastPage}}}} +\ifnum \@public = 0 +\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}} +\else +\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@doi}} +\fi \renewcommand{\footrule}{\vbox to 8pt{\hbox to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont\leaders\hbox{/}\hfill}\vss}} \renewcommand{\headrulewidth}{0pt} @@ -25,8 +29,12 @@ to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter} \fancyhead{} \fancyfoot{} \fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be/en}{www.vlaanderen.be}}}} - \fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}} - \fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename \textbf{ \thepage} / \textbf{\pageref*{LastPage}}}} + \ifnum \@public = 0 + \fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}} + \else + \fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@doi}} + \fi + \fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename~\textbf{ \thepage}~/~\textbf{\pageref*{LastPage}}}} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} } diff --git a/inst/local_tex/tex/latex/inborapport_2015/flanders_report_generic.sty b/inst/local_tex/tex/latex/inborapport_2015/flanders_report_generic.sty index 0dad1d8b..2f788963 100644 --- a/inst/local_tex/tex/latex/inborapport_2015/flanders_report_generic.sty +++ b/inst/local_tex/tex/latex/inborapport_2015/flanders_report_generic.sty @@ -23,9 +23,15 @@ \def\subtitle#1{\def\@subtitle{#1}} \subtitle{} +\def\pagefootmessage#1{\def\@pagefootmessage{#1}} +\pagefootmessage{} + \def\colophon#1{\def\@colophon{#1}} \colophon{1} +\def\public#1{\def\@public{#1}} +\public{1} + \def\colofonauthor#1{\def\@colofonauthor{#1}} \colofonauthor{} @@ -433,7 +439,7 @@ Gaverstraat 4, 9500 Geraardsbergen \cfcountry }{ Brussel \\ - Herman Teirlinckgebouw, Havenlaan 88 bus 73, 1000 Brussel \cfcountry + Herman Teirlinckgebouw, Havenlaan 88, 1000 Brussel \cfcountry } } @@ -501,6 +507,15 @@ \addto\extrasfrench{% \def\cfseries{Rapports de \cfinbo}% } +\addto\extrasdutch{% + \def\cfiseries{Interne rapporten van het \cfinbo}% +} +\addto\extrasenglish{% + \def\cfiseries{Internal reports of the \cfinbo}% +} +\addto\extrasfrench{% + \def\cfiseries{Rapports internes de \cfinbo}% +} \addto\extrasdutch{% \def\cfcity{Brussel}% } @@ -591,13 +606,20 @@ \textbf{e-mail:} \\ \@corresponding + \ifnum \@public = 0 + \textbf{\cfcitation} \\ \@shortauthor~(\@year). \@citetitle. \cfiseries~\@year~(\@reportnr). \cfinbo, \cfcity. + + \textbf{\cfiseries~\@year~(\@reportnr)} + \else \textbf{\cfcitation} \\ \@shortauthor~(\@year). \@citetitle. \cfseries~\@year~(\@reportnr). \cfinbo, \cfcity. DOI: \@doi \textbf{\@depotnr} \\ \textbf{\cfseries~\@year~(\@reportnr)} \\ \textbf{ISSN: 1782-9054} + \fi + - \textbf{\cfvu} \\ Maurice Hoffmann + \textbf{\cfvu} \\ Hilde Eggermont \textbf{\cfcover} \\ \@coverdescription @@ -635,7 +657,9 @@ \vspace{144pt} \hspace{10mm}\parbox[t]{140mm}{ - \fontsize{\fontsizeordernr}{\fontsizeordernrinter}\selectfont \raggedright \mainColourURL{\@doi} \\ \@ordernumber + \fontsize{\fontsizeordernr}{\fontsizeordernrinter}\selectfont \raggedright + \ifnum \@public > 1 \@doi \\ \fi + \@ordernumber } \vfill diff --git a/inst/local_tex/tex/latex/inborapport_2015/flandre_report.sty b/inst/local_tex/tex/latex/inborapport_2015/flandre_report.sty index 9e36ed42..90ccbbf0 100644 --- a/inst/local_tex/tex/latex/inborapport_2015/flandre_report.sty +++ b/inst/local_tex/tex/latex/inborapport_2015/flandre_report.sty @@ -14,8 +14,12 @@ \fancyhead{} \fancyfoot{} \fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be/fr}{www.vlaanderen.be}}}} -\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename \textbf{ \thepage} / \textbf{\pageref*{LastPage}}}} -\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}} +\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename~\textbf{\thepage}~/~\textbf{\pageref*{LastPage}}}} +\ifnum \@public = 0 +\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}} +\else +\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@doi}} +\fi \renewcommand{\footrule}{\vbox to 8pt{\hbox to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont\leaders\hbox{/}\hfill}\vss}} \renewcommand{\headrulewidth}{0pt} @@ -25,8 +29,12 @@ to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter} \fancyhead{} \fancyfoot{} \fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be/fr}{www.vlaanderen.be}}}} - \fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}} - \fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename \textbf{ \thepage} / \textbf{\pageref*{LastPage}}}} + \ifnum \@public = 0 + \fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}} + \else + \fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@doi}} + \fi + \fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename~\textbf{\thepage}~/~\textbf{\pageref*{LastPage}}}} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} } diff --git a/inst/local_tex/tex/latex/inborapport_2015/inbo_report.sty b/inst/local_tex/tex/latex/inborapport_2015/inbo_report.sty index b533acef..28ab68a5 100644 --- a/inst/local_tex/tex/latex/inborapport_2015/inbo_report.sty +++ b/inst/local_tex/tex/latex/inborapport_2015/inbo_report.sty @@ -14,8 +14,8 @@ \fancyhead{} \fancyfoot{} \fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be/inbo}{vlaanderen.be/inbo}}}} -\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina \textbf{\thepage} van \textbf{\pageref*{LastPage}}}} -\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}} +\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina~\textbf{\thepage}~van~\textbf{\pageref*{LastPage}} }} +\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}} \renewcommand{\footrule}{\vbox to 8pt{\hbox to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont\leaders\hbox{/}\hfill}\vss}} \renewcommand{\headrulewidth}{0pt} @@ -25,8 +25,8 @@ to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter} \fancyhead{} \fancyfoot{} \fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be/inbo}{vlaanderen.be/inbo}}}} - \fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}} - \fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina \textbf{\thepage} van \textbf{\pageref*{LastPage}}}} + \fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina~\textbf{\thepage}~van~\textbf{\pageref*{LastPage}}}} + \fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} } diff --git a/inst/local_tex/tex/latex/inborapport_2015/vlaanderen_report.sty b/inst/local_tex/tex/latex/inborapport_2015/vlaanderen_report.sty index fbf52c4a..67a1b28f 100644 --- a/inst/local_tex/tex/latex/inborapport_2015/vlaanderen_report.sty +++ b/inst/local_tex/tex/latex/inborapport_2015/vlaanderen_report.sty @@ -13,8 +13,12 @@ \fancyhead{} \fancyfoot{} \fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be}{www.vlaanderen.be}}}} -\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina \textbf{\thepage} van \textbf{\pageref*{LastPage}}}} -\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}} +\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina~\textbf{\thepage}~van~\textbf{\pageref*{LastPage}}}} +\ifnum \@public = 0 +\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}} +\else +\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@doi}} +\fi \renewcommand{\footrule}{\vbox to 8pt{\hbox to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont\leaders\hbox{/}\hfill}\vss}} \renewcommand{\headrulewidth}{0pt} @@ -24,8 +28,12 @@ to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter} \fancyhead{} \fancyfoot{} \fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be}{www.vlaanderen.be}}}} - \fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}} - \fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina \textbf{\thepage} van \textbf{\pageref*{LastPage}}}} + \ifnum \@public = 0 + \fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}} + \else + \fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@doi}} + \fi + \fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina~\textbf{\thepage}~van~\textbf{\pageref*{LastPage}}}} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} } diff --git a/inst/pandoc/inbo_rapport.tex b/inst/pandoc/inbo_rapport.tex index 682f6b69..0f6fe002 100644 --- a/inst/pandoc/inbo_rapport.tex +++ b/inst/pandoc/inbo_rapport.tex @@ -1,6 +1,10 @@ $if(babel)$\PassOptionsToPackage{$babel$}{babel}$endif$ \documentclass[twoside]{extreport} \usepackage{$style$} +$if(watermark)$ +\usepackage[colorspec=0.9, fontsize=0.1\paperwidth, angle=90, hpos=5mm, anchor=lm]{draftwatermark} +\DraftwatermarkOptions{text={$watermark$}} +$endif$ $if(codesize)$ \codesize{\$codesize$} $endif$ @@ -117,6 +121,8 @@ $if(hyphentation)$\hyphenation{$hyphentation$}$endif$ $if(nocolophon)$\colophon{0}$else$\colophon{1}$endif$ +$if(internal)$\public{0}$else$\public{1}$endif$ +$if(pagefootmessage)$\pagefootmessage{$pagefootmessage$}$endif$ $for(header-includes)$ $header-includes$ diff --git a/inst/pandoc/translations.lua b/inst/pandoc/translations.lua index c90f3e63..2b6048ad 100644 --- a/inst/pandoc/translations.lua +++ b/inst/pandoc/translations.lua @@ -12,6 +12,7 @@ local function translation(lang) cover = "Foto cover", depotnr = "Depotnummer", export = "Exporteer referentie als", + iseries = "Interne rapporten van het", license_pre = "Dit werk valt onder een", license = "Creative Commons Naamsvermelding 4.0 Internationaal-licentie", location = "Vestiging", @@ -34,6 +35,7 @@ local function translation(lang) country = ", Belgique", cover = "Photo de couverture", depotnr = "Numéro de dépôt", + iseries = "Rapports internes de", export = "Exporter la référence à", license_pre = "Ce rapport est sous licence", license = "Creative Commons Attribution 4.0 International Licence", @@ -58,6 +60,7 @@ local function translation(lang) country = ", Belgium", depotnr = "Deposit number", export = "Export reference to", + iseries = "Internal reports of the", license_pre = "This work is licensed under a", license = "Creative Commons Attribution 4.0 International License", location = "Location", diff --git a/inst/rmarkdown/templates/report/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/report/skeleton/skeleton.Rmd index 550fdde3..4372cd96 100644 --- a/inst/rmarkdown/templates/report/skeleton/skeleton.Rmd +++ b/inst/rmarkdown/templates/report/skeleton/skeleton.Rmd @@ -5,16 +5,17 @@ title: author: - name: given: Firstname1 - family: "Last name1" + family: Last name1 email: "firstname1.lastname1@inbo.be" orcid: 0000-0002-1825-0097 - affiliation: Research Institute for Nature and Forest (INBO) + affiliation: Instituut voor Natuur- en Bosonderzoek (INBO) corresponding: true - name: given: Firstname2 family: Lastname2 email: "voornaam2.achternaam2@inbo.be" orcid: 0000-0002-1825-0097 + affiliation: Instituut voor Natuur- en Bosonderzoek (INBO) style: INBO lang: nl @@ -25,9 +26,9 @@ reviewer: family: Lastname email: "firstname.lastname@inbo.be" orcid: 0000-0002-1825-0097 - affiliation: Research Institute for Nature and Forest (INBO) -funder: Research Institute for Nature and Forest (INBO) -rightsholder: Research Institute for Nature and Forest (INBO) + affiliation: Instituut voor Natuur- en Bosonderzoek (INBO) +funder: Instituut voor Natuur- en Bosonderzoek (INBO) +rightsholder: Instituut voor Natuur- en Bosonderzoek (INBO) community: inbo keywords: # year: diff --git a/inst/sysdata.R b/inst/sysdata.R new file mode 100644 index 00000000..1eb4699c --- /dev/null +++ b/inst/sysdata.R @@ -0,0 +1,7 @@ +inbo_affiliation <- c( + en = "Research Institute for Nature and Forest (INBO)", + nl = "Instituut voor Natuur- en Bosonderzoek (INBO)", + fr = "Institut de Recherche sur la Nature et les For\u00eats (INBO)", + de = "Institut f\u00fcr Natur- und Waldforschung (INBO)" +) +save(inbo_affiliation, file = "R/sysdata.rda") diff --git a/inst/template/report.epub3 b/inst/template/report.epub3 index 9bee73f4..4cf3e3fb 100644 --- a/inst/template/report.epub3 +++ b/inst/template/report.epub3 @@ -66,6 +66,8 @@ $if(titlepage)$ $if(ordernr)$

$ordernr$

$endif$ + $if(nocolophon)$ + $else$

$translation.colophon$

$if(reviewer)$

Reviewers:
@@ -88,7 +90,7 @@ $if(titlepage)$

$translation.mission$

$translation.location$:
- INBO $if(geraardsbergen)$Geraardsbergen
Gaverstraat 4, 9500 Geraardsbergen$else$$translation.brussels$
Herman Teirlinckgebouw, Havenlaan 88 bus 73, 1000 $translation.brussels$$endif$$translation.country$ + INBO $if(geraardsbergen)$Geraardsbergen
Gaverstraat 4, 9500 Geraardsbergen$else$$translation.brussels$
Herman Teirlinckgebouw, Havenlaan 88, 1000 $translation.brussels$$endif$$translation.country$
vlaanderen.be/inbo

e-mail:
$if(corresponding)$$corresponding$$else$info@inbo.be$endif$ @@ -104,7 +106,7 @@ $if(titlepage)$ $else$

!!!! ONTBREKEND: year !!!!

$endif$ - $title$$if(subtitle)$. $substitle$$endif$. $translation.series$ $translation.name$ + $title$$if(subtitle)$. $substitle$$endif$. $if(internal)$$translation.iseries$$else$$translation.series$$endif$ $translation.name$ $if(year)$ $year$ $endif$ @@ -113,18 +115,23 @@ $if(titlepage)$ $else$

!!!! ONTBREKEND: reportnr !!!!

$endif$ - $translation.name$, $translation.brussels$. DOI: - $if(doi)$ - $doi$ - $else$ -

!!!! ONTBREKEND: doi !!!!

+ $translation.name$, $translation.brussels$.$if(internal)$$else$ DOI: + $if(doi)$ + $doi$ + $else$ +

!!!! ONTBREKEND: doi !!!!

+ $endif$ $endif$ - $if(depotnr)$ -

$depotnr$
+ $if(internal)$ +

$translation.iseries$ $translation.name$ $else$ -

!!!! ONTBREKEND: depotnr !!!!

+ $if(depotnr)$ +

$depotnr$
+ $else$ +

!!!! ONTBREKEND: depotnr !!!!

+ $endif$ + $translation.series$ $translation.name$ $endif$ - $translation.series$ $translation.name$ $if(year)$ $year$ $endif$ @@ -132,9 +139,9 @@ $if(titlepage)$ ($reportnr$) $endif$
- ISSN: 1782‐9054 +$if(internal)$$else$ ISSN: 1782‐9054$endif$ -

$translation.vu$:
Maurice Hoffmann +

$translation.vu$:
Hilde Eggermont $if(cover_description)$

$translation.cover$:
$cover_description$ @@ -160,6 +167,7 @@ $if(titlepage)$

Creative Commons-Licentie
$translation.license_pre$ $translation.license$. + $endif$ $else$ $if(coverpage)$ diff --git a/inst/template/report.html b/inst/template/report.html index ddf038b8..6cddd669 100644 --- a/inst/template/report.html +++ b/inst/template/report.html @@ -81,6 +81,21 @@ $for(css)$ $endfor$ + +$if(watermark)$ + +$endif$ @@ -95,7 +110,7 @@ $endif$

$title$

$if(subtitle)$ -

$subtitle$

+

$subtitle$

$endif$ $for(author)$

$author.name.given$ $author.name.family$ @@ -122,81 +137,84 @@

$author.name.given$ $author.name.family$ $endif$ $endfor$ $if(date)$ -

$date$

+

$date$

$endif$ $if(doi)$ -

$doi$

+

$doi$

$endif$ $if(ordernr)$ -

$ordernr$

+

$ordernr$

$endif$ -

$translation.colophon$

- $if(reviewer)$ -

Reviewers:
- $for(reviewer)$ - $reviewer.name.given$ $reviewer.name.family$ - $if(reviewer.orcid)$ - - ORCID logo - $reviewer.orcid$ - - $endif$ - $if(reviewer.email)$ - $reviewer.email$ - $endif$
- $endfor$ + $if(nocolophon)$ $else$ -

!!!! ONTBREKEND: reviewer !!!!

- $endif$ +

$translation.colophon$

+ $if(reviewer)$ +

Reviewers:
+ $for(reviewer)$ + $reviewer.name.given$ $reviewer.name.family$ + $if(reviewer.orcid)$ + + ORCID logo + $reviewer.orcid$ + + $endif$ + $if(reviewer.email)$ + $reviewer.email$ + $endif$
+ $endfor$ + $else$ +

!!!! ONTBREKEND: reviewer !!!!

+ $endif$ -

$translation.mission$ +

$translation.mission$ -

$translation.location$:
- INBO $if(geraardsbergen)$Geraardsbergen
Gaverstraat 4, 9500 Geraardsbergen$else$$translation.brussels$
Herman Teirlinckgebouw, Havenlaan 88 bus 73, 1000 $translation.brussels$$endif$$translation.country$ -
vlaanderen.be/inbo +

$translation.location$:
+ INBO $if(geraardsbergen)$Geraardsbergen
Gaverstraat 4, 9500 Geraardsbergen$else$$translation.brussels$
Herman Teirlinckgebouw, Havenlaan 88, 1000 $translation.brussels$$endif$$translation.country$ +
vlaanderen.be/inbo -

e-mail:
$if(corresponding)$$corresponding$$else$info@inbo.be$endif$ +

e-mail:
$if(corresponding)$$corresponding$$else$info@inbo.be$endif$ -

$translation.citation$:
- $if(shortauthor)$ - $shortauthor$ - $else$ -

!!!! ONTBREKEND: shortauthor !!!!

- $endif$ - $if(year)$ - ($year$). - $else$ -

!!!! ONTBREKEND: year !!!!

- $endif$ - $title$$if(subtitle)$. $substitle$$endif$. $translation.series$ $translation.name$ - $if(year)$ - $year$ - $endif$ - $if(reportnr)$ - ($reportnr$). - $else$ -

!!!! ONTBREKEND: reportnr !!!!

- $endif$ - $translation.name$, $translation.brussels$. DOI: - $if(doi)$ - $doi$ - $else$ -

!!!! ONTBREKEND: doi !!!!

- $endif$ -
$translation.export$ - - - - +

$translation.citation$:
+ $if(shortauthor)$ + $shortauthor$ + $else$ +

!!!! ONTBREKEND: shortauthor !!!!

+ $endif$ + $if(year)$ + ($year$). + $else$ +

!!!! ONTBREKEND: year !!!!

+ $endif$ + $title$$if(subtitle)$. $substitle$$endif$. $if(internal)$$translation.iseries$$else$$translation.series$$endif$ $translation.name$ + $if(year)$ + $year$ + $endif$ + $if(reportnr)$ + ($reportnr$). + $else$ +

!!!! ONTBREKEND: reportnr !!!!

+ $endif$ + $translation.name$, $translation.brussels$. $if(internal)$$else$DOI: + $if(doi)$ + $doi$ + $else$ +

!!!! ONTBREKEND: doi !!!!

+ $endif$ + $endif$ +
$translation.export$ + + + + @@ -215,11 +233,11 @@

!!!! ONTBREKEND: doi !!!!

TY - RPRT $for(author)$AU - $author.name.family$, $author.name.given$$sep$
$endfor$ TI - $title$$if(subtitle)$. $subtitle$$endif$ -DO - $doi$ +$if(doi)$DO - $doi$$endif$ PB - $translation.name$ PP - $if(geraardsbergen)$Geraardsbergen$else$$translation.brussels$$endif$$translation.country$ PY - $year$ -SN - 1782-9054 +$if(internal)$$else$SN - 1782-9054$endif$ ER - @@ -230,66 +248,68 @@

!!!! ONTBREKEND: doi !!!!

"title":"$title$$if(subtitle)$. $subtitle$$endif$", "author":[ $for(author)${ - "family":"$author.name.family$", - "given":"$author.name.given$" + "family":"$author.name.family$", + "given":"$author.name.given$" $sep$}, $endfor$ } ], - "issued":{"date-parts":[[$year$]]}, - "publisher":"$translation.name$", - "publisher-place":"$if(geraardsbergen)$Geraardsbergen$else$$translation.brussels$$endif$$translation.country$", +"issued":{"date-parts":[[$year$]]}, +"publisher":"$translation.name$", +"publisher-place":"$if(geraardsbergen)$Geraardsbergen$else$$translation.brussels$$endif$$translation.country$", } - $if(depotnr)$ -

$depotnr$
- $else$ -

!!!! ONTBREKEND: depotnr !!!!

- $endif$ - $translation.series$ $translation.name$ - $if(year)$ - $year$ - $endif$ - $if(reportnr)$ - ($reportnr$) - $endif$ -
- ISSN: 1782‐9054 + $if(internal)$ +

$translation.iseries$ $translation.name$ + $else$ + $if(depotnr)$ +

$depotnr$
+ $else$ +

!!!! ONTBREKEND: depotnr !!!!

+ $endif$ + $translation.series$ $translation.name$ + $endif$ + $if(year)$$year$$endif$ + $if(reportnr)$($reportnr$)$endif$ +
+ $if(internal)$$else$ISSN: 1782‐9054$endif$ -

$translation.vu$:
Maurice Hoffmann +

$translation.vu$:
Hilde Eggermont - $if(cover_description)$ -

$translation.cover$:
$cover_description$ - $else$ -

!!!! ONTBREKEND: cover_description !!!!

- $endif$ + $if(cover_description)$ +

$translation.cover$:
$cover_description$ + $else$ +

!!!! ONTBREKEND: cover_description !!!!

+ $endif$ - $if(client)$ -

$translation.client$:
- $for(client)$ + $if(client)$ +

$translation.client$:
+ $for(client)$ $client$ - $sep$
- $endfor$ - $if(client_logo)$ -
- $endif$ - $endif$ + $sep$
+ $endfor$ + $if(client_logo)$ +
+ $endif$ + $endif$ - $if(cooperation)$ -

$translation.cooperation$:
- $for(cooperation)$ + $if(cooperation)$ +

$translation.cooperation$:
+ $for(cooperation)$ $cooperation$ - $sep$
- $endfor$ - $if(cooperation_logo)$ -
- $endif$ - $endif$ + $sep$
+ $endfor$ + $if(cooperation_logo)$ +
+ $endif$ + $endif$ -

Creative Commons-Licentie
$translation.license_pre$ $translation.license$. - +

Creative Commons-Licentie
$translation.license_pre$ $translation.license$. + + $endif$ $endif$ + @@ -336,7 +356,7 @@

$endfor$

 

Creative Commons-Licentie -$shortauthor$ ($year$). $doi$ +$shortauthor$ ($year$). $if(doi)$$doi$$endif$ @@ -362,6 +382,10 @@

$endif$ +$if(watermark)$ +
$watermark$
+$endif$ + diff --git a/man-roxygen/yaml_report.R b/man-roxygen/yaml_report.R index f12f75d3..f7a4dbf4 100644 --- a/man-roxygen/yaml_report.R +++ b/man-roxygen/yaml_report.R @@ -1,19 +1,25 @@ #' @section Available YAML headers options specific for reports: #' -#' Bold items are required. +#' Bold items are required when creating a public report. #' Omitting them results in an ugly warning in the rendered document. #' This is deliberate done so you can prepare the document without adding the #' information. #' But the ugly warnings nudges you to add the required information before #' publication. #' +#' - `public_report`: A logical value indicating whether the report will be +#' published or not. +#' Setting `public_report: FALSE` will alter the colophon. +#' Omitting `public_report` is equivalent to `public_report: TRUE`. +#' An internal report can't have a DOI. +#' Setting a DOI is equivalent to `public_report: TRUE`. #' - **`reviewer`**: names of the reviewers. #' Use the same syntax as for the authors. #' - **`year`**: year of publication. #' Used in the same places as `shortauthor`. #' - **`cover_photo`**: the relative path to the image you want on the cover. -#' - **`cover_description`**: Description of the cover photo, including information -#' on the author of the picture and license information. +#' - **`cover_description`**: Description of the cover photo, including +#' information on the author of the picture and license information. #' - `cover` the relative path to a pdf with the cover provided by the graphical #' designer. #' The first page of this pdf will be prepended to the pdf version of the @@ -36,3 +42,7 @@ #' - `geraardsbergen`: Set this to `TRUE` to add the address of INBO #' Geraardsbergen to the colophon. #' If not set or set to `FALSE` add the address of INBO Brussels. +#' - `watermark`: an optional text to display as a watermark on the pdf or html. +#' Note that omitting any of the required element will automatically generate +#' a watermark with the text `"DRAFT"`. +#' Fill all required fields to get ride of this automatic watermark. diff --git a/man/deprecated.Rd b/man/deprecated.Rd index c8e522c7..1985f85c 100644 --- a/man/deprecated.Rd +++ b/man/deprecated.Rd @@ -120,7 +120,11 @@ document (typically created using the \code{\link[rmarkdown]{includes}} function \item{lang}{main language} -\item{keep_tex}{Keep the intermediate tex file used in the conversion to PDF} +\item{keep_tex}{Keep the intermediate tex file used in the conversion to PDF. +Note that this argument does not control whether to keep the auxiliary +files (e.g., \file{.aux}) generated by LaTeX when compiling \file{.tex} to +\file{.pdf}. To keep these files, you may set \code{options(tinytex.clean = +FALSE)}.} \item{fig_crop}{Whether to crop PDF figures with the command \command{pdfcrop}. This requires the tools \command{pdfcrop} and diff --git a/man/epub_book.Rd b/man/epub_book.Rd index f1ed0519..6f9b9121 100644 --- a/man/epub_book.Rd +++ b/man/epub_book.Rd @@ -63,20 +63,26 @@ Add \code{corresponding: true} to the corresponding author. \section{Available YAML headers options specific for reports}{ -Bold items are required. +Bold items are required when creating a public report. Omitting them results in an ugly warning in the rendered document. This is deliberate done so you can prepare the document without adding the information. But the ugly warnings nudges you to add the required information before publication. \itemize{ +\item \code{public_report}: A logical value indicating whether the report will be +published or not. +Setting \code{public_report: FALSE} will alter the colophon. +Omitting \code{public_report} is equivalent to \code{public_report: TRUE}. +An internal report can't have a DOI. +Setting a DOI is equivalent to \code{public_report: TRUE}. \item \strong{\code{reviewer}}: names of the reviewers. Use the same syntax as for the authors. \item \strong{\code{year}}: year of publication. Used in the same places as \code{shortauthor}. \item \strong{\code{cover_photo}}: the relative path to the image you want on the cover. -\item \strong{\code{cover_description}}: Description of the cover photo, including information -on the author of the picture and license information. +\item \strong{\code{cover_description}}: Description of the cover photo, including +information on the author of the picture and license information. \item \code{cover} the relative path to a pdf with the cover provided by the graphical designer. The first page of this pdf will be prepended to the pdf version of the @@ -99,6 +105,10 @@ Only used when \code{cooperation} is set. \item \code{geraardsbergen}: Set this to \code{TRUE} to add the address of INBO Geraardsbergen to the colophon. If not set or set to \code{FALSE} add the address of INBO Brussels. +\item \code{watermark}: an optional text to display as a watermark on the pdf or html. +Note that omitting any of the required element will automatically generate +a watermark with the text \code{"DRAFT"}. +Fill all required fields to get ride of this automatic watermark. } } diff --git a/man/gitbook.Rd b/man/gitbook.Rd index 206f2fbf..64388dcb 100644 --- a/man/gitbook.Rd +++ b/man/gitbook.Rd @@ -70,20 +70,26 @@ Add \code{corresponding: true} to the corresponding author. \section{Available YAML headers options specific for reports}{ -Bold items are required. +Bold items are required when creating a public report. Omitting them results in an ugly warning in the rendered document. This is deliberate done so you can prepare the document without adding the information. But the ugly warnings nudges you to add the required information before publication. \itemize{ +\item \code{public_report}: A logical value indicating whether the report will be +published or not. +Setting \code{public_report: FALSE} will alter the colophon. +Omitting \code{public_report} is equivalent to \code{public_report: TRUE}. +An internal report can't have a DOI. +Setting a DOI is equivalent to \code{public_report: TRUE}. \item \strong{\code{reviewer}}: names of the reviewers. Use the same syntax as for the authors. \item \strong{\code{year}}: year of publication. Used in the same places as \code{shortauthor}. \item \strong{\code{cover_photo}}: the relative path to the image you want on the cover. -\item \strong{\code{cover_description}}: Description of the cover photo, including information -on the author of the picture and license information. +\item \strong{\code{cover_description}}: Description of the cover photo, including +information on the author of the picture and license information. \item \code{cover} the relative path to a pdf with the cover provided by the graphical designer. The first page of this pdf will be prepended to the pdf version of the @@ -106,6 +112,10 @@ Only used when \code{cooperation} is set. \item \code{geraardsbergen}: Set this to \code{TRUE} to add the address of INBO Geraardsbergen to the colophon. If not set or set to \code{FALSE} add the address of INBO Brussels. +\item \code{watermark}: an optional text to display as a watermark on the pdf or html. +Note that omitting any of the required element will automatically generate +a watermark with the text \code{"DRAFT"}. +Fill all required fields to get ride of this automatic watermark. } } diff --git a/man/minutes.Rd b/man/minutes.Rd index 920fee41..94520167 100644 --- a/man/minutes.Rd +++ b/man/minutes.Rd @@ -34,7 +34,11 @@ document (typically created using the \code{\link[rmarkdown]{includes}} function \item{lang}{main language} -\item{keep_tex}{Keep the intermediate tex file used in the conversion to PDF} +\item{keep_tex}{Keep the intermediate tex file used in the conversion to PDF. +Note that this argument does not control whether to keep the auxiliary +files (e.g., \file{.aux}) generated by LaTeX when compiling \file{.tex} to +\file{.pdf}. To keep these files, you may set \code{options(tinytex.clean = +FALSE)}.} \item{fig_crop}{Whether to crop PDF figures with the command \command{pdfcrop}. This requires the tools \command{pdfcrop} and diff --git a/man/mission.Rd b/man/mission.Rd index 6215cf5a..cfa81988 100644 --- a/man/mission.Rd +++ b/man/mission.Rd @@ -43,7 +43,11 @@ document (typically created using the \code{\link[rmarkdown]{includes}} function \item{lang}{main language} -\item{keep_tex}{Keep the intermediate tex file used in the conversion to PDF} +\item{keep_tex}{Keep the intermediate tex file used in the conversion to PDF. +Note that this argument does not control whether to keep the auxiliary +files (e.g., \file{.aux}) generated by LaTeX when compiling \file{.tex} to +\file{.pdf}. To keep these files, you may set \code{options(tinytex.clean = +FALSE)}.} \item{fig_crop}{Whether to crop PDF figures with the command \command{pdfcrop}. This requires the tools \command{pdfcrop} and diff --git a/man/pdf_report.Rd b/man/pdf_report.Rd index 78ed516a..1e873f55 100644 --- a/man/pdf_report.Rd +++ b/man/pdf_report.Rd @@ -76,20 +76,26 @@ Add \code{corresponding: true} to the corresponding author. \section{Available YAML headers options specific for reports}{ -Bold items are required. +Bold items are required when creating a public report. Omitting them results in an ugly warning in the rendered document. This is deliberate done so you can prepare the document without adding the information. But the ugly warnings nudges you to add the required information before publication. \itemize{ +\item \code{public_report}: A logical value indicating whether the report will be +published or not. +Setting \code{public_report: FALSE} will alter the colophon. +Omitting \code{public_report} is equivalent to \code{public_report: TRUE}. +An internal report can't have a DOI. +Setting a DOI is equivalent to \code{public_report: TRUE}. \item \strong{\code{reviewer}}: names of the reviewers. Use the same syntax as for the authors. \item \strong{\code{year}}: year of publication. Used in the same places as \code{shortauthor}. \item \strong{\code{cover_photo}}: the relative path to the image you want on the cover. -\item \strong{\code{cover_description}}: Description of the cover photo, including information -on the author of the picture and license information. +\item \strong{\code{cover_description}}: Description of the cover photo, including +information on the author of the picture and license information. \item \code{cover} the relative path to a pdf with the cover provided by the graphical designer. The first page of this pdf will be prepended to the pdf version of the @@ -112,6 +118,10 @@ Only used when \code{cooperation} is set. \item \code{geraardsbergen}: Set this to \code{TRUE} to add the address of INBO Geraardsbergen to the colophon. If not set or set to \code{FALSE} add the address of INBO Brussels. +\item \code{watermark}: an optional text to display as a watermark on the pdf or html. +Note that omitting any of the required element will automatically generate +a watermark with the text \code{"DRAFT"}. +Fill all required fields to get ride of this automatic watermark. } } diff --git a/man/poster.Rd b/man/poster.Rd index afab8db6..a48db19c 100644 --- a/man/poster.Rd +++ b/man/poster.Rd @@ -26,7 +26,11 @@ poster( \item{email}{The email address to display at the bottom. Defaults to \code{"info@inbo.be"}} -\item{keep_tex}{Keep the intermediate tex file used in the conversion to PDF} +\item{keep_tex}{Keep the intermediate tex file used in the conversion to PDF. +Note that this argument does not control whether to keep the auxiliary +files (e.g., \file{.aux}) generated by LaTeX when compiling \file{.tex} to +\file{.pdf}. To keep these files, you may set \code{options(tinytex.clean = +FALSE)}.} \item{fig_crop}{\code{TRUE} to automatically apply the \code{pdfcrop} utility (if available) to pdf figures}