Packages

p

lol

html

package html

HTML templating.

val items: List[Item] = ???
val content: Html = tmpl"""
  <­h1>Items<­/h1>
  @if(items.isEmpty) {
    <­em>No results<­/em>
  }
  else {
    <­ul>
       @items.map { item =>
         <li>@item.name</li>
       }

  }
"""

Html values can also be easily created from the html interpolation. Conversion from Scala values is done via the ToHtml type class.

val content: Html = html"""Hello $${name}!"""

They will be encoded as lol.http.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

    An HTML document.

  2. implicit class HtmlInterpolation extends AnyRef

    The html interpolation allows to create Html values from plain string.

  3. implicit class SeqHtmlExtensions extends AnyRef

    Extension methods for Seq[Html].

  4. implicit class SeqHtmlExtensions0[A] extends AnyRef

    Extension methods for Seq[_].

  5. implicit class TemplateInterpolation extends AnyRef

    The tmpl interpolation allows to create Html values from a string template.

    The tmpl interpolation allows to create Html values from a string template.

    The template syntax is almost the same as Twirl (https://www.playframework.com/documentation/2.6.x/ScalaTemplates). It is often more convenient that using imbricated string interpolation.

  6. trait ToHtml[-A] extends AnyRef

    A type class to provide Html rendering.

Value Members

  1. implicit def toHtml[A](value: A)(implicit arg0: ToHtml[A]): Html

    Convert a value to Html using the right ToHtml type class instance.

    Convert a value to Html using the right ToHtml type class instance.

    If using the provided type class instances, values are encoded this way.:

    • String values are safely HTML escaped to avoid XSS issues with generated documents.
    • scala.Option can be directly inserted. Some values content is included, while
    • None produces an empty string.
    • scala.Unit produces an empty string.
    • scala.Seq outputs every item without any separator.
  2. object Html extends Serializable

    Provides the ContentEncoder for HTML documents.

  3. object ToHtml

    Default instances for the ToHtml type class.

Inherited from AnyRef

Inherited from Any

Ungrouped