-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Allow both rmd_files and rmd_subdir config parameters
#601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Works for me to resolve #600 |
yihui
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should always add index.Rmd to the list of files if it exists.
I'll take care of these three issues by myself. Thank you very much!
R/utils.R
Outdated
| ) | ||
| if (length(config[['rmd_files']]) > 0) { | ||
| files = config[['rmd_files']] | ||
| files = c(config[['rmd_files']], files) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The concatenation needs to be done after the next if (i.e. after the list is resolved to a character vector).
R/utils.R
Outdated
| if (!is.na(index)) files = c(files[index], files[-index]) | ||
| } | ||
| check_special_chars(files) | ||
| unique(normalize_path(files)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to keep the file paths relative and should not resolve them to absolute paths. But you are right that we should make sure the file paths are unique.
… character vector of file paths
…t item in the file list
…will always be searched for Rmd files)
|
I tried using the approach in the Notes at the start of this topic but ran into trouble. In my project's root directory I have another file, Notes.rmd, which I use to keep track of things I do to configure and maintain my workflow. In _bookdown.yml I have:
And when I build the book, the build includes Notes.Rmd in the book. I had assumed this setup would only include files explicitly named in rmd_files: and search only in the directories named in rmd_subdir: (chapters). Obviously this is wrong. Is there a way to exclude Notes.Rmd from being in the built book? |
|
Please can you open a new issue, referencing this one, to discuss your specific case ? Also, if
|
Fixes:
rmd_subdirandrmd_filesconfig parameters in_bookdown.ymlto be used simultaneously. Previouslyrmd_fileswould overwrite thefileslist containing the files in thermd_subdirpaths.Notes:
index.Rmdis likely in the project root directory and not in a subdirectory inrmd_subdirso it is probably a good idea to specifyrmd_files: ["index.Rmd"]if also usingrmd_subdir.I have submitted the individual contributor agreement and welcome feedback on this pull request.
Fixes #600