|
AW: MarkupBuilder combining attributes and content: msg#00155lang.groovy.user
And now, how does your solution look like? Im writing my builders in Groovy and have no idea how the ["foo"] clause can be evaluated. Thx, - J -----Ursprüngliche Nachricht----- Von: Ken Pelletier [mailto:ken-vkDrlTHbRsI@xxxxxxxxxxxxxxxx] Gesendet: Dienstag, 23. November 2004 05:54 An: user-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@xxxxxxxxxxxxxxxx Betreff: Re: [groovy-user] MarkupBuilder combining attributes and content I *was* beginning to have the feeling that I was barking up the wrong tree - thanks for pointing me to StreamingMarkupBuilder. I managed to get mixed markup working with a bit of jiggery pokery and inferring its usage from DocGenerator. - Ken On Nov 22, 2004, at 12:28 PM, Guillaume Laforge wrote: > Ken Pelletier wrote: >> How can I use MarkupBuilder to generate html elements that have both >> attributes and content? >> I can't seem to locate any examples anywhere, but it's such an >> essential case I'm sure it's supported. >> Eg: <td class="foo">some content here</td> >> mb = new MarkupBuilder() >> mb.td(class:"foo") // yields <td class='foo' /> mb.td("some content >> here") // yields <td>some content here</td> mb.td(class:"foo", "some >> content here") // yields <td class='foo' /> I believe there was an >> example on the wiki here >> http://wiki.codehaus.org/groovy/TreeBasedSyntax but that page seems >> to have disappeared today - at least it's been inaccessible to me >> since this afternoon. > > Though that's a very common use case, unfortunately, MarkupBuilder is > quite limited and cannot generate such simple tags. > You'll have to use StreamingMarkupBuilder which you can build from > Groovy sources (since in the last build, due to a build problem, this > class hasn't been included in the distribution). > To know how it works, you should have a look at DocGenerator.groovy in > the source distribution, there are some good examples of its usage. > > -- > Guillaume Laforge > http://glaforge.free.fr/weblog
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: MarkupBuilder combining attributes and content, Guillaume Laforge |
|---|---|
| Next by Date: | Re: MarkupBuilder combining attributes and content, Scott Stirling |
| Previous by Thread: | Doubt about Groovy Docs, Cleverton Hentz |
| Next by Thread: | No anonymous inner classes?, Dusty Phillips |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |