I'm printing out a map's key values to html, and the key namespaces are vanishing, which I don't want.
layout
below calls hiccup's html5
to render:
(layout (str "Path " (:path/title path))
[:h1 "Title: " (:title path) slug]
[:p (str path)] ; prints "{:db/id 17592186045542, :path/title "sdf"}"
(println (keys path)) ; prints in terminal "(:db/id :path/title)"
[:p (keys path)] ; prints "idtitle"
(for [[k v] path] [:p k " " v]) ; prints "id 17592186045542" /n "title sdf"
(map (fn [[k v]] [:p k " " v]) path)))) ; same as above
In both (keys path)
, and the for
& map
calls, the ":db/" and ":path/" namespaces of the keys are not rendered. Why?
I suppose the keys are being implicitly name
d, unlike the good cases where you explicitly use str
on them.
Maybe you should use
[:p (str k) " " (str v)]
Or simply:
[:p (str/join " " [k v])]