html5 - How to pass in object definition body to a function -
my goal dry repetitive parts of definition of objects passed generic function in next block of code:
rendertpl(response, "person.html", new transformer { $(".person :first-child").contents = name $(".person :last-child").contents = age }) i dry out new transformer part , able pass block in 2nd argument list of rendertpl instead:
rendertpl(response, "person.html") { $(".person :first-child").contents = name $(".person :last-child").contents = age } is possible accomplish without resorting macros? post attempts far honest couldn't come right now.
background: i'm using scalate's awesome scuery servlets, combined lift's net.liftweb.util.html5 , org.ccil.cowan.tagsoup html5 parsing , rendering; current rendertpl , loadtpl implementation can seen here.
html5 scala scalate scuery
No comments:
Post a Comment