Re: [Gaea] Named optional attributes
Matias Capeletto <[email protected]>
| Newsgroups | gmane.comp.lib.boost.documentation |
|---|---|
| Message-ID | <CAJiTyxyW1zFgkPdJd6XYqn-DvQrW1x31TFUpGp82dPzey+5=tQ@mail.gmail.com> |
On Tue, Nov 1, 2011 at 3:52 PM, Joel de Guzman <[email protected]> wrote: > On 11/1/2011 7:41 PM, Matias Capeletto wrote: >> Talking about optional arguments, have you think about using it for >> the if template? > > Interesting, but let's keep it as simple as possible. No problem. One thing that bugs me about the current definition of if is that doesn't work like other templates because you can call it with two or three parameters. To be a real template it should be defined in the specs as [decl [if cond . branchs]]. But maybe it is somewhat nitpicking :) > BTW, I added variables. This is the solution to the footnote > issue. Just allow for variables where we can collect the > footnotes and expand them where needed. > > The latest spec: http://pastebin.com/dDP4peAd Nice... I was waiting to see what you were thinking about this. I do not know if I fully understand how it supposed to work. These variables are not intended to be used as arguments of other templates, but as a way to create some kind of global variables accessibly by all other templates? [def [unfold . things] [fold [things][][rcat]]] [var footnotes-list []] [def [section name . blocks] [set footnotes-list []] <section> <title>[name]</title> [unfold [blocks]] </section> <footnotes> [unfold [footnotes-list]] </footnotes> ] [def [footnote text] [def [footnote-id] [size [footnotes-list]]] <footnoteref id=[footnote-id]/> [set footnotes-list [append [footnotes-list] [[footnote-id] :: [text]]] ] It feels a little bit strange, but maybe is just the first impression. Do you have any other use cases? > I think we're almost there. I've reread the StringTemplate > engine docs, and I must say, this is so much better in > terms of purity and elegance of syntax. 'fcourse I'm biased :) parens(x) ::= "(<x>)" "text":parens() // => (text) [def [parens x] ([x])] [parens text] [/ => (text) ] :) Best regards Matias