read_toml | R Documentation |
The function read_toml()
reads TOML data from a file or a character
vector, and the function write_toml()
converts an R object to TOML.
read_toml(file, x = read_utf8(file), strict = TRUE)
write_toml(x, output = NULL)
toml2yaml(file, output = NULL)
yaml2toml(file, output = NULL)
file |
Path to an input (TOML or YAML) file. |
x |
For |
strict |
Whether to try RcppTOML and Hugo only (i.e., not to use
the naive parser). If |
output |
Path to an output file. If |
For read_toml()
, it first tries to use the R package RcppTOML to
read the TOML data. If RcppTOML is not available, it uses Hugo to
convert the TOML data to YAML, and reads the YAML data via the R package
yaml. If Hugo is not available, it falls back to a naive parser, which
is only able to parse top-level fields in the TOML data, and it only supports
character, logical, and numeric (including integer) scalars.
For write_toml()
, it converts an R object to YAML via the R package
yaml, and uses Hugo to convert the YAML data to TOML.
For read_toml()
, an R object. For write_toml()
,
toml2yaml()
, and yaml2toml()
, a character vector (marked by
xfun::raw_string()
) of the TOML/YAML data if output =
NULL
, otherwise the TOML/YAML data is written to the output file.
## Not run:
v = blogdown::read_toml(x = c("a = 1", "b = true", "c = \"Hello\"", "d = [1, 2]"))
v
blogdown::write_toml(v)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.