|
|
|
|
|
|
|
|
if (!render) return(res) |
|
|
if (!render) return(res) |
|
|
head <- c( |
|
|
head <- c( |
|
|
"---", "pagetitle: View Regex", "---", |
|
|
"---", "pagetitle: View Regex", "---", |
|
|
"<h5>Regex</h5>", |
|
|
|
|
|
|
|
|
"<h5>Pattern</h5>", |
|
|
"<p><pre>", wrap_regex(pattern, escape, exact), "</pre></p>", |
|
|
"<p><pre>", wrap_regex(pattern, escape, exact), "</pre></p>", |
|
|
"<h5>Results</h5>" |
|
|
|
|
|
|
|
|
"<h5>Matches</h5>" |
|
|
) |
|
|
) |
|
|
res <- c(head, res) |
|
|
res <- c(head, res) |
|
|
tmp <- tempfile(fileext = ".Rmd") |
|
|
tmp <- tempfile(fileext = ".Rmd") |
|
|
|
|
|
|
|
|
tmp_html <- suppressWarnings( |
|
|
tmp_html <- suppressWarnings( |
|
|
rmarkdown::render( |
|
|
rmarkdown::render( |
|
|
tmp, |
|
|
tmp, |
|
|
output_format = rmarkdown::html_document(css = c(system.file("styles", 'style.css', package='regexplain'), |
|
|
|
|
|
system.file("styles", 'skeleton.css', package='regexplain')), |
|
|
|
|
|
|
|
|
output_format = rmarkdown::html_document(css = c(system.file("styles", 'skeleton.css', package='regexplain'), |
|
|
|
|
|
system.file("styles", 'style.css', package='regexplain')), |
|
|
theme = NULL), |
|
|
theme = NULL), |
|
|
quiet = TRUE |
|
|
quiet = TRUE |
|
|
)) |
|
|
)) |