diff --git a/DESCRIPTION b/DESCRIPTION index 8a09f1c1e..ea24ba71f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: bookdown Type: Package Title: Authoring Books and Technical Documents with R Markdown -Version: 0.22.14 +Version: 0.22.15 Authors@R: c( person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), person("JJ", "Allaire", role = "ctb"), diff --git a/NEWS.md b/NEWS.md index 51f8e676e..94ad2f098 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # CHANGES IN bookdown VERSION 0.23 +- `bs4_book(splib_bib = TRUE)` can now be specified to have the same effect as in `gitbook()`. References will be shown at the end of each chapter and not only at the end of the book. This is useful with `bs4_book()` when a citation style not supporting footnotes is used because in that case, references are not shown inline in popups (thanks, @shirdekel, #1185). + - For HTML book formats, a default `404.html` page will now be created if none exists already. This page can be customized by adding a `_404.md` or `_404.Rmd` file which will be rendered to HTML and inserted in the book. Most web serving platforms (e.g. Netlify, GH Pages, etc.) will use this file named `404.html` in the root as a custom error page. Otherwise, like browsers do, a default 404 page is shown. For context, a 404 error indicates that the file can’t be found, and it happens when a browser can’t find a requested web page. This could happen with your online book if you shared a link to a section but change the name of this section leading to a change in url (#1035). - In `bs4_book()`, improvement regarding copy button: diff --git a/R/bs4_book.R b/R/bs4_book.R index 32acd65e1..4c4936ba5 100644 --- a/R/bs4_book.R +++ b/R/bs4_book.R @@ -38,7 +38,7 @@ #' @param repo Either link to repository where book is hosted, used to generate #' view source and edit buttons or a list with repository `base` link, default #' `branch`, `subdir` and `icon` (see "Specifying the repository"). -#' @param lib_dir,pandoc_args,extra_dependencies,... Passed on to +#' @param lib_dir,pandoc_args,extra_dependencies,split_bib,... Passed on to #' [rmarkdown::html_document()]. #' #' @section Specifying the repository: @@ -147,7 +147,8 @@ bs4_book <- function(theme = bs4_book_theme(), ..., lib_dir = "libs", pandoc_args = NULL, - extra_dependencies = NULL) { + extra_dependencies = NULL, + split_bib = FALSE) { check_packages(bs4_book_deps()) bs4_check_dots(...) @@ -175,7 +176,8 @@ bs4_book <- function(theme = bs4_book_theme(), output <- post(metadata, input, output, clean, verbose) } - output2 <- bs4_book_build(output, repo = repo, lib_dir = lib_dir) + output2 <- bs4_book_build(output, repo = repo, lib_dir = lib_dir, + split_bib = split_bib) if (clean && file.exists(output) && !same_path(output, output2)) { file.remove(output) @@ -200,7 +202,8 @@ bs4_book_theme <- function(primary = "#0068D9", ...) { bs4_book_build <- function(output = "bookdown.html", repo = NULL, lib_dir = "libs", - output_dir = opts$get("output_dir")) { + output_dir = opts$get("output_dir"), + split_bib = split_bib) { move_files_html(output, lib_dir) rmd_index <- new.env(parent = emptyenv()) @@ -209,7 +212,7 @@ bs4_book_build <- function(output = "bookdown.html", build = function(...) bs4_book_page(..., rmd_index = rmd_index), number_sections = TRUE, split_by = "chapter", - split_bib = FALSE + split_bib = split_bib ) move_files_html(output2, lib_dir) diff --git a/man/bs4_book.Rd b/man/bs4_book.Rd index 637cb28d7..d888910ea 100644 --- a/man/bs4_book.Rd +++ b/man/bs4_book.Rd @@ -11,7 +11,8 @@ bs4_book( ..., lib_dir = "libs", pandoc_args = NULL, - extra_dependencies = NULL + extra_dependencies = NULL, + split_bib = FALSE ) bs4_book_theme(primary = "#0068D9", ...) @@ -26,7 +27,7 @@ against the background.} view source and edit buttons or a list with repository \code{base} link, default \code{branch}, \code{subdir} and \code{icon} (see "Specifying the repository").} -\item{lib_dir, pandoc_args, extra_dependencies, ...}{Passed on to +\item{lib_dir, pandoc_args, extra_dependencies, split_bib, ...}{Passed on to \code{\link[rmarkdown:html_document]{rmarkdown::html_document()}}.} \item{primary}{Primary colour: used for links and background of footer.}