tar_notebook_index_rmd: Create index.Rmd file

View source: R/tar-notebook.R

tar_notebook_index_rmdR Documentation

Create index.Rmd file

Description

This function creates the index.Rmd file for the notebook and sets YAML metadata in the file. It also detects CSL and bibliography file dependencies.

Usage

tar_notebook_index_rmd(
  title = "Notebook title",
  author = "Author name",
  bibliography = ymlthis::yml_blank(),
  csl = ymlthis::yml_blank(),
  index_rmd_body_lines = "",
  ...,
  .list = rlang::list2(...)
)

Arguments

title

Title to use for the notebook. Defaults to "Notebook title".

author

Author name for the notebook. Defaults to "Author Name". Multiple authors, email and affiliations can used by using a list list(name = names, email = emails). See ymlthis::yml_author().

bibliography

Name of a .bib file in the dir_notebook rmd folder. This file is copied to ⁠[dir_md]/assets/[bibliography]⁠ and saved in the YAML metadata in index.Rmd as "./assets/[bibliography]". Defaults to ymlthis::yml_blank(). This file is then tracked with targets and set as a dependency for tar_notebook().

csl

Name of a .csl file in the dir_notebook rmd folder. This file is copied to ⁠[dir_md]/assets/[csl]⁠ and saved in the YAML metadata in index.Rmd as "./assets/[csl]". Defaults to ymlthis::yml_blank(). This file is then tracked with targets and set as a dependency for tar_notebook().

index_rmd_body_lines

optional character vector to use for body text in index.Rmd. Defaults to "".

...

Additional key-value pairs for setting fields in the yml metadata. For example, subtitle = "Status: Project completed" would add a subtitle to the index.Rmd file and that subtitle would appear in the notebook. These fields cannot include "date" or "site".

.list

Alternatively, these YAML fields may be set using a list. Any key-value pairs in this list will override options set by arguments. For example, an author entry in .list would override the value in the author parameter.

Value

a list of targets:

  • notebook_bibliography_user, notebook_csl_user: file targets for the bibliography and csl files in the dir_notebook user folder.

  • notebook_bibliography_asset, notebook_csl_asset: file targets for the bibliography and csl files in the dir_md assets folder. These command to build these targets to copy them.

  • notebook_index_rmd: file target for the index.Rmd file.

If any of these file targets is not used, an empty target list() is passed along.


tjmahr/tarnotes documentation built on Jan. 27, 2025, 2:17 a.m.