Skip to content

Commit

Permalink
Add tagQuery(tags) for complex css selections and alterations (#208)
Browse files Browse the repository at this point in the history
Co-authored-by: Barret Schloerke <[email protected]>
Co-authored-by: Winston Chang <[email protected]>
Co-authored-by: Carson Sievert <[email protected]>
  • Loading branch information
4 people authored Apr 15, 2021
1 parent 9abc3f2 commit 838b560
Show file tree
Hide file tree
Showing 11 changed files with 3,342 additions and 45 deletions.
10 changes: 8 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Version: 0.5.1.9000
Authors@R: c(
person("Joe", "Cheng", role = "aut", email = "[email protected]"),
person("Carson", "Sievert", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0002-4958-2844")),
person("Winston", "Chang", role = "aut", email = "[email protected]"),
person("Barret", "Schloerke", role = "aut", email = "[email protected]", comment = c(ORCID = "0000-0001-9986-114X")),
person("Winston", "Chang", role = "aut", email = "[email protected]", comment = c(ORCID = "0000-0002-1576-2126")),
person("Yihui", "Xie", role = "aut", email = "[email protected]"),
person("Jeff", "Allen", role = "aut", email = "[email protected]"),
person(family = "RStudio", role = "cph")
Expand All @@ -18,14 +19,17 @@ Imports:
digest,
grDevices,
base64enc,
rlang
rlang,
fastmap
Suggests:
markdown,
testthat,
withr,
Cairo,
ragg,
shiny
Remotes:
r-lib/rlang
Enhances: knitr
License: GPL (>= 2)
URL: https://github.com/rstudio/htmltools
Expand All @@ -39,7 +43,9 @@ Collate:
'html_print.R'
'images.R'
'known_tags.R'
'selector.R'
'shim.R'
'tag_query.R'
'utils.R'
'tags.R'
'template.R'
17 changes: 17 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
# Generated by roxygen2: do not edit by hand

S3method(as.character,html)
S3method(as.character,htmltools.tag.env)
S3method(as.character,htmltools.tag.query)
S3method(as.character,shiny.tag)
S3method(as.character,shiny.tag.list)
S3method(as.tags,character)
S3method(as.tags,default)
S3method(as.tags,html)
S3method(as.tags,html_dependency)
S3method(as.tags,htmltools.tag.env)
S3method(as.tags,htmltools.tag.query)
S3method(as.tags,list)
S3method(as.tags,shiny.tag)
S3method(as.tags,shiny.tag.function)
S3method(as.tags,shiny.tag.list)
S3method(format,html)
S3method(format,htmltools.selector)
S3method(format,htmltools.selector.list)
S3method(format,htmltools.tag.env)
S3method(format,htmltools.tag.query)
S3method(format,shiny.tag)
S3method(format,shiny.tag.list)
S3method(print,html)
S3method(print,html_dependency)
S3method(print,htmltools.selector)
S3method(print,htmltools.selector.list)
S3method(print,htmltools.tag.env)
S3method(print,htmltools.tag.query)
S3method(print,shiny.tag)
S3method(print,shiny.tag.list)
S3method(str,htmltools.tag.env)
export("htmlDependencies<-")
export(HTML)
export(a)
Expand Down Expand Up @@ -84,6 +97,7 @@ export(tagFunction)
export(tagGetAttribute)
export(tagHasAttribute)
export(tagList)
export(tagQuery)
export(tagSetChildren)
export(tags)
export(takeSingletons)
Expand All @@ -93,4 +107,7 @@ export(withTags)
import(digest)
import(rlang)
import(utils)
importFrom(fastmap,fastmap)
importFrom(fastmap,faststack)
importFrom(rlang,sexp_address)
useDynLib(htmltools, .registration = TRUE)
51 changes: 25 additions & 26 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
htmltools 0.5.1.9000
--------------------------------------------------------------------------------
# htmltools (development version)

## New Features & Improvements

* Added `tagQuery(tags)`. A tag query object implements many popular features of jQuery. Similar to jQuery, tag query objects can find internal html using CSS selections. Given a selection (which defaults to the original `tags`), many alterations may be performed before converting the tag query object back to tag objects. (#208)

## Bug Fixes

* Closed #197: Fixed rendering of boolean attributes in <script> tags rendered via renderDependencies() (#197, thanks @atusy).

htmltools 0.5.1.1
--------------------------------------------------------------------------------

# htmltools 0.5.1.1

* Added shiny as a suggested package.


htmltools 0.5.1
--------------------------------------------------------------------------------
# htmltools 0.5.1

## New Features & Improvements

Expand All @@ -35,8 +39,7 @@ htmltools 0.5.1
* `print(as.tags(x))` no longer results in error when `x` is a generic `list()` of tag-like objects. (#181)


htmltools 0.5.0
--------------------------------------------------------------------------------
# htmltools 0.5.0

* `tags` is now generated by a script which collects all
[HTML](https://developer.mozilla.org/en-US/docs/Web/HTML/Element) and
Expand Down Expand Up @@ -74,8 +77,8 @@ htmltools 0.5.0
* The `.noWS` parameter for suppressing whitespace can now take an `"inside"`
value (equivalent to `c("after-start", "before-end")`). (#163)

htmltools 0.4.0
--------------------------------------------------------------------------------

# htmltools 0.4.0

* Fixed #128: Added support for trailing commas in tagLists and the predefined
tags. (#135)
Expand Down Expand Up @@ -110,8 +113,9 @@ htmltools 0.4.0
* Stopped extra carriage returns from being inserted by `save_html` on Windows.
(#137)

htmltools 0.3.6
--------------------------------------------------------------------------------


# htmltools 0.3.6

* `validateCssUnit()` now accepts viewport units (vw, vh, vmin, vmax). (#56)

Expand All @@ -123,8 +127,8 @@ htmltools 0.3.6
* Fixed #69: On Windows, `renderDocument()` did not mark output as UTF-8 if the
head was UTF-8 but body was ASCII. (#71)

htmltools 0.3.5
--------------------------------------------------------------------------------

# htmltools 0.3.5

* `as.character` now returns a character vector with no other attributes.
Previously it returned a character vector of class 'html'. (#31, #41)
Expand Down Expand Up @@ -152,17 +156,16 @@ htmltools 0.3.5
* Performance improvement rendering tags, by switching from `readLines` to
`readChar`.

htmltools 0.3
--------------------------------------------------------------------------------

# htmltools 0.3

* Add `css` function for conveniently forming CSS declaration strings.

* Add template support, with the `htmlTemplate()`, `renderDocument()`, and
`suppressDependencies()` functions.


htmltools 0.2.9
--------------------------------------------------------------------------------
# htmltools 0.2.9

* Add check that `htmlDependency()` isn't called with an absolute path when a
binary package is built. (#22)
Expand All @@ -173,30 +176,26 @@ htmltools 0.2.9
* Add `tagGetAttribute()` and `tagHasAttribute()` functions.


htmltools 0.2.7
--------------------------------------------------------------------------------
# htmltools 0.2.7

* Add "append" parameter to attachDependencies, to allow adding dependencies,
instead of replacing them.


htmltools 0.2.6
--------------------------------------------------------------------------------
# htmltools 0.2.6

* Add "attachment" parameter to htmlDependency, which can be used to allow any
file in the dependency directory to be available via URL at runtime.


htmltools 0.2.5
--------------------------------------------------------------------------------
# htmltools 0.2.5

* Explicit library(htmltools) is no longer required for tags to be rendered in
knitr/rmarkdown documents.

* Added "viewer" parameter to html_print.


htmltools 0.2.4
--------------------------------------------------------------------------------
# htmltools 0.2.4

Initial release
Loading

0 comments on commit 838b560

Please sign in to comment.