It’s really useful to look at the generated Scala code for a simple Twirl template (Twirl - a playback template engine) called index.scala.html:
@()
<h1>Hello, world</h1>
Play Scala target/scala-2.11/twirl/main/views/html/index.template.scala , , ( ), :
package views.html
import play.twirl.api._
object index_Scope0 {
import models._
import controllers._
import play.api.i18n._
import views.html._
import play.api.templates.PlayMagic._
import play.api.mvc._
import play.api.data._
class index
extends BaseScalaTemplate[play.twirl.api.HtmlFormat.Appendable, Format[play.twirl.api.HtmlFormat.Appendable]](play.twirl.api.HtmlFormat)
with play.twirl.api.Template0[play.twirl.api.HtmlFormat.Appendable] {
def apply(): play.twirl.api.HtmlFormat.Appendable = {
_display_ {
{
Seq[Any](format.raw(""""""), format.raw("""<h1>hello, world</h1>"""))
}
}
}
def render(): play.twirl.api.HtmlFormat.Appendable = apply()
def f: (() => play.twirl.api.HtmlFormat.Appendable) = () => apply()
def ref: this.type = this
}
}
object index extends index_Scope0.index
, views.html.index - , views.html.index.type, , , . , , views.html.index_Scope0.index, apply(), Html (, HtmlFormat.Appendable, .)
"" Scala, Scala ( "de-sugars" ), apply() ( case new.) , parens, Html, Twirl. , , Play , HTTP.