{"action":"created","issue":{"url":"https://api.github.com/repos/r0man/sablono/issues/130","repository_url":"https://api.github.com/repos/r0man/sablono","labels_url":"https://api.github.com/repos/r0man/sablono/issues/130/labels{/name}","comments_url":"https://api.github.com/repos/r0man/sablono/issues/130/comments","events_url":"https://api.github.com/repos/r0man/sablono/issues/130/events","html_url":"https://github.com/r0man/sablono/issues/130","id":175988132,"number":130,"title":"looking up a class from a map pulls the map into the class attribute","user":{"login":"OliverM","id":710458,"avatar_url":"https://avatars.githubusercontent.com/u/710458?v=3","gravatar_id":"","url":"https://api.github.com/users/OliverM","html_url":"https://github.com/OliverM","followers_url":"https://api.github.com/users/OliverM/followers","following_url":"https://api.github.com/users/OliverM/following{/other_user}","gists_url":"https://api.github.com/users/OliverM/gists{/gist_id}","starred_url":"https://api.github.com/users/OliverM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OliverM/subscriptions","organizations_url":"https://api.github.com/users/OliverM/orgs","repos_url":"https://api.github.com/users/OliverM/repos","events_url":"https://api.github.com/users/OliverM/events{/privacy}","received_events_url":"https://api.github.com/users/OliverM/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-09T11:32:04Z","updated_at":"2016-09-10T10:42:33Z","closed_at":null,"body":"I originally filed this issue on [Rum](https://github.com/tonsky/rum/issues/97) but @martinklepsch suggested it should be filed on sablono as an issue with `sablono.util/join-classes`. \r\n\r\nIf I define a map of styles like so:\r\n\r\n```clj\r\n(def csslib\r\n      {:table-header-row \"bg-mid-gray\"\r\n       :table-header-cell \"bg-yellow\"\r\n       :table-row \"bg-red\"\r\n       :table-cell \"bg-blue\"\r\n    })\r\n```\r\n\r\nand then try to refer to them as class attributes in a Rum `defc` call (assuming Rum's in your namespace under `r`) like so:\r\n\r\n```clj\r\n(r/defc table-cell < r/static [{:keys [text] :as cell}]\r\n   [:td {:class (:table-cell csslib)}\r\n    [:span text]])\r\n```\r\n\r\nThe assigned class for the table cell in the generated html reads\r\n\r\n```html\r\nclass=\"table-cell :table-header-row bg-mid-gray :table-header-cell bg-yellow :table-row bg-red :table-cell bg-blue\"\r\n```\r\n\r\nOne workaround is to put the map lookup inside a `str` call, which gives the expected class attribute of `class=\"bg-blue\"` in the rendered html, and [Martin pointed out that](https://github.com/tonsky/rum/issues/97#issuecomment-245884226) other typical map lookups work fine:\r\n```clj\r\n(get csslib :table-cell)\r\n(-> csslib :table-cell)\r\n(csslib :table-cell)\r\n```\r\n\r\n \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/r0man/sablono/issues/comments/246104940","html_url":"https://github.com/r0man/sablono/issues/130#issuecomment-246104940","issue_url":"https://api.github.com/repos/r0man/sablono/issues/130","id":246104940,"user":{"login":"r0man","id":21566,"avatar_url":"https://avatars.githubusercontent.com/u/21566?v=3","gravatar_id":"","url":"https://api.github.com/users/r0man","html_url":"https://github.com/r0man","followers_url":"https://api.github.com/users/r0man/followers","following_url":"https://api.github.com/users/r0man/following{/other_user}","gists_url":"https://api.github.com/users/r0man/gists{/gist_id}","starred_url":"https://api.github.com/users/r0man/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/r0man/subscriptions","organizations_url":"https://api.github.com/users/r0man/orgs","repos_url":"https://api.github.com/users/r0man/repos","events_url":"https://api.github.com/users/r0man/events{/privacy}","received_events_url":"https://api.github.com/users/r0man/received_events","type":"User","site_admin":false},"created_at":"2016-09-10T10:42:33Z","updated_at":"2016-09-10T10:42:33Z","body":"I am AFK at the moment. Patch with test welcome.\n\nOn 9 Sep 2016 1:35 p.m., \"Martin Klepsch\" <notifications@github.com> wrote:\n\n> Here's a minimal example using just Sablono's html macro:\n>\n> (html [:div {:class (:table-cell csslib)}\n>   [:span \"abc\"]]))\n>\n> —\n> You are receiving this because you are subscribed to this thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/r0man/sablono/issues/130#issuecomment-245889291>, or mute\n> the thread\n> <https://github.com/notifications/unsubscribe-auth/AABUPpYLwfH2-fCAt4qFU-aBqNK5QCCSks5qoURugaJpZM4J49Od>\n> .\n>\n"}}
{"actor":{"display_login":"r0man"}}