Skip to content

Commit

Permalink
Merge pull request #98 from inbo/update
Browse files Browse the repository at this point in the history
Version 0.6.3
  • Loading branch information
ThierryO committed Jan 12, 2024
2 parents 47b9e30 + c52b560 commit 9193adc
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/examples.yml
Expand Up @@ -14,9 +14,9 @@ jobs:
name: "test Rmd"
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: build examples
uses: inbo/actions/render_inbomd@inbomd-0.6.2
uses: inbo/actions/render_inbomd@inbomd-0.6.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EXAMPLE_BRANCH: main
Expand Down
2 changes: 1 addition & 1 deletion .zenodo.json
@@ -1,6 +1,6 @@
{
"title": "INBOmd: Markdown Templates for INBO",
"version": "0.6.2",
"version": "0.6.3",
"license": "GPL-3.0",
"upload_type": "software",
"description": "<p>Several templates to generate reports, presentations and posters.<\/p>",
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Expand Up @@ -26,4 +26,4 @@ identifiers:
value: 10.5281/zenodo.842223
- type: url
value: https://inbo.github.io/INBOmd/
version: 0.6.2
version: 0.6.3
4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Type: Package
Package: INBOmd
Title: Markdown Templates for INBO
Version: 0.6.2
Version: 0.6.3
Authors@R: c(
person("Thierry", "Onkelinx", , "thierry.onkelinx@inbo.be", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-8804-4216", affiliation = "Research Institute for Nature and Forest (INBO)")),
Expand Down Expand Up @@ -49,4 +49,4 @@ Config/checklist/keywords: markdown; bookdown; corporate identity;
Encoding: UTF-8
Language: en-GB
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.0
11 changes: 5 additions & 6 deletions Dockerfile
Expand Up @@ -57,12 +57,6 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git

## Install pandoc
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
pandoc \
pandoc-citeproc

## Install gpg
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand All @@ -82,6 +76,11 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends \
r-base-dev

## Install pandoc
RUN wget https://github.com/jgm/pandoc/releases/download/3.1.8/pandoc-3.1.8-1-amd64.deb \
&& dpkg -i pandoc-3.1.8-1-amd64.deb \
&& rm pandoc-3.1.8-1-amd64.deb

COPY docker/.Rprofile /usr/lib/R/etc/Rprofile.site

## R packages
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Expand Up @@ -77,6 +77,7 @@ importFrom(qrcode,qr_code)
importFrom(rmarkdown,includes_to_pandoc_args)
importFrom(rmarkdown,knitr_options)
importFrom(rmarkdown,output_format)
importFrom(rmarkdown,pandoc_available)
importFrom(rmarkdown,pandoc_options)
importFrom(rmarkdown,pandoc_path_arg)
importFrom(rmarkdown,pandoc_variable_arg)
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
@@ -1,3 +1,8 @@
# INBOmd 0.6.3

* `pdf_report()` enforces pandoc >= 3.1.8
* `create_report()` fixed (#97)

# INBOmd 0.6.2

* `pdf_report()`, `gitbook()` and `epub_book()` gain an option to create
Expand Down
1 change: 1 addition & 0 deletions R/create_report.R
Expand Up @@ -310,4 +310,5 @@ check_author <- function(lang = "nl") {
)
person <- check_author(lang = "nl")
}
return(person)
}
24 changes: 10 additions & 14 deletions R/pdf_report.R
Expand Up @@ -7,13 +7,13 @@
#' @export
#' @importFrom assertthat assert_that has_name is.string
#' @importFrom fs path
#' @importFrom rmarkdown output_format knitr_options pandoc_options
#' pandoc_variable_arg includes_to_pandoc_args pandoc_version
#' @importFrom utils compareVersion
#' @importFrom rmarkdown output_format knitr_options pandoc_available
#' pandoc_options pandoc_variable_arg includes_to_pandoc_args
#' @family output
pdf_report <- function(
fig_crop = "auto", includes = NULL, pandoc_args = NULL, ...
) {
pandoc_available(version = "3.1.8", error = TRUE)
dots <- list(...)
assert_that(
!has_name(dots, "number_sections"), msg =
Expand Down Expand Up @@ -97,12 +97,8 @@ pdf_report <- function(
)

args <- c(
"--template", template,
ifelse(
compareVersion(as.character(pandoc_version()), "2") < 0,
"--latex-engine", "--pdf-engine"
),
"xelatex", pandoc_args, c("--csl", pandoc_path_arg(csl)),
"--template", template, "--pdf-engine",
"xelatex", pandoc_args, "--csl", pandoc_path_arg(csl),
includes_to_pandoc_args(includes)
)
args <- args[args != ""]
Expand Down Expand Up @@ -195,11 +191,11 @@ pdf_report <- function(

# move appendix after bibliography
appendix <- grep("\\\\appendix", text)
startbib <- grep("\\\\hypertarget\\{refs\\}\\{\\}", text) # nolint: absolute_path_linter, line_length_linter.
startbib <- grep("\\\\phantomsection\\\\label\\{refs\\}", text) # nolint: absolute_path_linter, line_length_linter.
if (length(startbib)) {
if (length(appendix)) {
text <- c(
text[1:(appendix - 1)], # mainmatter
head(text, appendix - 1), # mainmatter
"\\chapter*{\\bibname}",
"\\addcontentsline{toc}{chapter}{\\bibname}",
text[startbib], # bibliography
Expand All @@ -208,18 +204,18 @@ pdf_report <- function(
"",
text[(startbib + 2):(length(text) - 1)],
text[(appendix):(startbib - 1)], # appendix
text[length(text)] # backmatter
tail(text, 1) # backmatter
)
} else {
text <- c(
text[1:(startbib - 1)], # mainmatter
head(text, startbib - 1), # mainmatter
"\\chapter*{\\bibname}",
"\\addcontentsline{toc}{chapter}{\\bibname}",
text[startbib], # bibliography
"",
text[startbib + 1],
"",
text[(startbib + 2):length(text)]
tail(text, -startbib - 1)
)
}
}
Expand Down
6 changes: 3 additions & 3 deletions inst/CITATION
Expand Up @@ -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.2",
title = "INBOmd: Markdown Templates for INBO. Version 0.6.3",
author = c( author = c(person(given = "Thierry", family = "Onkelinx"))),
year = 2023,
year = 2024,
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.2. https://inbo.github.io/INBOmd/",
textVersion = "Onkelinx, Thierry (2024) INBOmd: Markdown Templates for INBO. Version 0.6.3. https://inbo.github.io/INBOmd/",
keywords = "markdown; bookdown; corporate identity; template",
doi = "10.5281/zenodo.842223",
)
Expand Down

0 comments on commit 9193adc

Please sign in to comment.