Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

- Added the same CSS as in default Pandoc's template for when a CSL is used (#1045).

- `render_book()` now correctly cleans up intermediate files if a built is interrupted part way through (#986).

## MINOR CHANGES

- `anchor_sections = TRUE` becomes the default for `bookdown::gitbook()`.
Expand Down
5 changes: 3 additions & 2 deletions R/render.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ render_cur_session = function(files, main, config, output_format, clean, envir,
render_new_session = function(files, main, config, output_format, clean, envir, ...) {

# save a copy of render arguments in a temp file
render_args = tempfile('render', '.', '.rds')
render_args = tempfile('render', fileext = '.rds')
on.exit(file.remove(render_args), add = TRUE)
saveRDS(
list(output_format = output_format, ..., clean = FALSE, envir = envir),
list(output_format = output_format, ..., clean = clean, envir = envir),
render_args
)
# an RDS file to save all the metadata after compiling each Rmd
Expand All @@ -207,6 +207,7 @@ render_new_session = function(files, main, config, output_format, clean, envir,
add2 = merge_chapter_script(config, 'after')
on.exit(unlink(c(add1, add2)), add = TRUE)
# compile chapters in separate R sessions
on.exit(unlink(with_ext(files, '.md')), add = TRUE)
for (f in files[rerun]) Rscript_render(f, render_args, render_meta, add1, add2)

if (!all(dirname(files_md) == '.'))
Expand Down