svg-clj
svg-clj copied to clipboard
name of elements/g is unclear.
hey Adam, abhinav from twitter.
I was going through your source, and I couldn't understand what g stood for, maybe I could rename the function or add a comment?
(defn g
[& content]
(if (and (= 1 (count content))
(not (keyword? (first (first content)))))
;; content is a list of a list of elements
(into [:g {}] (first content))
;; content is a single element OR a list of elements
(into [:g {}] (filter (complement nil?) content))))
This was an intentional choice. I want functions which emit SVG tags to share the name of said tag. So, 'group' tags are
You are right to point out that it may be confusing. This is an issue I'll solve with better documentation. That is the next major thing I'm working on in the next few days, so I think that'll be sorted soon.
Adding a comment, I think, is fine for devs reading the source, but doesn't adequately address a library user who may face similar confusion that you pointed out here.
Basically, thanks for pointing this out, I will close the issue when I've pushed a documentation update :)