1. You might want to see if the `pollen-count` package suits your needs:
https://github.com/malcolmstill/pollen-count
2.
>> After some playing around, it seems that when list items are processed
>> (when the li function is called), the code for the ordered list in the case
>> statement isn't getting run; in li list-type still has its initial value.
Right -- because your code depends on the `ol` function running before the `li`
functions inside. But that's not how the page is actually evaluated, so you're
not getting the right result. Tag functions (and other ordinary functions) are
evaluated from the bottom up. (IIRC this is, indeed, the opposite of XSLT,
which goes from the top down.)
3. The easiest option is probably just shifting the list-item processing into
the `ol` function itself. This is usually what I do (there's a sample in the
`pollen-tfl` code, showing how the surrounding list tag decodes the items
inside). Once you have the list items gathered into a (Racket) list, you can
loop through them (either using `set!` to keep a counter, or `in-indexed` is
also good for this), for instance:
#lang racket/base
(define list-items '("foo" "bar" "baz"))
`(ol ,@(for/list ([(item idx) (in-indexed list-items)])
`(li ,(format "~a." (add1 idx)) ,item)))
> '(ol (li "1." "foo") (li "2." "bar") (li "3." "baz"))
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.