From: Aredridel Date: 2004-06-22T08:13:26+09:00 Subject: Re: Enabling/disabling HTML with Amrita On Tue, 2004-06-22 at 06:33 +0900, Eric Schwartz wrote: > I know with Amrita, if you pass nil as the data for a template > element, it doesn't get printed. What I'm interested in is in > conditional container elements, such as or , that print > their templated content when enabled. See my test below: > > emschwar@wilson:/tmp$ cat bah.templ > > > >
/>
> > emschwar@wilson:/tmp$ cat ./amrita-test > #!/usr/bin/ruby > require 'amrita/template' > > data1 = { :cell1 => "Cell 1" } > > data2 = { :cell1 => "Cell 1", > :row2 => "testing", > :cell2 => "Cell 2" } > > template = Amrita::TemplateFile.new("bah.templ") > > template.expand(STDOUT, data1) > puts > template.expand(STDOUT, data2) > > emschwar@wilson:/tmp$ ./amrita-test > > > >
Cell 1
> > > > testing >
Cell 1
> emschwar@wilson:/tmp$ > > Obviously, what I'm looking for in the second case is something like > > > >
Cell 1
Cell 2
> > I've been resorting to templating tricks like > > > > but that leaves an empty table row in there when there's no 'cell2', > which is not always what I want. In the particular application I'm > using it for, it's okay, but it's kinda ugly. How can I get there > from here? Or can I? Cell 2 Ari