Skip to content

Commit

Permalink
fix the issue reported at https://stackoverflow.com/q/56061122/559676:…
Browse files Browse the repository at this point in the history
… when format is NULL, I shouldn't call files2[[format]]; format will be NULL if the output format is not HTML or LaTeX, in which case I'll just use the default list of Rmd input files
  • Loading branch information
yihui committed May 9, 2019
1 parent 3c7aa68 commit 25ea154
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
@@ -1,7 +1,7 @@
Package: bookdown
Type: Package
Title: Authoring Books and Technical Documents with R Markdown
Version: 0.9.15
Version: 0.9.16
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"),
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Expand Up @@ -22,6 +22,8 @@

- Hyphenated words will be correctly highlighted in the search results now if spaces are used in the search keyword instead of dashes, e.g., you can search for `hand-off` using the keyword `hand off` (thanks, @aronatkins, #701).

- When `rmd_files` is configured in `_bookdown.yml`, `render_book()` will fail if the output format is not HTML or LaTeX (thanks, Ladislas Nalborczyk, https://stackoverflow.com/q/56061122/559676).

## MINOR CHANGES

- Added alt/hover text to icons on the `gitbook` toolbar (thanks, @aronatkins, #698).
Expand Down
6 changes: 2 additions & 4 deletions R/utils.R
Expand Up @@ -64,10 +64,8 @@ source_files = function(format = NULL, config = load_config(), all = FALSE) {
if (is.character(subdir)) subdir else '.', '[.]Rmd$', ignore.case = TRUE,
recursive = subdir_yes, full.names = subdir_yes
))
if (length(files2 <- config[['rmd_files']]) > 0) {
if (is.list(files2)) {
files2 = if (all && is.null(format)) unlist(files2) else files2[[format]]
}
if (length(files2 <- config[['rmd_files']]) > 0 && !is.null(format)) {
if (is.list(files2)) files2 = if (all) unlist(files2) else files2[[format]]
files = if (subdir_yes) c(files2, files) else files2
} else {
files = files[grep('^[^_]', basename(files))] # exclude those start with _
Expand Down

0 comments on commit 25ea154

Please sign in to comment.