Compare commits

..

7 Commits

20 changed files with 111 additions and 960 deletions

View File

@@ -1,6 +1,6 @@
Package: AVSDevR.HTMLUtils
Title: Utility Functions For Modifying R HTML Elements
Version: 1.0.0
Version: 0.0.4
Authors@R:
person("Craig", "Williams", , "craig@avsdev.uk", role = c("aut", "cre"))
Description: Collection of utility functions for modifying HTML markup of
@@ -15,10 +15,10 @@ Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
Imports:
htmltools,
jsonlite,
stringi
rlang
Suggests:
shiny,
shinydashboard,
slugify,
testthat (>= 3.0.0)
Config/testthat/edition: 3

View File

@@ -3,17 +3,12 @@
export(htmlAddBoxAttributes)
export(htmlAddBoxHelpLink)
export(htmlAddBoxRegionFromTitle)
export(htmlAddClasses)
export(htmlAppendAttributes)
export(htmlButtonStyle)
export(htmlDisableAutocomplete)
export(htmlFixBoxCollapseButtonAria)
export(htmlMarkOptional)
export(htmlMarkRequired)
export(htmlRemoveAttributes)
export(htmlRemoveBoxTitle)
export(htmlRemoveClasses)
export(htmlReplaceBoxTitleLevel)
export(htmlSetMaxLength)
export(htmlSetMinLength)
export(htmlSlugify)

View File

@@ -1,14 +0,0 @@
#' Appends attributes to an HTML element
#'
#' @param el The element to append the attributes to
#' @param ... The attribute names to be appended
#'
#' @return The modified element
#' @export
#'
#' @examples
#' x <- shiny::icon("wrench")
#' htmlAppendAttributes(x, `role` = "presentation")
htmlAppendAttributes <- function(el, ...) {
do.call(htmltools::tagQuery(el)$addAttrs, list(...))$allTags()
}

View File

@@ -20,11 +20,12 @@ getBoxTitle <- function(box) {
#'
#' @examples
#' x <- shinydashboard::box()
#' htmlAddBoxAttributes(
#' x, role = "region", `aria-label` = "This is a special box"
#' )
#' htmlAddBoxAttributes(x, role = "region", `aria-label` = "This is a special box")
htmlAddBoxAttributes <- function(box, ...) {
htmltools::tagQuery(box)$find(".box")$addAttr(...)$allTags()
htmltools::tagQuery(box)$
find(".box")$
addAttr(...)$
allTags()
}
#' Creates an aria landmark for a `shinydashboard::box` from the box title
@@ -83,13 +84,16 @@ htmlFixBoxCollapseButtonAria <- function(box, context = NULL) {
}
htmltools::tagQuery(box)$
find(".box-tools button.btn-box-tool")$
addAttrs(`aria-label` = paste0("Expand/Collapse ", context))$allTags()
addAttrs(`aria-label` = paste0("Expand/Collapse ", context))$
allTags()
}
#' Adds a "help" (question mark) icon to a box tools section (right side)
#'
#' The uri to load can have a replacement marker supplied '%box%' which will be
#' substituded with a sanitized copy of the box title.
#' substituded with a sanitized copy of the box title. Preference is given to
#' the slugify package, however if unavailable a warning is generated and the
#' fallback of URLEncode is used.
#'
#' @param box The box to add a help icon/link to
#' @param href The help uri to load
@@ -124,7 +128,17 @@ htmlAddBoxHelpLink <- function(box, href, title = NULL) {
if (is.null(title)) {
title <- box_title
}
box_title <- htmlSlugify(box_title)
if (requireNamespace("slugify")) {
box_title <- slugify::slugify(box_title)
} else {
rlang::warn(
"slugify is not installed, resorting to URLencode",
.frequency = "regularly",
.frequency_id = "htmlAddBoxHelpLink::slugify"
)
box_title <- utils::URLencode(box_title)
}
htmltools::tagInsertChildren(
box,
@@ -135,14 +149,12 @@ htmlAddBoxHelpLink <- function(box, href, title = NULL) {
target = "_blank",
class = "btn btn-box-tool pl-3 pr-3",
htmlRemoveAttributes(shiny::icon("question"), "aria-label"),
title = paste(trimws(title), " help link"),
`aria-label` = paste(trimws(title), " help link")
title = paste(trimws(title), " help link")
)
)
}
#' Removes title from box element (leaving an un-titled box with header if
#' required)
#' Removes title from box element (leaving an un-titled box with header if required)
#'
#' @param box The box to remove the title from
#' @param removeHeader Remove the header as well
@@ -157,10 +169,9 @@ htmlRemoveBoxTitle <- function(box, removeHeader = FALSE) {
if (removeHeader) {
htmltools::tagQuery(box)$find(".box-header")$remove()$allTags()
} else {
htmltools::tagQuery(box)$find(".box-title")$replace(
htmltools::tags$span(
class = "empty-box-title", htmltools::HTML("&nbsp;")
)
)$allTags()
htmltools::tagQuery(box)$
find(".box-title")$
replace(htmltools::tags$span())$
allTags()
}
}

View File

@@ -1,50 +0,0 @@
#' Add classes to an HTML element
#'
#' @param el The element to add the class(es) to
#' @param classes The class(es) to be added
#'
#' @return The modified element
#' @export
#'
#' @examples
#' x <- shiny::tags$div()
#' htmlAddClasses(x, "btn-warning")
htmlAddClasses <- function(el, classes) {
htmltools::tagQuery(el)$addClass(classes)$allTags()
}
#' Remove classes from an HTML element
#'
#' @param el The element to remove the class(es) from
#' @param classes The class(es) to be added
#'
#' @return The modified element
#' @export
#'
#' @examples
#' x <- shiny::tags$div(class = "btn btn-warning")
#' htmlRemoveClasses(x, "btn-warning")
htmlRemoveClasses <- function(el, classes) {
htmltools::tagQuery(el)$removeClass(classes)$allTags()
}
#' Changes the style of a button from btn-default to another style
#'
#' @param el The button
#' @param style The style to change the button on
#'
#' @return The modified element
#' @export
#'
#' @examples
#' x <- shiny::tags$div(class = "btn btn-warning")
#' htmlButtonStyle(x, "warning")
htmlButtonStyle <- function(el, style) {
stopifnot(style %in% c(
"default", "primary", "secondary", "info", "warning", "success", "danger",
"link"
))
el <- htmlRemoveClasses(el, "btn-default")
el <- htmlAddClasses(el, paste0("btn-", style))
el
}

View File

@@ -10,5 +10,7 @@
#' htmlDisableAutocomplete(x)
htmlDisableAutocomplete <- function(input) {
htmltools::tagQuery(input)$
find("input")$addAttr(autocomplete = "off")$allTags()
find("input")$
addAttr(autocomplete = "off")$
allTags()
}

View File

@@ -12,18 +12,24 @@
htmlMarkOptional <- function(input, optClass = "text-muted font-italic") {
opt_span <- htmltools::tags$span(class = optClass, " (optional)")
tq <- htmltools::tagQuery(input)
if (tq$find("legend")$length() > 0) {
tq <- tq$children("legend")$append(opt_span)$reset()
} else if (tq$hasClass("shiny-input-checkboxgroup")) {
tq <- tq$children("label")$append(opt_span)$reset()
if (tq$hasClass("shiny-input-checkboxgroup")) {
tq <- tq$
children("label")$append(opt_span)$
reset()
} else if (tq$find(".shiny-options-group")$length() > 0) {
tq <- tq$children("label")$append(opt_span)$reset()
tq <- tq$
children("label")$append(opt_span)$
reset()
} else if (tq$find(".btn-file")$length() > 0) {
tq <- tq$children("label")$append(opt_span)$reset()
tq <- tq$
children("label")$append(opt_span)$
reset()
} else {
tq <- tq$
children(".checkbox")$find("label span")$append(opt_span)$reset()$
find("label.control-label")$append(opt_span)$reset()
children(".checkbox")$find("label span")$append(opt_span)$
reset()$
find("label.control-label")$append(opt_span)$
reset()
}
tq$allTags()
}

View File

@@ -12,40 +12,43 @@
htmlMarkRequired <- function(input, reqClass = "text-danger required") {
req_span <- htmltools::tags$span(class = reqClass, "*")
tq <- htmltools::tagQuery(input)
if (tq$find("legend")$length() > 0) {
tq <- tq$children("legend")$append(req_span)$reset()
tq <- tq$find("input")$addAttr(
required = "true", `aria-required` = "true"
)$reset()
} else if (tq$hasClass("shiny-input-checkboxgroup")) {
tq <- tq$addAttr(`aria-required` = "true")$reset()
tq <- tq$children("label")$append(req_span)$reset()
if (tq$hasClass("shiny-input-checkboxgroup")) {
tq <- tq$
addAttr(`aria-required` = "true")$
reset()$
children("label")$append(req_span)$
reset()
} else if (tq$find(".shiny-options-group")$length() > 0) {
tq <- tq$addAttr(`aria-required` = "true")$reset()
tq <- tq$children("label")$append(req_span)$reset()
tq <- tq$find("input")$addAttr(
required = "true", `aria-required` = "true"
)$reset()
tq <- tq$
children("label")$append(req_span)$
reset()$
addAttr(`aria-required` = "true")$
reset()$
find("input")$addAttr(required = "true", `aria-required` = "true")$
reset()
} else if (tq$find(".btn-file")$length() > 0) {
tq <- tq$children("label")$append(req_span)$reset()
tq <- tq$addAttr(`aria-required` = "true")$reset()
tq <- tq$find(".shiny-input-file")$addAttr(
required = "true", `aria-required` = "true"
)$reset()
tq <- tq$
children("label")$append(req_span)$
reset()$
addAttr(`aria-required` = "true")$
reset()$
find(".shiny-input-file")$
addAttr(required = "true", `aria-required` = "true")$
reset()
} else {
tq <- tq$
# Update the label
tq <- tq$children(".checkbox")$find("label span")$append(req_span)$reset()
tq <- tq$find("label.control-label")$append(req_span)$reset()
children(".checkbox")$find("label span")$append(req_span)$
reset()$
find("label.control-label")$append(req_span)$
reset()$
# Update the inputs
tq <- tq$find("input")$addAttr(
required = "true", `aria-required` = "true"
)$reset()
tq <- tq$find("textarea")$addAttr(
required = "true", `aria-required` = "true"
)$reset()
tq <- tq$find("select")$addAttr(
required = "true", `aria-required` = "true"
)$reset()
find("input")$addAttr(required = "true", `aria-required` = "true")$
reset()$
find("textarea")$addAttr(required = "true", `aria-required` = "true")$
reset()$
find("select")$addAttr(required = "true", `aria-required` = "true")$
reset()
}
tq$allTags()
}

View File

@@ -10,5 +10,7 @@
#' x <- shiny::icon("wrench")
#' htmlRemoveAttributes(x, "aria-label")
htmlRemoveAttributes <- function(el, ...) {
htmltools::tagQuery(el)$removeAttrs(list(...))$allTags()
htmltools::tagQuery(el)$
removeAttrs(list(...))$
allTags()
}

View File

@@ -11,9 +11,15 @@
#' htmlSetMaxLength(x, 50)
htmlSetMaxLength <- function(input, length) {
htmltools::tagQuery(input)$
find(".shiny-input-password")$addAttr(maxlength = length)$reset()$
find(".shiny-input-text")$addAttr(maxlength = length)$reset()$
find("textarea")$addAttr(maxlength = length)$allTags()
find(".shiny-input-password")$
addAttr(maxlength = length)$
reset()$
find(".shiny-input-text")$
addAttr(maxlength = length)$
reset()$
find("textarea")$
addAttr(maxlength = length)$
allTags()
}
#' Set the minimum length on a text or textarea input
@@ -29,7 +35,13 @@ htmlSetMaxLength <- function(input, length) {
#' htmlSetMinLength(x, 3)
htmlSetMinLength <- function(input, length) {
htmltools::tagQuery(input)$
find(".shiny-input-password")$addAttr(minlength = length)$reset()$
find(".shiny-input-text")$addAttr(minlength = length)$reset()$
find("textarea")$addAttr(minlength = length)$allTags()
find(".shiny-input-password")$
addAttr(minlength = length)$
reset()$
find(".shiny-input-text")$
addAttr(minlength = length)$
reset()$
find("textarea")$
addAttr(minlength = length)$
allTags()
}

View File

@@ -1,46 +0,0 @@
slugify_charmap_env <- new.env()
#' Native(ish) R slugify
#'
#' @param x String to slugify
#' @param repl What to replace spaces with (default: -)
#' @param lower Lower case the output string
#'
#' @return The slugified output string
#' @export
#'
#' @examples
#' x <- c(
#' "A very short example",
#' "This has a $ symbol",
#' "user@example.com",
#' "~~ABC123~~",
#' "τυχαίος",
#' "file:///tmp/some/path"
#' )
#' htmlSlugify(x)
#' htmlSlugify(x, "_")
htmlSlugify <- function(x, repl = "-", lower = TRUE)
{
if (!exists("slugify_charmap", envir = slugify_charmap_env)){
assign(
"slugify_charmap",
jsonlite::fromJSON(
system.file("slugify_charmap.json", package = "AVSDevR.HTMLUtils")
),
envir = slugify_charmap_env
)
}
slugify_charmap <- get("slugify_charmap", envir = slugify_charmap_env)
x <- stringi::stri_replace_all_fixed(
x, names(slugify_charmap), slugify_charmap, vectorize_all = FALSE
)
x <- stringi::stri_replace_all_regex(x, "[^\\P{P}-]", "")
x <- stringi::stri_trim_both(x)
x <- stringi::stri_replace_all_regex(x, "[[:space:]]+", repl)
if (lower) {
x <- stringi::stri_trans_tolower(x)
}
x
}

View File

@@ -1,643 +0,0 @@
{
"$": "dollar",
"%": "percent",
"&": "and",
"<": "less",
">": "greater",
"|": "or",
"¢": "cent",
"£": "pound",
"¤": "currency",
"¥": "yen",
"©": "(c)",
"ª": "a",
"®": "(r)",
"º": "o",
"À": "A",
"Á": "A",
"Â": "A",
"Ã": "A",
"Ä": "A",
"Å": "A",
"Æ": "AE",
"Ç": "C",
"È": "E",
"É": "E",
"Ê": "E",
"Ë": "E",
"Ì": "I",
"Í": "I",
"Î": "I",
"Ï": "I",
"Ð": "D",
"Ñ": "N",
"Ò": "O",
"Ó": "O",
"Ô": "O",
"Õ": "O",
"Ö": "O",
"Ø": "O",
"Ù": "U",
"Ú": "U",
"Û": "U",
"Ü": "U",
"Ý": "Y",
"Þ": "TH",
"ß": "ss",
"à": "a",
"á": "a",
"â": "a",
"ã": "a",
"ä": "a",
"å": "a",
"æ": "ae",
"ç": "c",
"è": "e",
"é": "e",
"ê": "e",
"ë": "e",
"ì": "i",
"í": "i",
"î": "i",
"ï": "i",
"ð": "d",
"ñ": "n",
"ò": "o",
"ó": "o",
"ô": "o",
"õ": "o",
"ö": "o",
"ø": "o",
"ù": "u",
"ú": "u",
"û": "u",
"ü": "u",
"ý": "y",
"þ": "th",
"ÿ": "y",
"Ā": "A",
"ā": "a",
"Ă": "A",
"ă": "a",
"Ą": "A",
"ą": "a",
"Ć": "C",
"ć": "c",
"Č": "C",
"č": "c",
"Ď": "D",
"ď": "d",
"Đ": "DJ",
"đ": "dj",
"Ē": "E",
"ē": "e",
"Ė": "E",
"ė": "e",
"Ę": "e",
"ę": "e",
"Ě": "E",
"ě": "e",
"Ğ": "G",
"ğ": "g",
"Ģ": "G",
"ģ": "g",
"Ĩ": "I",
"ĩ": "i",
"Ī": "i",
"ī": "i",
"Į": "I",
"į": "i",
"İ": "I",
"ı": "i",
"Ķ": "k",
"ķ": "k",
"Ļ": "L",
"ļ": "l",
"Ľ": "L",
"ľ": "l",
"Ł": "L",
"ł": "l",
"Ń": "N",
"ń": "n",
"Ņ": "N",
"ņ": "n",
"Ň": "N",
"ň": "n",
"Ō": "O",
"ō": "o",
"Ő": "O",
"ő": "o",
"Œ": "OE",
"œ": "oe",
"Ŕ": "R",
"ŕ": "r",
"Ř": "R",
"ř": "r",
"Ś": "S",
"ś": "s",
"Ş": "S",
"ş": "s",
"Š": "S",
"š": "s",
"Ţ": "T",
"ţ": "t",
"Ť": "T",
"ť": "t",
"Ũ": "U",
"ũ": "u",
"Ū": "u",
"ū": "u",
"Ů": "U",
"ů": "u",
"Ű": "U",
"ű": "u",
"Ų": "U",
"ų": "u",
"Ŵ": "W",
"ŵ": "w",
"Ŷ": "Y",
"ŷ": "y",
"Ÿ": "Y",
"Ź": "Z",
"ź": "z",
"Ż": "Z",
"ż": "z",
"Ž": "Z",
"ž": "z",
"Ə": "E",
"ƒ": "f",
"Ơ": "O",
"ơ": "o",
"Ư": "U",
"ư": "u",
"Lj": "LJ",
"lj": "lj",
"Nj": "NJ",
"nj": "nj",
"Ș": "S",
"ș": "s",
"Ț": "T",
"ț": "t",
"ə": "e",
"˚": "o",
"Ά": "A",
"Έ": "E",
"Ή": "H",
"Ί": "I",
"Ό": "O",
"Ύ": "Y",
"Ώ": "W",
"ΐ": "i",
"Α": "A",
"Β": "B",
"Γ": "G",
"Δ": "D",
"Ε": "E",
"Ζ": "Z",
"Η": "H",
"Θ": "8",
"Ι": "I",
"Κ": "K",
"Λ": "L",
"Μ": "M",
"Ν": "N",
"Ξ": "3",
"Ο": "O",
"Π": "P",
"Ρ": "R",
"Σ": "S",
"Τ": "T",
"Υ": "Y",
"Φ": "F",
"Χ": "X",
"Ψ": "PS",
"Ω": "W",
"Ϊ": "I",
"Ϋ": "Y",
"ά": "a",
"έ": "e",
"ή": "h",
"ί": "i",
"ΰ": "y",
"α": "a",
"β": "b",
"γ": "g",
"δ": "d",
"ε": "e",
"ζ": "z",
"η": "h",
"θ": "8",
"ι": "i",
"κ": "k",
"λ": "l",
"μ": "m",
"ν": "n",
"ξ": "3",
"ο": "o",
"π": "p",
"ρ": "r",
"ς": "s",
"σ": "s",
"τ": "t",
"υ": "y",
"φ": "f",
"χ": "x",
"ψ": "ps",
"ω": "w",
"ϊ": "i",
"ϋ": "y",
"ό": "o",
"ύ": "y",
"ώ": "w",
"Ё": "Yo",
"Ђ": "DJ",
"Є": "Ye",
"І": "I",
"Ї": "Yi",
"Ј": "J",
"Љ": "LJ",
"Њ": "NJ",
"Ћ": "C",
"Џ": "DZ",
"А": "A",
"Б": "B",
"В": "V",
"Г": "G",
"Д": "D",
"Е": "E",
"Ж": "Zh",
"З": "Z",
"И": "I",
"Й": "J",
"К": "K",
"Л": "L",
"М": "M",
"Н": "N",
"О": "O",
"П": "P",
"Р": "R",
"С": "S",
"Т": "T",
"У": "U",
"Ф": "F",
"Х": "H",
"Ц": "C",
"Ч": "Ch",
"Ш": "Sh",
"Щ": "Sh",
"Ъ": "U",
"Ы": "Y",
"Ь": "",
"Э": "E",
"Ю": "Yu",
"Я": "Ya",
"а": "a",
"б": "b",
"в": "v",
"г": "g",
"д": "d",
"е": "e",
"ж": "zh",
"з": "z",
"и": "i",
"й": "j",
"к": "k",
"л": "l",
"м": "m",
"н": "n",
"о": "o",
"п": "p",
"р": "r",
"с": "s",
"т": "t",
"у": "u",
"ф": "f",
"х": "h",
"ц": "c",
"ч": "ch",
"ш": "sh",
"щ": "sh",
"ъ": "u",
"ы": "y",
"ь": "",
"э": "e",
"ю": "yu",
"я": "ya",
"ё": "yo",
"ђ": "dj",
"є": "ye",
"і": "i",
"ї": "yi",
"ј": "j",
"љ": "lj",
"њ": "nj",
"ћ": "c",
"ѝ": "u",
"џ": "dz",
"Ґ": "G",
"ґ": "g",
"Ғ": "GH",
"ғ": "gh",
"Қ": "KH",
"қ": "kh",
"Ң": "NG",
"ң": "ng",
"Ү": "UE",
"ү": "ue",
"Ұ": "U",
"ұ": "u",
"Һ": "H",
"һ": "h",
"Ә": "AE",
"ә": "ae",
"Ө": "OE",
"ө": "oe",
"Ա": "A",
"Բ": "B",
"Գ": "G",
"Դ": "D",
"Ե": "E",
"Զ": "Z",
"Է": "E'",
"Ը": "Y'",
"Թ": "T'",
"Ժ": "JH",
"Ի": "I",
"Լ": "L",
"Խ": "X",
"Ծ": "C'",
"Կ": "K",
"Հ": "H",
"Ձ": "D'",
"Ղ": "GH",
"Ճ": "TW",
"Մ": "M",
"Յ": "Y",
"Ն": "N",
"Շ": "SH",
"Չ": "CH",
"Պ": "P",
"Ջ": "J",
"Ռ": "R'",
"Ս": "S",
"Վ": "V",
"Տ": "T",
"Ր": "R",
"Ց": "C",
"Փ": "P'",
"Ք": "Q'",
"Օ": "O''",
"Ֆ": "F",
"և": "EV",
"ء": "a",
"آ": "aa",
"أ": "a",
"ؤ": "u",
"إ": "i",
"ئ": "e",
"ا": "a",
"ب": "b",
"ة": "h",
"ت": "t",
"ث": "th",
"ج": "j",
"ح": "h",
"خ": "kh",
"د": "d",
"ذ": "th",
"ر": "r",
"ز": "z",
"س": "s",
"ش": "sh",
"ص": "s",
"ض": "dh",
"ط": "t",
"ظ": "z",
"ع": "a",
"غ": "gh",
"ف": "f",
"ق": "q",
"ك": "k",
"ل": "l",
"م": "m",
"ن": "n",
"ه": "h",
"و": "w",
"ى": "a",
"ي": "y",
"ً": "an",
"ٌ": "on",
"ٍ": "en",
"َ": "a",
"ُ": "u",
"ِ": "e",
"ْ": "",
"٠": "0",
"١": "1",
"٢": "2",
"٣": "3",
"٤": "4",
"٥": "5",
"٦": "6",
"٧": "7",
"٨": "8",
"٩": "9",
"پ": "p",
"چ": "ch",
"ژ": "zh",
"ک": "k",
"گ": "g",
"ی": "y",
"۰": "0",
"۱": "1",
"۲": "2",
"۳": "3",
"۴": "4",
"۵": "5",
"۶": "6",
"۷": "7",
"۸": "8",
"۹": "9",
"฿": "baht",
"ა": "a",
"ბ": "b",
"გ": "g",
"დ": "d",
"ე": "e",
"ვ": "v",
"ზ": "z",
"თ": "t",
"ი": "i",
"კ": "k",
"ლ": "l",
"მ": "m",
"ნ": "n",
"ო": "o",
"პ": "p",
"ჟ": "zh",
"რ": "r",
"ს": "s",
"ტ": "t",
"უ": "u",
"ფ": "f",
"ქ": "k",
"ღ": "gh",
"": "q",
"შ": "sh",
"ჩ": "ch",
"ც": "ts",
"ძ": "dz",
"წ": "ts",
"ჭ": "ch",
"ხ": "kh",
"ჯ": "j",
"ჰ": "h",
"Ṣ": "S",
"ṣ": "s",
"Ẁ": "W",
"ẁ": "w",
"Ẃ": "W",
"ẃ": "w",
"Ẅ": "W",
"ẅ": "w",
"ẞ": "SS",
"Ạ": "A",
"ạ": "a",
"Ả": "A",
"ả": "a",
"Ấ": "A",
"ấ": "a",
"Ầ": "A",
"ầ": "a",
"Ẩ": "A",
"ẩ": "a",
"Ẫ": "A",
"ẫ": "a",
"Ậ": "A",
"ậ": "a",
"Ắ": "A",
"ắ": "a",
"Ằ": "A",
"ằ": "a",
"Ẳ": "A",
"ẳ": "a",
"Ẵ": "A",
"ẵ": "a",
"Ặ": "A",
"ặ": "a",
"Ẹ": "E",
"ẹ": "e",
"Ẻ": "E",
"ẻ": "e",
"Ẽ": "E",
"ẽ": "e",
"Ế": "E",
"ế": "e",
"Ề": "E",
"ề": "e",
"Ể": "E",
"ể": "e",
"Ễ": "E",
"ễ": "e",
"Ệ": "E",
"ệ": "e",
"Ỉ": "I",
"ỉ": "i",
"Ị": "I",
"ị": "i",
"Ọ": "O",
"ọ": "o",
"Ỏ": "O",
"ỏ": "o",
"Ố": "O",
"ố": "o",
"Ồ": "O",
"ồ": "o",
"Ổ": "O",
"ổ": "o",
"Ỗ": "O",
"ỗ": "o",
"Ộ": "O",
"ộ": "o",
"Ớ": "O",
"ớ": "o",
"Ờ": "O",
"ờ": "o",
"Ở": "O",
"ở": "o",
"Ỡ": "O",
"ỡ": "o",
"Ợ": "O",
"ợ": "o",
"Ụ": "U",
"ụ": "u",
"Ủ": "U",
"ủ": "u",
"Ứ": "U",
"ứ": "u",
"Ừ": "U",
"ừ": "u",
"Ử": "U",
"ử": "u",
"Ữ": "U",
"ữ": "u",
"Ự": "U",
"ự": "u",
"Ỳ": "Y",
"ỳ": "y",
"Ỵ": "Y",
"ỵ": "y",
"Ỷ": "Y",
"ỷ": "y",
"Ỹ": "Y",
"ỹ": "y",
"": "-",
"": "'",
"": "'",
"“": "\\\"",
"”": "\\\"",
"„": "\\\"",
"†": "+",
"•": "*",
"…": "...",
"₠": "ecu",
"₢": "cruzeiro",
"₣": "french franc",
"₤": "lira",
"₥": "mill",
"₦": "naira",
"₧": "peseta",
"₨": "rupee",
"₩": "won",
"₪": "new shequel",
"₫": "dong",
"€": "euro",
"₭": "kip",
"₮": "tugrik",
"₯": "drachma",
"₰": "penny",
"₱": "peso",
"₲": "guarani",
"₳": "austral",
"₴": "hryvnia",
"₵": "cedi",
"₸": "kazakhstani tenge",
"₹": "indian rupee",
"₺": "turkish lira",
"₽": "russian ruble",
"₿": "bitcoin",
"℠": "sm",
"™": "tm",
"∂": "d",
"∆": "delta",
"∑": "sum",
"∞": "infinity",
"♥": "love",
"元": "yuan",
"円": "yen",
"﷼": "rial",
"ﻵ": "laa",
"ﻷ": "laa",
"ﻹ": "lai",
"ﻻ": "la"
}

View File

@@ -19,7 +19,5 @@ Add attributes to .box elements (\code{shinydashboard::box})
}
\examples{
x <- shinydashboard::box()
htmlAddBoxAttributes(
x, role = "region", `aria-label` = "This is a special box"
)
htmlAddBoxAttributes(x, role = "region", `aria-label` = "This is a special box")
}

View File

@@ -18,7 +18,9 @@ The modified box
}
\description{
The uri to load can have a replacement marker supplied '\%box\%' which will be
substituded with a sanitized copy of the box title.
substituded with a sanitized copy of the box title. Preference is given to
the slugify package, however if unavailable a warning is generated and the
fallback of URLEncode is used.
}
\examples{
x <- shinydashboard::box(title = "This is a box")

View File

@@ -1,23 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htmlClassManipulation.R
\name{htmlAddClasses}
\alias{htmlAddClasses}
\title{Add classes to an HTML element}
\usage{
htmlAddClasses(el, classes)
}
\arguments{
\item{el}{The element to add the class(es) to}
\item{classes}{The class(es) to be added}
}
\value{
The modified element
}
\description{
Add classes to an HTML element
}
\examples{
x <- shiny::tags$div()
htmlAddClasses(x, "btn-warning")
}

View File

@@ -1,23 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htmlAppendAttributes.R
\name{htmlAppendAttributes}
\alias{htmlAppendAttributes}
\title{Appends attributes to an HTML element}
\usage{
htmlAppendAttributes(el, ...)
}
\arguments{
\item{el}{The element to append the attributes to}
\item{...}{The attribute names to be appended}
}
\value{
The modified element
}
\description{
Appends attributes to an HTML element
}
\examples{
x <- shiny::icon("wrench")
htmlAppendAttributes(x, `role` = "presentation")
}

View File

@@ -1,23 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htmlClassManipulation.R
\name{htmlButtonStyle}
\alias{htmlButtonStyle}
\title{Changes the style of a button from btn-default to another style}
\usage{
htmlButtonStyle(el, style)
}
\arguments{
\item{el}{The button}
\item{style}{The style to change the button on}
}
\value{
The modified element
}
\description{
Changes the style of a button from btn-default to another style
}
\examples{
x <- shiny::tags$div(class = "btn btn-warning")
htmlButtonStyle(x, "warning")
}

View File

@@ -2,8 +2,7 @@
% Please edit documentation in R/htmlBoxManipulation.R
\name{htmlRemoveBoxTitle}
\alias{htmlRemoveBoxTitle}
\title{Removes title from box element (leaving an un-titled box with header if
required)}
\title{Removes title from box element (leaving an un-titled box with header if required)}
\usage{
htmlRemoveBoxTitle(box, removeHeader = FALSE)
}
@@ -16,8 +15,7 @@ htmlRemoveBoxTitle(box, removeHeader = FALSE)
The modified box
}
\description{
Removes title from box element (leaving an un-titled box with header if
required)
Removes title from box element (leaving an un-titled box with header if required)
}
\examples{
x <- shinydashboard::box(title = "TBR")

View File

@@ -1,23 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htmlClassManipulation.R
\name{htmlRemoveClasses}
\alias{htmlRemoveClasses}
\title{Remove classes from an HTML element}
\usage{
htmlRemoveClasses(el, classes)
}
\arguments{
\item{el}{The element to remove the class(es) from}
\item{classes}{The class(es) to be added}
}
\value{
The modified element
}
\description{
Remove classes from an HTML element
}
\examples{
x <- shiny::tags$div(class = "btn btn-warning")
htmlRemoveClasses(x, "btn-warning")
}

View File

@@ -1,33 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htmlSlugify.R
\name{htmlSlugify}
\alias{htmlSlugify}
\title{Native(ish) R slugify}
\usage{
htmlSlugify(x, repl = "-", lower = TRUE)
}
\arguments{
\item{x}{String to slugify}
\item{repl}{What to replace spaces with (default: -)}
\item{lower}{Lower case the output string}
}
\value{
The slugified output string
}
\description{
Native(ish) R slugify
}
\examples{
x <- c(
"A very short example",
"This has a $ symbol",
"user@example.com",
"~~ABC123~~",
"τυχαίος",
"file:///tmp/some/path"
)
htmlSlugify(x)
htmlSlugify(x, "_")
}