| Title: | Turn HTML 'Shiny' |
|---|---|
| Description: | Contains functions for converting existing HTML/JavaScript source into equivalent 'shiny' functions. Bootstraps the process of making new 'shiny' functions by allowing us to turn HTML snippets directly into R functions. |
| Authors: | Nicholas Jhirad |
| Maintainer: | Nicholas Jhirad <[email protected]> |
| License: | GPL-3 |
| Version: | 1.1.0 |
| Built: | 2026-06-01 08:36:04 UTC |
| Source: | https://github.com/shapenaji/midas |
Uses xml2 to parse html text into a list
html_to_list(x)html_to_list(x)
x |
string of html |
html as an R list
# create some test data html <- '<div class="example"><h3>test</h3></div>' html_to_list(html)# create some test data html <- '<div class="example"><h3>test</h3></div>' html_to_list(html)
turns an xml2 list into a shiny function call
midas_touch(root)midas_touch(root)
root |
an html list (from xml2 as_list). Note: If the list is particularly deep, you may need to set option(expressions = SOMETHING BIG) |
a function call that produces the equivalent shiny objects
Turns a string of html into the equivalent shiny code
turn_shiny(html, remove_newlines = TRUE, file = NULL)turn_shiny(html, remove_newlines = TRUE, file = NULL)
html |
a string of complete html |
remove_newlines |
whether or not to remove newlines from the string |
file |
default (NULL) is to return the object, if this is set it will write to file |
a function call that produces the equivalent shiny objects
html <- '<div class="example"><h3>test</h3></div>' turn_shiny(html) eval(turn_shiny(html))html <- '<div class="example"><h3>test</h3></div>' turn_shiny(html) eval(turn_shiny(html))