Skip to content

Allow to provide multiple filenames as input in render_book() to provide Rmd to build in the book project #1090

Open
@shirdekel

Description

@shirdekel

I'd like to use both multiple file paths in the input argument to render_book() (in order to supply multiple dependencies for drake::knitr_in() in my drake plan), as well as specify output_format = "all". However, just doing the former gives me warnings that suggest that only the first file path is being used, and supplying both gives me an error. I struggled making a minimal reprex, so instead cloned the bookdown-demo repo and executed the below. I also found an rmarkdown issue that presents the same kind of error (rstudio/rmarkdown#1722), but I couldn't easily work out how it could apply here.

Works

bookdown::render_book('index.Rmd')
bookdown::render_book('index.Rmd', output_format = "all")

Produces warnings

bookdown::render_book(c('index.Rmd', '01-intro.Rmd'))
Warning messages:
1: In if ((n1 <- nchar(p)) == 0) return(x) :
  the condition has length > 1 and only the first element will be used
2: In if (is_sub_path(p, d, n2)) { :
  the condition has length > 1 and only the first element will be used
3: In if (p2 == "") p2 = "." :
  the condition has length > 1 and only the first element will be used

Produces error

bookdown::render_book(c('index.Rmd', '01-intro.Rmd'), output_format = "all")
Error in base::file(file, encoding = "UTF-8") : 
  invalid 'description' argument

Session info

R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6

Locale: en_AU.UTF-8 / en_AU.UTF-8 / en_AU.UTF-8 / C / en_AU.UTF-8 / en_AU.UTF-8

Package version:
  base64enc_0.1.3   bookdown_0.21.6   digest_0.6.27     evaluate_0.14    
  glue_1.4.2        graphics_4.0.2    grDevices_4.0.2   highr_0.8        
  htmltools_0.5.1.1 jsonlite_1.7.2    knitr_1.31        magrittr_2.0.1   
  markdown_1.1      methods_4.0.2     mime_0.10         rlang_0.4.10     
  rmarkdown_2.7.2   stats_4.0.2       stringi_1.5.3     stringr_1.4.0    
  tinytex_0.29      tools_4.0.2       utils_4.0.2       xfun_0.21        
  yaml_2.2.1       

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('bookdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/bookdown').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancementnextto consider for next release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions