We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MarkupTemplateEngine has a bug in groovy 2.3.3 where the properties are not propagated properly making the template system fairly unusable.
Example code used from mrhaki: http://mrhaki.blogspot.co.uk/2014/08/groovy-goodness-using-layouts-with.html
Using his main.tpl, this is the routeMatcher in server.groovy:
routeMatcher.getWithRegEx('.*') { req ->
// Create engine with configuration. TemplateConfiguration config = new TemplateConfiguration(autoIndent: true, autoNewLine: true) MarkupTemplateEngine engine = new MarkupTemplateEngine(config) // Create template with layout reference // and values for layout variables. Template template = engine.createTemplate('''\ layout 'layouts/main.tpl', true, pageTitle: 'Welcome', mainContents: contents { h1 'Home' }, actions: contents { ul(class: 'actions') { ['Home', 'About'].each { li it } } } ''') // Render output for template. Writer writer = new StringWriter() Writable output = template.make([pubDate: Date.parse('yyyyMMdd', '20140801')]) output.writeTo(writer) String result = writer.toString() req.response.end result
}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
MarkupTemplateEngine has a bug in groovy 2.3.3 where the properties are not propagated properly making the template system fairly unusable.
Example code used from mrhaki:
http://mrhaki.blogspot.co.uk/2014/08/groovy-goodness-using-layouts-with.html
Using his main.tpl, this is the routeMatcher in server.groovy:
routeMatcher.getWithRegEx('.*') { req ->
}
The text was updated successfully, but these errors were encountered: