The curly-brace syntax is almost always preferable. Keep in mind that the 
linebreaks are separated into their own elements (For more on this behavior see 
[1].) So this markup:

◊ol{The remaining forty-nine stalks ◊(comment "" ",") two piles.
another item
another item
}

Produces this list of five (not three) elements:

'("The remaining forty-nine stalks "
             (comment "" ",")
             " two piles."
             "\n"
             "another item"
             "\n"
             "another item")

Probably what you want is to preprocess `elements` into bigger chunks 
representing list items before passing each to your 'li tag lambda. For 
instance this:

(require sugar/list)
(filter-split '("The remaining forty-nine stalks "
             (comment "" ",")
             " two piles."
             "\n"
             "another item"
             "\n"
             "another item")
           (λ (e) (equal? e "\n")))


Produces these sublists:

'(("The remaining forty-nine stalks " (comment "" ",") " two piles.")
  ("another item")
  ("another item"))

For a more elaborate example of list-item detection, see the 
`detect-list-items` function [2] in the pollen-tfl sample project.

[1] 
https://docs.racket-lang.org/pollen/pollen-command-syntax.html#%28part._the-text-body%29
 
[2] 
https://docs.racket-lang.org/pollen-tfl/_pollen_rkt_.html#%28def._%28%28lib._pollen-tfl%2Fpollen..rkt%29._detect-list-items%29%29

> On Mar 10, 2019, at 4:08 PM, Brendan Stromberger 
> <brendanstromber...@gmail.com> wrote:
> 
> Hey there, still plugging away on my book project. I have a function for an 
> ordered list:
> 
> (define (ol . elements)
>   (case (current-poly-target)
>     [(txt) elements]
>     [else (txexpr 'ol empty
>       (map (lambda (e) (txexpr 'li empty (list e))) elements))]))
> 
> And I am using it like so:
> 
>     ◊ol[
>       "The remaining forty-nine stalks are laid down and, aiming at the 
> middle of the pile with the right thumb◊(comment "" ",") two piles are 
> separated."
>       "another item"
>       "another item"
>     ]
> 
> I want to use it this way because if I use the ◊ol{} syntax, my ◊comment{} 
> tag in the first item gets treated as its own <li>, and generally the 
> generated markup is a bit weird – at each newline, a blank <li> is generated:

-- 
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.

Reply via email to