Update an ODS page with the content of an Rmd file
update_ods_page.RdAll-in-one function to fill in and update an ODS page with the content of an Rmarkdown file.
Usage
update_ods_page(
path,
page_slug,
add_extra_css = "no",
chosen_languages = "all",
title = NULL,
description = NULL,
tags = NULL,
restricted = NULL
)Arguments
- path
Path to the Rmd file.
- page_slug
Slug of the page (in the backoffice of the platform -> Pages -> New or existing page -> Properties -> Page URL).
- add_extra_css
Add css files listed in Rmarkdown yaml (output: html_document: css: ...). Default to "no" to not add extra css files. The option "append" adds the content of the css file(s) to the default Rmd style. The option "replace" replaces the default Rmd style by the content of the css file(s).
- chosen_languages
A character vector of languages in which the page should be updated. Default to "all", meaning all languages available on the platform.
- title
A character string specifying the title of the page. If not null, overwrites title from page_elements.
- description
A character string containing the description of the page. If not null, overwrites description from page_elements.
- tags
A list object of character strings containing the tags describing the page. If not null, overwrites tags from page_elements.
- restricted
A logical TRUE/FALSE indicating the reading status of the page. TRUE will make the page "public" whereas FALSE will keep its access restricted to users who where granted the permission. If not null, overwrites reading status from page_elements.
Value
If request is successful (i.e. the request was successfully performed and a response with HTTP status code <400 was received), an HTTP response; otherwise it throws an error.
Examples
if (FALSE) {
# Temporary directory for reproducible example
dir_tmp <- tempfile(pattern = "proj-")
dir.create(dir_tmp)
file.copy(from = system.file("examples/example_rmd.Rmd", package = "odsrmd"), to = dir_tmp)
file.copy(from = system.file("examples/style.css", package = "odsrmd"), to=dir_tmp)
# browseURL(dir_tmp)
path <- paste0(dir_tmp, "/example_rmd.Rmd")
page_slug <- "odsrmd-example"
update_ods_page(path, page_slug, add_extra_css = "no", chosen_languages = "all", title = NULL,
description = NULL, tags = NULL, restricted = NULL
)
}