Package

lol

html

Permalink

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
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. html
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. case class Html(content: String) extends Product with Serializable

    Permalink

    An HTML document.

  2. implicit class HtmlInterpolation extends AnyRef

    Permalink

    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 standard s 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, while None produces an empty string.
    • scala.Unit produces an empty string.
    • scala.TraversableOnce outputs every item without any separator.

Value Members

  1. object Html extends Serializable

    Permalink

    Provides the ContentEncoder for HTML documents.

Inherited from AnyRef

Inherited from Any

Ungrouped