Is there a way to modify the code from a previous answer
import groovy.xml.MarkupBuilder
def writer = new StringWriter()
def builder = new MarkupBuilder(writer)
def awaiting = ['one', 'two', 'three']
builder.html {
ul {
awaiting.each {
li(it.toString())
}
}
}
println writer.toString()
so that if you add a tag instead that you send it – like
builder.html{
tag{
awaiting.each{}
}
} return result
could be ‘ol’ or ‘ul’ for example
You can rely on the GStrings and the fact that you can call a function by its string value.