-
Notifications
You must be signed in to change notification settings - Fork 177
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
Migrate hiccup.page (and others?) to hiccup2 namespace? #144
Comments
You should be able to wrap it in (hiccup2/html (page/html5 ...)) But a hiccup2.page namespace (or similar) is certainly on the agenda. |
Ah right, that makes sense, I'll do that instead. Thanks! |
I tried that, and it didn't seem to work, the ;; requires:
;; [hiccup2.core :as h2]
;; [hiccup.core :as h]
;; [hiccup.page :refer [html5]
(str
(h/html
(html5
[:h1 "Available commands"])
))
=> "<!DOCTYPE html>\n<html><h1>Available commands</h1></html>"
(str
(h2/html
(html5
[:h1 "Available commands"])
))
=> "<!DOCTYPE html>\n<html><h1>Available commands</h1></html>" I'm happy with my own |
@danielcompton I've seen the same behaviour |
Since I wanted the escaping behavior for my projects, I've forked this repo to move the relevant namespaces under hiccup2. The html5 macro is at hiccup2.page/html5. The lein coordinates are [org.clojars.john-shaffer/hiccup "2.0.0-SNAPSHOT"] I tried to use -alpha version tagging, but for some reason I get a compile-time error "Syntax error compiling at (hiccup2/core.clj:30:28). No such var: compiler/compile-html-with-bindings" if I do that, even though absolutely everything is the same except the version string. I added the function hiccup.element/html-comment, as I'm basing my page off files from https://templated.co/, and I want to preserve the attribution. Edit: Now I get that same error even with a SNAPSHOT version. Everything works fine when I copy the new files into my website repo and use [hiccup "2.0.0-alpha2"], even though that puts the exact same code on the classpath. I thought that maybe a dependency was including hiccup, but that's not the case. |
Thanks, @john-shaffer ! I have the same situation where your fork only works if I inline the code. But, hey, it works! |
@PEZ I've actually been using Rum's server-side rendering, since it provides the same auto-escaping functionality but can also be used with ClojureScript. I would highly recommend giving it a look. |
I'm adopting hiccup2 on a project, but noticed that hiccup.page doesn't have a hiccup2 version. This means as far as I can tell, the only way to get the
html5
macro or others is to make a copy of them from hiccup into my own code, and change thehtml
reference to point tohiccup2.core/html
. Would you consider having other necessary namespaces ported over, or is there another way to do this?The text was updated successfully, but these errors were encountered: