From ffa01f531edf80b57e992cbca6e2e04c4ab2b032 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 29 Sep 2024 09:50:16 -0300 Subject: Fix: publisher metadata information on the PDF output --- ChangeLog.md | 6 ++++++ _common.yml | 4 +++- snippets/publisher.txt | 1 + structure/book/en/00-preamble.md | 12 ++++++++++-- structure/book/en/00-preamble.tex | 2 +- structure/book/pt-br/00-preamble.md | 12 ++++++++++-- structure/book/pt-br/00-preamble.tex | 2 +- 7 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 snippets/publisher.txt diff --git a/ChangeLog.md b/ChangeLog.md index 35eab02..5174f59 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,11 @@ # ChangeLog +## v0.2.2 - unreleased + +* [x] Fix publisher metadata information on the PDF output. + This required changing changing the "publisher" + metadata from `_common.yml` to `snippets/publisher.txt`. + ## v0.2.1 - 2024-09-16 * [x] Fix TOC spacing between section numbers and section titles when there are diff --git a/_common.yml b/_common.yml index 0e782e4..28b6aed 100644 --- a/_common.yml +++ b/_common.yml @@ -3,7 +3,9 @@ author: "Silvio Rhatto" date : "`r Sys.Date()`" # Publisher -publisher: "Bookup" +# Since neither Pandoc or Bookdown natively supports the publisher metadata, +# we read this information from snippets/publisher.txt instead. +#publisher: "Bookup" # Language lang: "en" diff --git a/snippets/publisher.txt b/snippets/publisher.txt new file mode 100644 index 0000000..1ead46a --- /dev/null +++ b/snippets/publisher.txt @@ -0,0 +1 @@ +Bookup diff --git a/structure/book/en/00-preamble.md b/structure/book/en/00-preamble.md index b42f744..8746e47 100644 --- a/structure/book/en/00-preamble.md +++ b/structure/book/en/00-preamble.md @@ -1,4 +1,4 @@ - + @@ -30,7 +30,8 @@ if (knitr::is_html_output()) { cat(readLines('snippets/volume.txt')) cat('
') cat('Published by ') - cat(rmarkdown::metadata$publisher) + #cat(rmarkdown::metadata$publisher) + cat(readLines('snippets/publisher.txt')) cat('
') cat('Published at ') cat(readLines('snippets/url.txt'), sep='\n') @@ -53,3 +54,10 @@ if (knitr::is_html_output()) { cat('

') } ``` + + +```{r echo=FALSE, results='asis'} +if (knitr::is_latex_output()) { + # Your code here +} +``` diff --git a/structure/book/en/00-preamble.tex b/structure/book/en/00-preamble.tex index 91c84bc..d128ad1 100644 --- a/structure/book/en/00-preamble.tex +++ b/structure/book/en/00-preamble.tex @@ -37,7 +37,7 @@ Copyleft \copyright\ \input{.metadata/year.txt} \thanklessauthor\ \input{snippe % https://www.typeerror.org/docs/latex/_005cprotect \par\smallcaps{\protect\input{snippets/project.txt} - \protect\input{snippets/volume.txt}} -\par\smallcaps{Published by \thanklesspublisher} +\par\smallcaps{Published by \protect\input{snippets/publisher.txt}} \par\smallcaps{\protect\input{snippets/url.txt}} diff --git a/structure/book/pt-br/00-preamble.md b/structure/book/pt-br/00-preamble.md index f3738c6..b1a24e5 100644 --- a/structure/book/pt-br/00-preamble.md +++ b/structure/book/pt-br/00-preamble.md @@ -1,4 +1,4 @@ - + @@ -30,7 +30,8 @@ if (knitr::is_html_output()) { cat(readLines('snippets/volume.txt')) cat('
') cat('Publicado por ') - cat(rmarkdown::metadata$publisher) + #cat(rmarkdown::metadata$publisher) + cat(readLines('snippets/publisher.txt')) cat('
') cat('Publicado em ') cat(readLines('snippets/url.txt'), sep='\n') @@ -53,3 +54,10 @@ if (knitr::is_html_output()) { cat('

') } ``` + + +```{r echo=FALSE, results='asis'} +if (knitr::is_latex_output()) { + # Your code here +} +``` diff --git a/structure/book/pt-br/00-preamble.tex b/structure/book/pt-br/00-preamble.tex index d558cc1..fc0f08b 100644 --- a/structure/book/pt-br/00-preamble.tex +++ b/structure/book/pt-br/00-preamble.tex @@ -37,7 +37,7 @@ Copyleft \copyright\ \input{.metadata/year.txt} \thanklessauthor\ \input{snippe % https://www.typeerror.org/docs/latex/_005cprotect \par\smallcaps{\protect\input{snippets/project.txt} - \protect\input{snippets/volume.txt}} -\par\smallcaps{Publicado por \thanklesspublisher} +\par\smallcaps{Publicado por \protect\input{snippets/publisher.txt}} \par\smallcaps{\protect\input{snippets/url.txt}} -- cgit v1.2.3