Created
July 27, 2009 13:54
-
-
Save geelen/156324 to your computer and use it in GitHub Desktop.
This file contains 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 xml.{Node, Elem} | |
class Pluser(lhs : Unit => Seq[Node]) { | |
def ++(rhs : Unit => Seq[Node]) = (_ : Unit) => lhs() ++ rhs() | |
} | |
object Main { | |
implicit def hotString(s : Seq[Node]) = (_ : Unit) => s | |
implicit def pluser(lhs : Unit => Seq[Node]) = new Pluser(lhs) | |
def html(blk : Unit => Seq[Node]) = <html>{blk()}</html> | |
def body(blk : Unit => Seq[Node]) = (_ : Unit) => <body>{blk()}</body> | |
def head(blk : Unit => Seq[Node]) = (_ : Unit) => <head>{blk()}</head> | |
def title(s : String) = <title>{s}</title> | |
def main(args: Array[String]) { | |
println(html { | |
head { | |
title("Something") | |
} ++ body { | |
<p>lolfase</p> | |
} | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment