> On Feb 25, 2019, at 3:43 PM, Brendan Stromberger
> wrote:
>
> I've got a simple Pollen question for anyone that is familiar.
>
> ◊; digram-row would map to an , and digram-row-item to an ,
>
> (define (digram . elements)
> (case (current-poly-target)
> [(txt) elements]
> [else (txexpr 'span empty elements)]))
>
> (define (digram-row . elements)
> (case (current-poly-target)
> [(txt) elements]
> [else (txexpr 'ol empty elements)]))
> ◊; but I felt that this was coupling my representation of the digram row
> ◊; a little too closely to the HTML output. I am wondering if it might not
> ◊; be better to shoot for something like this:
>
> ◊digram-row{
> ◊digram{◊(lesser-yin)}
> ◊digram{◊(greater-yin)}
> ◊digram{◊(lesser-yin)}
> ◊digram{◊(lesser-yin)}
> }
>
> ◊; I would like digram-row to be able to look at its children and if it
> ◊; determines that one of its children is a digram, then wrap the digram
> ◊; in an automatically. How do I do this?
The `digram` tags will be evaluated first, and the results become the input to
`digram-row`. Therefore, to create the kind of cooperation you describe, you
need to handle both ends:
+ The result of `digram` needs to preserve the information that `digram-row`
will find useful. Right now it just renders to a vanilla `span`. For instance,
you could add an attribute to the result like '(digram "true").
+ `digram-row` needs to operate on its `elements` conditionally based on this
information. You can do this however you like, though the `decode` function in
`pollen/decode` is designed to be helpful for this kind of processing.
--
You received this message because you are subscribed to the Google Groups
"Pollen" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to pollenpub+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.