Skip to contents

Adds or updates bibliography information in a boilerplate database.

Usage

boilerplate_add_bibliography(db, url, local_path = NULL, validate = TRUE)

Arguments

db

Database object

url

URL to the bibliography file

local_path

Local filename to use when copying (default: basename of URL)

validate

Whether to validate citations on updates

Value

Updated database object

Examples

# \donttest{
# Create temporary directory for example
temp_dir <- tempfile()
dir.create(temp_dir)

# Initialise and import
boilerplate_init(data_path = temp_dir, create_dirs = TRUE, confirm = FALSE, quiet = TRUE)
db <- boilerplate_import(data_path = temp_dir, quiet = TRUE)

# Add bibliography
# Using the example bibliography included with the package
example_bib <- system.file("extdata", "example_references.bib", package = "boilerplate")
db <- boilerplate_add_bibliography(
  db,
  url = paste0("file://", example_bib),
  local_path = "references.bib"
)
#>  Bibliography information added to database
#>  URL: file:///private/var/folders/q9/lkcn14l97mb6mkhbxsxrpr4w0000gn/T/RtmpIJ7HAJ/temp_libpatha1e52c8210df/boilerplate/extdata/example_references.bib
#>  Local path: references.bib

# Save the updated database
boilerplate_save(db, data_path = temp_dir, confirm = FALSE, quiet = TRUE)

# Clean up
unlink(temp_dir, recursive = TRUE)
# }