Skip to content Skip to sidebar Skip to footer

Html Using Groovy Markupbuilder, How Do I Elegantly Mix Tags And Text?

When using Groovy MarkupBuilder, I have places where I need to output text into the document, or call a function which outputs text into the document. Currently, I'm using the unde

Solution 1:

Actually, the recommended way now is to use mkp.yield, e.g.,

src.p {
    mkp.yield'Some element that has a '
    strong 'child element'
    mkp.yield' which seems pretty basic.'
}

to produce

<p>Some element that has a <strong>child element</strong> which seems pretty basic.</p>

Post a Comment for "Html Using Groovy Markupbuilder, How Do I Elegantly Mix Tags And Text?"