Package 'midas'

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: 2024-11-09 02:51:41 UTC
Source: https://github.com/shapenaji/midas

Help Index


Uses xml2 to parse html text into a list

Description

Uses xml2 to parse html text into a list

Usage

html_to_list(x)

Arguments

x

string of html

Value

html as an R list

Examples

# 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

Description

turns an xml2 list into a shiny function call

Usage

midas_touch(root)

Arguments

root

an html list (from xml2 as_list). Note: If the list is particularly deep, you may need to set option(expressions = SOMETHING BIG)

Value

a function call that produces the equivalent shiny objects


Turns a string of html into the equivalent shiny code

Description

Turns a string of html into the equivalent shiny code

Usage

turn_shiny(html, remove_newlines = TRUE, file = NULL)

Arguments

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

Value

a function call that produces the equivalent shiny objects

Examples

html <- '<div class="example"><h3>test</h3></div>'
turn_shiny(html)
eval(turn_shiny(html))