hiccup icon indicating copy to clipboard operation
hiccup copied to clipboard

Symbols for attribute values?

Open rnikander opened this issue 6 years ago • 5 comments

Would you be interested in a pull request that got this to work:

[:form {:method 'post} ...

Like the following already works:

[:div {:style {:box-sizing 'border-box ...

rnikander avatar Feb 17 '19 17:02 rnikander

I just noticed that [:input {:type 'password ... also seems to work. So it appears be inconsistent. ?

rnikander avatar Feb 17 '19 17:02 rnikander

user=> (use 'hiccup2.core)
nil
user=> (str (html [:form {:method 'post}]))
"<form method=\"post\"></form>"

Can you provide an example where quoted symbols don't work?

weavejester avatar Feb 17 '19 18:02 weavejester

It appears to be triggered by having a variable within the HTML data:

user=> (let [x "foo"] (hic/html [:form {:method 'post} x]))
"<form method=\"quote post\">foo</form>"

rnikander avatar Feb 17 '19 18:02 rnikander

Thanks, I can reproduce that on master. That is a bug, and I would be interested in a PR to fix it.

weavejester avatar Feb 17 '19 18:02 weavejester

Okay, I don't have a PR at the moment. Looking at the code I can see sort of where the problem is (compile-attr-map, unevaluated?) but I don't understand it enough to fix it.

rnikander avatar Feb 18 '19 22:02 rnikander