File: htmlTable_helpers_escapeHtml.R

package info (click to toggle)
r-cran-htmltable 2.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,600 kB
  • sloc: javascript: 6,797; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 532 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#' Remove html entities from table
#'
#' Removes the htmlEntities from table input data. Note that
#' this also replaces $ signs in order to remove the MathJax
#' issue.
#'
#' @importFrom htmltools htmlEscape
#'
#' @inheritParams htmlTable
#' @return `x` without the html entities
#' @family hidden helper functions for htmlTable
prEscapeHtml <- function(x) {
  attributes_x <- attributes(x)
  x <- lapply(x, htmlEscape)
  x <- lapply(x, function(x) str_replace_all(x, "\\$", "&#36;"))
  attributes(x) <- attributes_x
  return(x)
}