This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -@ import val it: Console | |
| - import scala.collection.JavaConversions._ | |
| %h2 Scalate Console | |
| %ul | |
| - for (template <- templates) | |
| %li | |
| - val templateFile = servletContext.getRealPath(template) | |
| %a(href="txmt://open/?url=file:" + templateFile) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The ssp code... | |
| $_scalate_$_context << someLayout { | |
| $_scalate_$_context << ( "\nthis is some body!\n" ); | |
| } | |
| $_scalate_$_context << ( "\n" ); | |
| scaml code... | |
| $_scalate_$_context << ( $_scalate_$_indent ( "", $_scalate_$_context.value ( someLayout { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scala> def foo(body: => Unit) { println("start"); body; println("end") } | |
| foo: (body: => Unit)Unit | |
| scala> foo { println("hey"); println("bar") } | |
| start | |
| hey | |
| bar | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scala> def bar(body:() => String) { println("start"); body(); println("end") } | |
| bar: (body: () => String)Unit | |
| scala> implicit def body(body: => Unit): () => String = () => { println("capturing"); body; "answer" } | |
| body: (body: => Unit)() => String | |
| scala> bar { println("hey"); println("bar") } | |
| hey | |
| start | |
| capturing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scala> def tag(body:() => String) { println("start"); println("body = " + body()); println("end") } | |
| tag: (body: () => String)Unit | |
| scala> implicit def blockToStringFunction(body: () => Unit): () => String = () => { println("capturing"); body(); "answer" } | |
| blockToStringFunction: (body: () => Unit)() => String | |
| scala> tag { println("line1"); println("line2") } | |
| <console>:7: error: type mismatch; | |
| found : Unit | |
| required: () => String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scala> def b = {println("foo"); println("bar")} | |
| b: Unit | |
| scala> b | |
| foo | |
| bar | |
| scala> tag(b) | |
| start | |
| capturing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scala> def cheese(body: => Unit) { println("start"); body; println("end") } | |
| cheese: (body: => Unit)Unit | |
| scala> cheese { println("1"); println("2") } | |
| start | |
| 1 | |
| 2 | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def tag(context: RenderContext)(body: => Unit) = { | |
| val text = context.capture(body) | |
| context << ("<h3>Wrapped body</h3><p>" + text + "</p><h3>End of wrapped body</h3>") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -@ var body: String | |
| -@ var title : String = "Scalate Sample" | |
| - response.setContentType("text/html") | |
| !!! Basic | |
| %html(lang="en") | |
| %head | |
| %meta(http-equiv="Content-Type" content="text/html; charset=utf-8") | |
| %meta(name="description" content="description goes here") | |
| %meta(name="keywords" content="keywords,goes,here") | |
| %meta(name="author" content="Your Name") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="line error"> | |
| <span class="lineNumber"> | |
| 7 | |
| </span> | |
| <pre> - for (i <- <span class="errorCol">u</span>nknown)</pre> | |
| </div> |