Unquoted values in HTML tags

25 views
Skip to first unread message

afo...@gmail.com

unread,
Apr 24, 2019, 2:00:12 PM4/24/19
to Pollen
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

Matthew Butterick

unread,
Apr 24, 2019, 2:30:32 PM4/24/19
to afo...@gmail.com, Pollen

On Apr 24, 2019, at 11:00 AM, afo...@gmail.com wrote:
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?

In HTML, how is the meaning of an unquoted attribute value different from that of a quoted attribute value? 

Sorawee Porncharoenwase

unread,
Apr 24, 2019, 2:30:53 PM4/24/19
to afo...@gmail.com, Pollen

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}

--
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+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

the...@gmail.com

unread,
Apr 24, 2019, 7:56:15 PM4/24/19
to Pollen
Thanks for the speedy clarification. I had assumed that the errors I was seeing in my rendered pages were due to this (it seemed that way from trial and error at first), but I'm now realizing there's more I need to do to make the CSS framework I chose work as I expect it to.
To unsubscribe from this group and stop receiving emails from it, send an email to poll...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages