First of all, from https://en.wikipedia.org/wiki/HTML_attribute#Description

<div span=2>text</div>

and

<div span="2">text</div>

are the same. That is, attributes are pretty much strings. Xexpr thus
follows this, requiring that you always pass a string as an attribute.

To get what you want, you would write

◊div[#:span "2"]{text}

Or this:

◊div[#:span (number->string 2)]{text}


On Wed, Apr 24, 2019 at 11:00 AM <[email protected]> wrote:

> Apologies if this has been covered elsewhere in the docs, but I couldn't
> seem to find it in reading about how tag functions work.
>
> I want to use Pollen tags to produce HTML tags with 'bare' strings. Here's
> an example of what I'm trying to do:
>
> ◊div[#:span 2]{text}
>
> should produce
>
> <div span=2>text</div>
>
> I've tried using:
>
> ◊div[#:span ◊string->symbol{"2-1"}]{text}
>
> As well as other methods to try and pass a symbol instead of a string, but
> they always throw something like:
>
> decode-elements: contract violation
>   expected: txexpr-elements?
>   given: '((div ((span a)) "text" ))
>
> How do I pass in multi-character strings that will be "unquoted" in the 
> resulting HTML output? Do I have to write my own decode function for this?
>
> Thanks,
>
> Andrew
>
> --
> 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.
>

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

Reply via email to