package html
HTML templating.
val items: List[Item] = ??? val content: Html = html""" <h1>Items</h1> ${if(items.isEmpty) { html"<em>No results</em>" } else { html""" <ul> ${items.map { item => html"<li>${item.name}</li>" }} </ul> """ }} """
Html values can be easily created from the html interpolation. They will be encoded as Content thanks to Html.encoder.
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- html
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- All
Type Members
-
case class
Html
(content: String) extends Product with Serializable
An HTML document.
-
implicit
class
HtmlInterpolation
extends AnyRef
The
html
interpolation allows to create Html values from plain string.The
html
interpolation allows to create Html values from plain string. It is very close to the standards
interpolation with a few differences:- Every bit of text dynamically injected is safely HTML escaped to avoid XSS issues with generated documents.
- Including another Html value disables this escaping. The raw html text is then included as is.
- scala.Option can be directly inserted.
Some
values content is included, whileNone
produces an empty string. - scala.Unit produces an empty string.
- scala.TraversableOnce outputs every item without any separator.