Skip to content

Commit

Permalink
Allow to set the lang attribute, will close #82
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinFay committed Oct 2, 2020
1 parent 66aa3eb commit 31a17b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions R/html_print.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ html_print <- function(html, background = "white", viewer = getOption("viewer",
#' @param background Background color for web page
#' @param file File to write content to
#' @param libdir Directory to copy dependencies to
#' @param lang Value of the `<html>` `lang` attribute
#'
#' @export
save_html <- function(html, file, background = "white", libdir = "lib") {
save_html <- function(html, file, background = "white", libdir = "lib", lang = "en") {
force(html)
force(background)
force(libdir)
Expand Down Expand Up @@ -96,7 +97,7 @@ save_html <- function(html, file, background = "white", libdir = "lib") {

# build the web-page
html <- c("<!DOCTYPE html>",
"<html>",
sprintf('<html lang="%s">', lang),
"<head>",
"<meta charset=\"utf-8\"/>",
sprintf("<style>body{background-color:%s;}</style>", htmlEscape(background)),
Expand Down
6 changes: 4 additions & 2 deletions man/save_html.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 31a17b4

Please sign in to comment.