From 7ace59f09a8d8bd9c8c516f2350747f98ac8feb2 Mon Sep 17 00:00:00 2001 From: "F. Shen" Date: Wed, 14 Oct 2020 03:11:30 +0800 Subject: [PATCH] fix #834: preserve input Rmd's origin path in opts (#955) Remove input Rmd file's path in opts could bring inconsistency. For example in `split_chapter()`, we compare `input_rmd` and `nms_chaps` to determine if we could skip writing html. Then when we call `serve_book()`, all the changed Rmd files under subdir will be ignored due to the absence of `input_rmd`'s full path. This is the root cause of #834. --- NEWS.md | 4 ++++ R/render.R | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 324488e78..e856873d2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,10 @@ - The new syntax for theorem and proof environments introduced in **bookdown** requires Pandoc >= 2.3 instead of 2.0 (thanks, @markhymers, #979 #980). +## MINOR CHANGES + +- `opts$get('input_rmd')` now stores original file path rather than basename, and when Rmd file under subdirectory changes, `serve_book()` will refresh correctly now (thanks, @shenfei, #834 #955). + # CHANGES IN bookdown VERSION 0.21 ## NEW FEATURES diff --git a/R/render.R b/R/render.R index 111bf6620..5a4e05488 100644 --- a/R/render.R +++ b/R/render.R @@ -92,7 +92,7 @@ render_book = function( if (!preview) unlink(ref_keys_path(output_dir)) # clean up reference-keys.txt # store output directory and the initial input Rmd name opts$set( - output_dir = output_dir, input_rmd = basename(input), preview = preview + output_dir = output_dir, input_rmd = input, preview = preview ) aux_diro = '_bookdown_files'