groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Esteban GĂ­nez <egi...@gmail.com>
Subject Bug in MarkupTemplateEngine?
Date Fri, 20 Nov 2015 04:47:08 GMT
Hey guys

I've been playing with the MarkupTemplateEngine these past few days, I
wanted to use it in lieu of gsp..(no offense to gsp's but the groovy
templates are way nicer).

As a first step I was able to hack a taglib that allows to 'embed' groovy
templates in your gsp
like so
..some gsp
<g:gtp>
h1('some h1 title) { a('some more text') }
<g:gtp>
....contnue gsp

https://gist.github.com/eginez/adaf5a07a6226a7097eb

While doing so I noticed that some interesting rendering...

import groovy.text.markup.MarkupTemplateEngine
import java.io.StringWriter
def eng = new MarkupTemplateEngine()

def w = new StringWriter()
eng.createTemplate ('''
n1('text1'){ n2('text2') }
''').make().writeTo(w)
assert w.toString() == '<n1>text1<n2>text2</n2></n1>'

The above assertion evaluates to false, the string that gets generated is
<n1><n2>text2</n2></n1>

Wondering if some has seen this in the past or is a known bug. I haven't
looked into the code yet but I'll do it a little later
Any input is appreciated
Thanks guys
E.

Mime
View raw message