Something like this was on my TODO list. I wanted to pass scripts via <p:script> </p:script>
So here it is. public class Handlebars { @Parameter(required = true) private RenderCommand template; @Parameter(defaultPrefix = "literal") private String id; @Parameter(defaultPrefix = "literal") private String type; private Element wrappingDiv; @BeginRender RenderCommand beginRender() { return new RenderCommand() { public void render(MarkupWriter writer, RenderQueue queue) { wrappingDiv = writer.element("div"); RenderCommand renderCommand = new RenderCommand() { public void render(MarkupWriter writer2, RenderQueue queue2) { queue2.push(template); } }; queue.push(renderCommand); } }; } @AfterRender void afterRender(MarkupWriter writer) { writer.end(); String html = wrappingDiv.getChildMarkup(). replaceAll("<", "<").replaceAll(">", ">").replaceAll("&","&"); wrappingDiv.remove(); writer.element("script", "type", type, "id", id); writer.writeRaw(html); writer.end(); } } -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-and-inline-Handlebars-js-tp5660756p5663469.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org