Skip to content

Conversation

@ellisvalentiner
Copy link
Contributor

Fixes:

  • 🐛 Allows rmd_subdir and rmd_files config parameters in _bookdown.yml to be used simultaneously. Previously rmd_files would overwrite the files list containing the files in the rmd_subdir paths.

Notes:

  • index.Rmd is likely in the project root directory and not in a subdirectory in rmd_subdir so it is probably a good idea to specify rmd_files: ["index.Rmd"] if also using rmd_subdir.

I have submitted the individual contributor agreement and welcome feedback on this pull request.

Fixes #600

@lorenzwalthert
Copy link
Contributor

Works for me to resolve #600

Copy link
Contributor

@yihui yihui left a 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)
Copy link
Contributor

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))
Copy link
Contributor

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.

@yihui yihui added this to the v0.8 milestone Aug 7, 2018
@yihui yihui merged commit 38338ba into rstudio:master Aug 7, 2018
@Gnossos
Copy link

Gnossos commented May 6, 2020

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:

rmd_files: ["index.Rmd"]
rmd_subdir: ["chapters"]

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?

@cderv
Copy link
Collaborator

cderv commented May 6, 2020

Please can you open a new issue, referencing this one, to discuss your specific case ?
It is better for us to keep track of new issue in separate GH ticket and not mixed discussions. Thank you.

Also, if Notes.Rmd is a file you don't want, you can prefix with _Notes.Rmd and it will be ignored by default (no need of rmd_files in this case) See https://bookdown.org/yihui/bookdown/usage.html#usage

By default, bookdown merges all Rmd files by the order of filenames, e.g., 01-intro.Rmd will appear before 02-literature.Rmd. Filenames that start with an underscore _ are skipped

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LaTeX template not respected when YAML option rmd_subdir is used with non-boolean value

5 participants