Description Usage Arguments Value Examples
View source: R/find_and_replace.R
Find and replace all variables in one of the files of the book skeleton
1 2 3 4 5 6 | find_and_replace(
file,
replacements = c(book_title = "My book", author_name = "Marion Louveaux",
creation_date = "`r Sys.Date()`", short_description =
"An example of book with {bookprep}.", index_title = "Context")
)
|
file |
path of a file from skeleton: _bookdown.yml, _output.yml, index.Rmd, README.md |
replacements |
a vector of correspondences between an input and an output. Input is fixed and corresponds to: book_title, author_name, creation_date, short_description and index_title |
path of the modified file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # copy to a temporary file to avoid overwriting the package
index_tmp <- tempfile(pattern = "index-")
file.copy(from = system.file("book_skeleton/index.Rmd", package = "bookprep"), to = index_tmp)
bookprep:::find_and_replace(
file = index_tmp,
replacements = c(
"book_title" = "My book",
"author_name" = "Marion Louveaux",
"creation_date" = "`r Sys.Date()`",
"short_description" = "An example of book with {bookprep}.",
"index_title" = "Context"
)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.