rename_rendered: Rename a rendered file with YAML front matter metadata

Description Usage Arguments Value See Also Examples

View source: R/rename.R

Description

Rename a rendered file with YAML front matter metadata

Usage

1
rename_rendered(file, callback)

Arguments

file

A string that gives the path to the file to rename. Should be the result of render() in order to have metadata attached.

callback

A function that gets the rendered R Markdown YAML front matter metadata as an argument, and returns a new name for file. Any changes implied to the directory or file extension are ignored – only the name is changed.

Value

A string that gives the path to the renamed file.

See Also

render() for creating an object to use as the file argument.

Examples

1
2
3
4
5
6
7
8
## Not run: 
# Make sure to use rmdmatter's render() to have metadata available
output_file <- rmdmatter::render(input_file)
rename_rendered(output_file, function(metadata) {
  with(metadata, paste(title, "by", author, "on", date))
})

## End(Not run)

mikmart/rmdmatter documentation built on Feb. 28, 2022, 12:47 a.m.