as_html.spar: Convert One Spork to Html

View source: R/html.R

as_html.sparR Documentation

Convert One Spork to Html

Description

Converts one spork to html. See description for as_spork. By default, unrecognized tokens are returned literally. However, Greek symbols and html metacharacters are escaped. See htmlToken.

Usage

## S3 method for class 'spar'
as_html(
  x,
  newline = getOption("html_newline", "<br/>"),
  unrecognized = getOption("html_unrecognized", "htmlToken"),
  token_open = getOption("html_token_open", ""),
  token_close = getOption("html_token_close", ""),
  math_open = getOption("html_math_open", ""),
  math_close = getOption("html_math_close", ""),
  label_open = getOption("html_label_open", ""),
  label_close = getOption("html_label_close", ""),
  ...
)

Arguments

x

spar

newline

value to replace '\n'

unrecognized

function to process unrecognized tokens: default htmlToken

token_open, token_close

these wrap text-like portions of the label; the defaults try to give upright characters (non-italic); also passed to htmlToken

math_open, math_close

these wrap math-like portions of the label; the defaults try to give upright characters (non-italic) which may not work for Greek symbols; also passed to htmlToken

label_open, label_close

these wrap the entire label

...

passed to unrecognized; see htmlToken

Details

Experimental support is implemented for the newline character ('\n'). Default behavior is to introduce linebreaks (<br/>) into the resulting html.

Value

html

See Also

Other interface: as.expression.plotmath(), as_html.spork(), as_latex.default(), as_latex.spar(), as_latex.spork(), as_plotmath.spar(), as_plotmath.spork(), as_previews.spork(), as_spork.character(), htmlToken(), latexToken(), plotmathToken()

Other html: [.html(), [[.html(), as_html.spork(), as_html(), htmlToken()

Examples

library(magrittr)
'V_c./F' %>% as_spork %>% as_html
'AUC_ss' %>% as_spork %>% as_html
'C_max_ss' %>% as_spork %>% as_html
'var^eta_j' %>% as_spork %>% as_html
'& < % $ # \\_ { } ~ \\^ \\' %>% as_spork %>% as_html
'one joule (Omega) ~ 1 kg*m^2./s^2' %>% as_spork %>% as_html

spork documentation built on Sept. 16, 2023, 9:06 a.m.

Related to as_html.spar in spork...