Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html5 macro does not expand options #106

Open
stain opened this issue Sep 30, 2014 · 1 comment
Open

html5 macro does not expand options #106

stain opened this issue Sep 30, 2014 · 1 comment

Comments

@stain
Copy link

stain commented Sep 30, 2014

user=> (hiccup.page/html5 {:xml? true} [:head [:title "Hello"]] [:body "Hello"])
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE html>\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>Hello</title></head><body>Hello</body></html>"

works.. but any way to set the options programmatically fails, and the options are inserted verbatim into the result:

user=> (let [options {:xml true}] 
  #_=>   (hiccup.page/html5 options [:head [:title "Hello"]] [:body "Hello"]))
"<!DOCTYPE html>\n<html>{:xml true}<head><title>Hello</title></head><body>Hello</body></html>"

This is probably because html5 does not evaluate the options symbol, and so (map? options) fails.

stain added a commit to stain/owlview that referenced this issue Sep 30, 2014
stain added a commit to stain/hiccup that referenced this issue Sep 30, 2014
@stain
Copy link
Author

stain commented Sep 30, 2014

Seems to also apply to the options of xhtml. Ideally the "options" should also be evaluated only once, so perhaps create options# abit earlier? I tried to fix it, but macro escape-unquote magic is not my favourite.. I made at least a unit test in https://github.com/stain/hiccup/tree/issue-106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant