| In order to get myself more familiar with arc I started writing an Arc CSS generator - https://github.com/markbahnman/arc-css - and I'm getting stumped with implementing nested rules. I get the feeling that I just don't fully grasp macros. I modeled the library after html.arc and the tags. The main macro is (mac css (sel props . nest)
`(do ,(pr (string sel "{"))
,(gen-css-properties props)
,(each g nest
(gen-nested-css g sel props))))
Where gen-nested-css generates the macro code for nested rules (def gen-nested-css (rest sel prev)
`(css ,(string (if sel sel) " " (car rest))
,(join prev (cadr rest))
,(if (cddr rest) (cddr rest))))
When I debug it with pr statements I see that when I have a nested rule it gets passed correctly into gen-nested-css but nothing comes of the code it generates. |