作者:pan2502851807 | 2023-09-06 10:26
1> Hank Gay..:
实际上,现在推荐的方法是使用mkp.yield
,例如,
src.p {
mkp.yield 'Some element that has a '
strong 'child element'
mkp.yield ' which seems pretty basic.'
}
生产
Some element that has a child element which seems pretty basic.
@DavidW:不,不是!它会产生`
文本...... yield>`.`mkp`是一个特殊的命名空间,用于摆脱构建器的正常构建模式,并可以访问辅助标记方法,如`yield`和`yieldUnescaped`.请参阅http://docs.groovy-lang.org/latest/html/api/groovy/xml/MarkupBuilder.html#getMkp()