Add Spring View support for Groovy Markup Templates

This commit adds support for Groovy Markup templates.
Spring's support requires Groovy 2.3.1+.

To use it, simply create a GroovyMarkupConfigurer and a
GroovyMarkupViewResolver beans in the web application context.

Issue: SPR-11789
This commit is contained in:
Brian Clozel
2014-06-03 15:50:50 +02:00
committed by Rossen Stoyanchev
parent 6b6b008c1f
commit 0ecfa8e404
18 changed files with 956 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
layout 'layout-main.tpl',
title: 'Layout example',
bodyContents: contents { p('This is the body') }

View File

@@ -0,0 +1 @@
p('Hello Spring')

View File

@@ -0,0 +1,2 @@
include template: 'includes/include.tpl'
p('Hallo Spring')

View File

@@ -0,0 +1,2 @@
include template: 'includes/include.tpl'
p('¡hola Spring')

View File

@@ -0,0 +1 @@
p('Bonjour Spring')

View File

@@ -0,0 +1,8 @@
html {
head {
title(title)
}
body {
bodyContents()
}
}

View File

@@ -0,0 +1,13 @@
yieldUnescaped '<!DOCTYPE html>'
html {
head {
meta('http-equiv':'"Content-Type", content="text/html; charset=utf-8"')
title('Spring Framework Groovy Template Support')
}
body {
div(class:'test') {
h1("Hello $name")
p("Groovy Templates")
}
}
}