I am trying to inject a partial html into GTPL file, but it seems always "escapes" html content. How can send HTML snippet to markup and render it directly?
Contents of "hello.gtpl"
yieldUnescaped '<!DOCTYPE html>'
html {
yieldUnescaped text
}
From ratpack.groovy
get('helloplain') { //works .but clumsy
String htmlPayLoad = "<!DOCTYPE html> <html> <title> Hello </title><body> <h3> Hello </h3> </body> </html>"
context.getResponse().contentType(HttpHeaderConstants.HTML_UTF_8).send(htmlPayLoad.getBytes());
}
get('hellotemplate') { //ex: /users/
String text = "<title> Hello </title><body> <h3> Hello </h3> </body> "
render groovyMarkupTemplate( "hello.gtpl" ,text: text )
}
localhost:5050/helloplain
delivers a proper HTML where as localhost:5050/hellotemplate
delivers a file that has escaped all HTML content.
<!DOCTYPE html><html><title> Hello </title><body> <h3> Hello </h3> </body> </html>
What did I miss?