-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
Type: Feature RequestIdentifies requests for new features or enhancements. These involve proposing new improvements.Identifies requests for new features or enhancements. These involve proposing new improvements.grelThe default expression language, GREL, could be improved in many ways!The default expression language, GREL, could be improved in many ways!
Milestone
Description
Data does not only exist in HTML or XML TextNode's but also in <script> and <style> nodes.
Useful JSON data is also sometimes contained in <script type="application/json"> as well as JSON-LD data in <script type="application/ld+json">
Jsoup provides a different method data() for working with Elements that are a DataNode for handling the contents of style, script tags etc, where contents of those tags do not show with TextNode's text() - our GREL htmlText()
Proposed solution
- Add support for jsoup's
data()functionality for Element's as defined at https://jsoup.org/apidocs/org/jsoup/nodes/Element.html#data() data()will operate similarly to our existinghtmlText()for TextNode's but instead work with DataNodes
Alternatives considered
Manually parsing based on root element and splitting the entire document as a single string
Additional context
- Example tests of
data()are here. :containsData()is already available currently from within our GRELselect()function.parseJson()should be immediately applicable to parse the JSON data string.
Ex.value.parseHtml().select("script")[2].data().parseJson().sitecore.context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type: Feature RequestIdentifies requests for new features or enhancements. These involve proposing new improvements.Identifies requests for new features or enhancements. These involve proposing new improvements.grelThe default expression language, GREL, could be improved in many ways!The default expression language, GREL, could be improved in many ways!