play.twirl.api

Members list

Concise view

Type members

Classlikes

trait Appendable[T]

A type that works with BaseScalaTemplate This used to support +=, but no longer is required to.

A type that works with BaseScalaTemplate This used to support +=, but no longer is required to.

Attributes

Todo:

Change name to reflect not appendable

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Html
class Txt
class Xml
case class BaseScalaTemplate[T <: Appendable[T], F <: Format[T]](format: F)

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
abstract class BufferedContent[A <: BufferedContent[A]](val elements: Seq[A], val text: String) extends Appendable[A] with Content

Appendable content using a StringBuilder. Either specify elements or text, not both.

Appendable content using a StringBuilder. Either specify elements or text, not both.

Using an Either[TraversableOnce[A], String] impacts performance in an already contentious part of code, so it has been done with both parameters instead.

Attributes

A

self-type

elements

Sub elements to traverse when creating the resultant string

text

Formatted content

Graph
Supertypes
trait Content
trait Appendable[A]
class Object
trait Matchable
class Any
Known subtypes
class Html
class Txt
class Xml
Self type
A
trait Content

Generic type representing content to be sent over an HTTP response.

Generic type representing content to be sent over an HTTP response.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Html
class Txt
class Xml
trait Format[T <: Appendable[T]]

A template format defines how to properly integrate content for a type T (e.g. to prevent cross-site scripting attacks)

A template format defines how to properly integrate content for a type T (e.g. to prevent cross-site scripting attacks)

Attributes

T

The underlying type that this format applies to.

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object HtmlFormat.type
object JavaScriptFormat.type
object TxtFormat.type
object XmlFormat.type
object Formats

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Formats.type
class Html extends BufferedContent[Html]

Content type used in default HTML templates.

Content type used in default HTML templates.

This has 3 states, either it's a tree of elements, or a leaf, if it's a leaf, it's either safe text, or unsafe text that needs to be escaped when written out.

Attributes

Companion:
object
Graph
Supertypes
trait Content
class Object
trait Matchable
class Any
object Html

Helper for HTML utility methods.

Helper for HTML utility methods.

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Html.type
object HtmlFormat extends Format[Html]

Formatter for HTML content.

Formatter for HTML content.

Attributes

Graph
Supertypes
trait Format[Html]
class Object
trait Matchable
class Any
Self type

Type used in default JavaScript templates.

Type used in default JavaScript templates.

Attributes

Companion:
object
Graph
Supertypes
trait Content
class Object
trait Matchable
class Any
object JavaScript

Helper for JavaScript utility methods.

Helper for JavaScript utility methods.

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Formatter for JavaScript content.

Formatter for JavaScript content.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
object MimeTypes

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
final implicit class StringInterpolation(val sc: StringContext) extends AnyVal

Brings the template engine as a string interpolator.

Brings the template engine as a string interpolator.

Basic usage:

 import play.twirl.api.StringInterpolation

 val name = "Martin"
 val htmlFragment: Html = html"&lt;div&gt;Hello $name&lt;/div&gt;"

Three interpolators are available: html, xml and js.

Attributes

Graph
Supertypes
class AnyVal
trait Matchable
class Any
trait Template0[Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template1[A, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template10[A, B, C, D, E, F, G, H, I, J, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template11[A, B, C, D, E, F, G, H, I, J, K, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template12[A, B, C, D, E, F, G, H, I, J, K, L, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template13[A, B, C, D, E, F, G, H, I, J, K, L, M, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template14[A, B, C, D, E, F, G, H, I, J, K, L, M, N, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template2[A, B, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template3[A, B, C, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template4[A, B, C, D, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template5[A, B, C, D, E, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template6[A, B, C, D, E, F, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template7[A, B, C, D, E, F, G, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template8[A, B, C, D, E, F, G, H, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait Template9[A, B, C, D, E, F, G, H, I, Result]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Imports that provide Twirl language features.

Imports that provide Twirl language features.

This includes:

  • @defining
  • @using
  • iterable/option/string as boolean for if statements
  • default values (maybeFoo ? defaultFoo)

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Imports for useful Twirl helpers.

Imports for useful Twirl helpers.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
class Txt extends BufferedContent[Txt]

Content type used in default text templates.

Content type used in default text templates.

Attributes

Companion:
object
Graph
Supertypes
trait Content
class Object
trait Matchable
class Any
object Txt

Helper for utilities Txt methods.

Helper for utilities Txt methods.

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Txt.type
object TxtFormat extends Format[Txt]

Formatter for text content.

Formatter for text content.

Attributes

Graph
Supertypes
trait Format[Txt]
class Object
trait Matchable
class Any
Self type
class Xml extends BufferedContent[Xml]

Content type used in default XML templates.

Content type used in default XML templates.

Attributes

Companion:
object
Graph
Supertypes
trait Content
class Object
trait Matchable
class Any
object Xml

Helper for XML utility methods.

Helper for XML utility methods.

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Xml.type
object XmlFormat extends Format[Xml]

Formatter for XML content.

Formatter for XML content.

Attributes

Graph
Supertypes
trait Format[Xml]
class Object
trait Matchable
class Any
Self type

Implicits

Implicits

final implicit def StringInterpolation(sc: StringContext): StringInterpolation

Brings the template engine as a string interpolator.

Brings the template engine as a string interpolator.

Basic usage:

 import play.twirl.api.StringInterpolation

 val name = "Martin"
 val htmlFragment: Html = html"&lt;div&gt;Hello $name&lt;/div&gt;"

Three interpolators are available: html, xml and js.

Attributes