<commit_before>!!! XML
!!!
- attributes("layout") = ""
- response.setContentType("text/html")
html(lang="en-US" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml")
  head
    meta(content="Scalate, see scalate.fusesource.org" name="generator")
    title Scalate, the Scala Template Engine
    meta(content="text/html; charset=us-ascii" http-equiv="Content-Type")
    meta(content="Copyright © 2011, <NAME>" name="copyright")
    meta(content="5" name="duration")
    meta(content="-2" name="font-size-adjustment")
    link(type="text/css" href="styles/slidy.css" rel="stylesheet")
    link(type="text/css" href="styles/w3c-red.css" rel="stylesheet")
    link(href={uri("/css/pygmentize.css")} rel="stylesheet" type="text/css")
    script(space="preserve" type="text/javascript" charset="utf-8" src="scripts/slidy.js") 
  body
    .background
      img#head-icon(name="head-icon" src="images/scalate/project-icon-32x32.png" alt="")
    .background.slanty
    .slide
      h1 Scalate: the Scala Template Engine
      img(alt="Scalate" src="images/scalate/project-logo.png")
      br(clear="all")
      p
        a(shape="rect" href="http://macstrac.blogspot.com/") <NAME>
        br(clear="none")
        a(shape="rect" href="http://fusesource.com/") FuseSource
        br(clear="none")
        a(shape="rect" href="http://twitter.com/#!/jstrachan") @jstrachan
        br(clear="none")
        a(shape="rect" href="mailto:<EMAIL>") <EMAIL>
    .slide
      :markdown
        # Your presenter: <NAME>

        * <NAME>
          * twitter: @jstrachan
          * blog: [http://macstrac.blogspot.com/](http://macstrac.blogspot.com/)
        * Software Fellow at [FuseSource](http://fusesource.com)
        * long term Open Source contributor
          * created Apache Camel
          * created the Groovy programming language
          * co-founder of 
              * Apache ActiveMQ, Camel, ServiceMix, Fabric, ...
              * Scalate
    
    .slide
      :markdown
        # Scalate Overview
        
        ![Scalate](images/scalate/project-logo.png)

        * its a **Scala** based **T**emplate **E**ngine
          * Scala T E => **Scalate*

    .slide
      :markdown
        # Design Goals

        ![Scalate](images/scalate/project-logo.png)
        
        * make an awesome template engine 
          * framework & container agnostic
        * support different template flavours under same API
          * there isn't really a one size fits all
        * reuse the power & type safety of Scala
          * catch errors in templates at edit/build time
              * templates are for life, not just for Christmas!
          * IDE friendly for smart completion

    .slide
      :markdown
        # Features

        * Templates are compiled & cached as fast Scala objects
        * Template objects are statically typed to catch typos
          * apart from Mustache
        * Scalate is equivalent to the combination of JSP, JSTL, JSP EL
                & SiteMesh/Tiles
          * Scala replaces JSP EL and Scala functions replace JSP
                    custom tags
          * Scalate template languages are richer, more powerful &
                    usually more DRY than JSP + JSTL
          * Scalate has in built layout support replacing
                    SiteMesh/Titles
              

    .slide
      :markdown
        # How Scalate works

        * TemplateEngine is used to load Templates
          * typically templates are converted into scala code and
                    compiled to avoid runtime parsing
          * can customize various things...
              * caching & reloading
              * how URIs are resolved (classpath, file system etc)
              * internationalisation
        * RenderContext is used to render a template
          * has a Map[String,Any] like set of attributes for
                    passing/sharing state
          * loads of helper methods for use inside the template
              * localisation, including other templates, views,
                        layouts etc
        * template languages implemented using Scala parser generators

    .slide
      :markdown
        # Scalate Template Languages

        * SSP
        * Scaml
        * Jade
        * Mustache
        * Scuery

    .slide
      :markdown
        # SSP

        * SSP or _Scala Server Pages_
          * like a non-sucky JSP :)
        * easiest template engine to start with if folks know
          * ASP, JSP, GSP, Erb, Velocity, FreeMarker style templates
        * supports JSP / Erb style syntax 
          * <% statements %>
          * <%= expression %>
          * ${expression}
        * examples:
          * Dear ${people.map(_.name).mkString(", ")} how are you?

    .slide
      :markdown
        # SSP also supports Velocity style tokens

      :pygmentize
        -----------------------------
        ssp: example
        -----------------------------
        #if (lineItems.find(_.price > 10).isDefined)
          <b>Welcome big spender!</b>
        #end

    .slide
      :markdown
        # Scaml

        * Scaml is a Scala port of HAML
        * HAML started in the Rails world and became a very popular
                  alternative to Erb templates
        * whitespace sensitive (which is handy for markup, avoids
                  badly nested markup)
        * syntax
            * %foo to indicate <foo>...</foo>
            * \- for statements
            * = expressions

    .slide
      :markdown
        # Jade

        * Jade out in JavaScript / Rails worlds as a simpler more DRY
                version of HAML / Scaml 
          * avoid the % to indicate element name
              * folks tend to use lots of elements; few are
                        multi-line text content
          * use | to indicate text content inside an element when
                    multiple lines required
          * Implemented as just a slightly different surface parser
                    on Scaml
        * Jade + markdown are the hotness!

    .slide
      :markdown
        # Mustache

        * no logic in the scripts 
        * can be used from JavaScript on the client side or Scala /
                Scalate on the server side
        * uses {{foo}} mustaches for values
        * use {{#foo}} and {{/foo}} for blocks/loops/conditionals
        * good if you want your designer to own the templates
          * though dynamically typed

    .slide
      :markdown
        # Scuery

        * more of a HTML/XHTML transformation engine really
        * uses CSS3 parser & transformation engine
        * templates are regular HTML pages (possibly with mock data)
                owned by your designer
        * use the transform API (jQuery-ish) to transform the HTML to
                inject/replace with dynamic data

    .slide
      :markdown
        # Tips on picking a template language

        * If you want your designers to own your templates
          * consider **mustache** or **scuery**<commit_msg>added all the various included example templates using the new pygmentizeUri() helper function (which is automatically imported with the pygmetnize plugin)<commit_after>!!! XML
!!!
- attributes("layout") = ""
- response.setContentType("text/html")
html(lang="en-US" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml")
  head
    meta(content="Scalate, see scalate.fusesource.org" name="generator")
    title Scalate, the Scala Template Engine
    meta(content="text/html; charset=us-ascii" http-equiv="Content-Type")
    meta(content="Copyright © 2011, <NAME>" name="copyright")
    meta(content="5" name="duration")
    meta(content="-2" name="font-size-adjustment")
    link(type="text/css" href="styles/slidy.css" rel="stylesheet")
    link(type="text/css" href="styles/w3c-red.css" rel="stylesheet")
    link(href={uri("/css/pygmentize.css")} rel="stylesheet" type="text/css")
    script(space="preserve" type="text/javascript" charset="utf-8" src="scripts/slidy.js") 
  body
    .background
      img#head-icon(name="head-icon" src="images/scalate/project-icon-32x32.png" alt="")
    .background.slanty
    .slide
      h1 Scalate: the Scala Template Engine
      img(alt="Scalate" src="images/scalate/project-logo.png")
      br(clear="all")
      p
        a(shape="rect" href="http://macstrac.blogspot.com/") <NAME>
        br(clear="none")
        a(shape="rect" href="http://fusesource.com/") FuseSource
        br(clear="none")
        a(shape="rect" href="http://twitter.com/#!/jstrachan") @jstrachan
        br(clear="none")
        a(shape="rect" href="mailto:<EMAIL>") <EMAIL>
    .slide
      :markdown
        # Your presenter: <NAME>

        * <NAME>
          * twitter: @jstrachan
          * blog: [http://macstrac.blogspot.com/](http://macstrac.blogspot.com/)
        * Software Fellow at [FuseSource](http://fusesource.com)
        * long term Open Source contributor
          * created Apache Camel
          * created the Groovy programming language
          * co-founder of 
              * Apache ActiveMQ, Camel, ServiceMix, Fabric, ...
              * Scalate
    
    .slide
      :markdown
        # Scalate Overview
        
        ![Scalate](images/scalate/project-logo.png)

        * its a **Scala** based **T**emplate **E**ngine
          * Scala T E => **Scalate*

    .slide
      :markdown
        # Design Goals

        ![Scalate](images/scalate/project-logo.png)
        
        * make an awesome template engine 
          * framework & container agnostic
        * support different template flavours under same API
          * there isn't really a one size fits all
        * reuse the power & type safety of Scala
          * catch errors in templates at edit/build time
              * templates are for life, not just for Christmas!
          * IDE friendly for smart completion

    .slide
      :markdown
        # Features

        * Templates are compiled & cached as fast Scala objects
        * Template objects are statically typed to catch typos
          * apart from Mustache
        * Scalate is equivalent to the combination of JSP, JSTL, JSP EL
                & SiteMesh/Tiles
          * Scala replaces JSP EL and Scala functions replace JSP
                    custom tags
          * Scalate template languages are richer, more powerful &
                    usually more DRY than JSP + JSTL
          * Scalate has in built layout support replacing
                    SiteMesh/Titles
              

    .slide
      :markdown
        # How Scalate works

        * TemplateEngine is used to load Templates
          * typically templates are converted into scala code and
                    compiled to avoid runtime parsing
          * can customize various things...
              * caching & reloading
              * how URIs are resolved (classpath, file system etc)
              * internationalisation
        * RenderContext is used to render a template
          * has a Map[String,Any] like set of attributes for
                    passing/sharing state
          * loads of helper methods for use inside the template
              * localisation, including other templates, views,
                        layouts etc
        * template languages implemented using Scala parser generators

    .slide
      :markdown
        # Scalate Template Languages

        * SSP
        * Scaml
        * Jade
        * Mustache
        * Scuery

    .slide
      :markdown
        # SSP

        * SSP or _Scala Server Pages_
          * like a non-sucky JSP :)
        * easiest template engine to start with if folks know
          * ASP, JSP, GSP, Erb, Velocity, FreeMarker style templates
        * supports JSP / Erb style syntax 
          * <% statements %>
          * <%= expression %>
          * ${expression}
        * examples:
          * Dear ${people.map(_.name).mkString(", ")} how are you?

    .slide
      :markdown
        # SSP also supports Velocity style tokens

      :pygmentize
        -----------------------------
        ssp: example
        -----------------------------
        #if (lineItems.find(_.price > 10).isDefined)
          <b>Welcome big spender!</b>
        #end

    .slide
      :markdown
        # SSP sample page

      !~~ pygmentizeUri("../scalate-example/src/main/webapp/tableSsp.ssp")

    .slide
      :markdown
        # Scaml

        * Scaml is a Scala port of HAML
        * HAML started in the Rails world and became a very popular
                  alternative to Erb templates
        * whitespace sensitive (which is handy for markup, avoids
                  badly nested markup)
        * syntax
            * %foo to indicate <foo>...</foo>
            * \- for statements
            * = expressions

    .slide
      :markdown
        # Scaml sample page

      !~~ pygmentizeUri("../scalate-example/src/main/webapp/tableScaml.scaml")

    .slide
      :markdown
        # Jade

        * Jade out in JavaScript / Rails worlds as a simpler more DRY
                version of HAML / Scaml 
          * avoid the % to indicate element name
              * folks tend to use lots of elements; few are
                        multi-line text content
          * use | to indicate text content inside an element when
                    multiple lines required
          * Implemented as just a slightly different surface parser
                    on Scaml
        * Jade + markdown are the hotness!

    .slide
      :markdown
        # Jade sample page

      !~~ pygmentizeUri("../scalate-example/src/main/webapp/tableJade.jade")
      
    .slide
      :markdown
        # Mustache

        * no logic in the scripts 
        * can be used from JavaScript on the client side or Scala /
                Scalate on the server side
        * uses {{foo}} mustaches for values
        * use {{#foo}} and {{/foo}} for blocks/loops/conditionals
        * good if you want your designer to own the templates
          * though dynamically typed

    .slide
      :markdown
        # Mustache sample page

      !~~ pygmentizeUri("../scalate-example/src/main/webapp/tableMustache.mustache", "html")
      
    .slide
      :markdown
        # Scuery

        * more of a HTML/XHTML transformation engine really
        * uses CSS3 parser & transformation engine
        * templates are regular HTML pages (possibly with mock data)
                owned by your designer
        * use the transform API (jQuery-ish) to transform the HTML to
                inject/replace with dynamic data

    .slide
      :markdown
        # Scuery sample HTML page

      !~~ pygmentizeUri("../scalate-example/src/main/webapp/tableScuery.html")

    .slide
      :markdown
        # Scuery sample Scala transform

      !~~ pygmentizeUri("../scalate-example/src/main/scala/MyTransform.scala")

    .slide
      :markdown
        # Tips on picking a template language

        * If you want your designers to own your templates
          * consider **mustache** or **scuery**
{'fraction_non_alphanumeric': 0.09758537886872999, 'fraction_numerical': 0.0028014941302027746, 'mean_word_length': 1.8385081408557364, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7650673', 'n_tokens_mistral': 4121, 'n_tokens_neox': 3870, 'n_words': 1286}