Skip to content

Commit

Permalink
Restore HTML generating functions
Browse files Browse the repository at this point in the history
These functions were temporarily ripped out of Shiny and moved
to the htmltools package. We've discovered that it's safe to
keep including them in shiny; as long as the functions in shiny
and the functions in htmltools are identical, the user won't
receive a conflict warning.
  • Loading branch information
jcheng5 committed May 31, 2014
1 parent 01c8167 commit dde2667
Show file tree
Hide file tree
Showing 119 changed files with 601 additions and 113 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
^man-roxygen$
^\.travis\.yml$
^staticdocs$
^tools$
10 changes: 6 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@ Description: Shiny makes it incredibly easy to build interactive web
License: GPL-3
Depends:
R (>= 2.14.1),
methods,
htmltools (>= 0.2.4)
methods
Imports:
tools,
utils,
httpuv (>= 1.2.0),
caTools,
RJSONIO,
xtable,
digest
digest,
htmltools (>= 0.2.4)
Suggests:
datasets,
Cairo (>= 1.5-5),
testthat,
knitr
knitr (>= 1.6),
markdown
URL: http://www.rstudio.com/shiny/
BugReports: https://github.com/rstudio/shiny/issues
Roxygen: list(wrap = FALSE)
Expand All @@ -42,6 +43,7 @@ Collate:
'graph.R'
'hooks.R'
'html-deps.R'
'htmltools.R'
'imageutils.R'
'jqueryui.R'
'middleware-shiny.R'
Expand Down
36 changes: 35 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by roxygen2 (4.0.0): do not edit by hand
# Generated by roxygen2 (4.0.1): do not edit by hand

S3method("$",reactivevalues)
S3method("$",shinyoutput)
Expand All @@ -22,6 +22,8 @@ S3method(names,reactivevalues)
S3method(print,reactive)
S3method(print,shiny.appobj)
S3method(str,reactivevalues)
export(HTML)
export(a)
export(absolutePanel)
export(actionButton)
export(actionLink)
Expand All @@ -30,16 +32,20 @@ export(animationOptions)
export(as.shiny.appobj)
export(basicPage)
export(bootstrapPage)
export(br)
export(checkboxGroupInput)
export(checkboxInput)
export(code)
export(column)
export(conditionalPanel)
export(dataTableOutput)
export(dateInput)
export(dateRangeInput)
export(div)
export(downloadButton)
export(downloadHandler)
export(downloadLink)
export(em)
export(exprToFunction)
export(fileInput)
export(fixedPage)
Expand All @@ -49,16 +55,30 @@ export(flowLayout)
export(fluidPage)
export(fluidRow)
export(getDefaultReactiveDomain)
export(h1)
export(h2)
export(h3)
export(h4)
export(h5)
export(h6)
export(headerPanel)
export(helpText)
export(hr)
export(htmlOutput)
export(icon)
export(imageOutput)
export(img)
export(includeCSS)
export(includeHTML)
export(includeMarkdown)
export(includeScript)
export(includeText)
export(inputPanel)
export(installExprFunction)
export(invalidateLater)
export(is.reactive)
export(is.reactivevalues)
export(is.singleton)
export(isolate)
export(knit_print.shiny.appobj)
export(knit_print.shiny.render.function)
Expand All @@ -74,10 +94,12 @@ export(numericInput)
export(observe)
export(onReactiveDomainEnded)
export(outputOptions)
export(p)
export(pageWithSidebar)
export(parseQueryString)
export(plotOutput)
export(plotPNG)
export(pre)
export(radioButtons)
export(reactive)
export(reactiveFileReader)
Expand Down Expand Up @@ -114,13 +136,23 @@ export(shinyUI)
export(showReactLog)
export(sidebarLayout)
export(sidebarPanel)
export(singleton)
export(sliderInput)
export(span)
export(splitLayout)
export(stopApp)
export(strong)
export(submitButton)
export(tabPanel)
export(tableOutput)
export(tabsetPanel)
export(tag)
export(tagAppendAttributes)
export(tagAppendChild)
export(tagAppendChildren)
export(tagList)
export(tagSetChildren)
export(tags)
export(textInput)
export(textOutput)
export(titlePanel)
Expand All @@ -137,11 +169,13 @@ export(updateSliderInput)
export(updateTabsetPanel)
export(updateTextInput)
export(validate)
export(validateCssUnit)
export(verbatimTextOutput)
export(verticalLayout)
export(wellPanel)
export(withMathJax)
export(withReactiveDomain)
export(withTags)
import(RJSONIO)
import(caTools)
import(digest)
Expand Down
101 changes: 101 additions & 0 deletions R/htmltools.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#' @export
a <- htmltools::a

#' @export
br <- htmltools::br

#' @export
code <- htmltools::code

#' @export
div <- htmltools::div

#' @export
em <- htmltools::em

#' @export
h1 <- htmltools::h1

#' @export
h2 <- htmltools::h2

#' @export
h3 <- htmltools::h3

#' @export
h4 <- htmltools::h4

#' @export
h5 <- htmltools::h5

#' @export
h6 <- htmltools::h6

#' @export
hr <- htmltools::hr

#' @export
HTML <- htmltools::HTML

#' @export
img <- htmltools::img

#' @export
includeCSS <- htmltools::includeCSS

#' @export
includeHTML <- htmltools::includeHTML

#' @export
includeMarkdown <- htmltools::includeMarkdown

#' @export
includeScript <- htmltools::includeScript

#' @export
includeText <- htmltools::includeText

#' @export
is.singleton <- htmltools::is.singleton

#' @export
p <- htmltools::p

#' @export
pre <- htmltools::pre

#' @export
singleton <- htmltools::singleton

#' @export
span <- htmltools::span

#' @export
strong <- htmltools::strong

#' @export
tag <- htmltools::tag

#' @export
tagAppendAttributes <- htmltools::tagAppendAttributes

#' @export
tagAppendChild <- htmltools::tagAppendChild

#' @export
tagAppendChildren <- htmltools::tagAppendChildren

#' @export
tagList <- htmltools::tagList

#' @export
tags <- htmltools::tags

#' @export
tagSetChildren <- htmltools::tagSetChildren

#' @export
validateCssUnit <- htmltools::validateCssUnit

#' @export
withTags <- htmltools::withTags
2 changes: 1 addition & 1 deletion R/shinywrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ useRenderFunction <- function(renderFunc) {
return(outputFunction(id))
}

#' @export
#' @S3method as.tags shiny.render.function
as.tags.shiny.render.function <- function(x, ...) {
useRenderFunction(x)
}
Expand Down
15 changes: 13 additions & 2 deletions inst/staticdocs/index.r
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ sd_section("UI Outputs",
"downloadButton"
)
)
sd_section("Interface builder functions",
"A sub-library for writing HTML using R functions. These functions form the foundation on which the higher level user interface functions are built, and can also be used in your Shiny UI to provide custom HTML, CSS, and JavaScript.",
c(
"builder",
"HTML",
"include",
"singleton",
"tag",
"validateCssUnit",
"withTags"
)
)
sd_section("Rendering functions",
"Functions that you use in your application's server side code, assigning them to outputs that appear in your user interface.",
c(
Expand Down Expand Up @@ -147,7 +159,6 @@ sd_section("Embedding",
"Functions that are intended for third-party packages that embed Shiny applications.",
c(
"shinyApp",
"maskReactiveContext",
"knitr_methods"
"maskReactiveContext"
)
)
2 changes: 1 addition & 1 deletion inst/tests/test-staticdocs.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test_that("All man pages have an entry in staticdocs/index.r", {
return()
}
# Known not to be indexed
known_unindexed <- c("shiny-package")
known_unindexed <- c("shiny-package", "knitr_methods")

indexed_topics <- local({
result <- character(0)
Expand Down
24 changes: 24 additions & 0 deletions man/HTML.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
\name{HTML}
\alias{HTML}
\title{Mark Characters as HTML}
\usage{
HTML(text, ...)
}
\arguments{
\item{text}{The text value to mark with HTML}

\item{...}{Any additional values to be converted to character and
concatenated together}
}
\value{
The same value, but marked as HTML.
}
\description{
Marks the given text as HTML, which means the \link{tag} functions will know
not to perform HTML escaping on it.
}
\examples{
el <- div(HTML("I like <u>turtles</u>"))
cat(as.character(el))
}

2 changes: 1 addition & 1 deletion man/absolutePanel.Rd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
% Generated by roxygen2 (4.0.0): do not edit by hand
% Generated by roxygen2 (4.0.1): do not edit by hand
\name{absolutePanel}
\alias{absolutePanel}
\alias{fixedPanel}
Expand Down
2 changes: 1 addition & 1 deletion man/actionButton.Rd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
% Generated by roxygen2 (4.0.0): do not edit by hand
% Generated by roxygen2 (4.0.1): do not edit by hand
\name{actionButton}
\alias{actionButton}
\alias{actionLink}
Expand Down
2 changes: 1 addition & 1 deletion man/addResourcePath.Rd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
% Generated by roxygen2 (4.0.0): do not edit by hand
% Generated by roxygen2 (4.0.1): do not edit by hand
\name{addResourcePath}
\alias{addResourcePath}
\title{Resource Publishing}
Expand Down
2 changes: 1 addition & 1 deletion man/bootstrapPage.Rd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
% Generated by roxygen2 (4.0.0): do not edit by hand
% Generated by roxygen2 (4.0.1): do not edit by hand
\name{bootstrapPage}
\alias{basicPage}
\alias{bootstrapPage}
Expand Down
Loading

0 comments on commit dde2667

Please sign in to comment.