Skip to content
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

name of elements/g is unclear. #4

Open
AbhinavOmprakash opened this issue Jul 8, 2021 · 1 comment
Open

name of elements/g is unclear. #4

AbhinavOmprakash opened this issue Jul 8, 2021 · 1 comment

Comments

@AbhinavOmprakash
Copy link

AbhinavOmprakash commented Jul 8, 2021

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))))
@adam-james-v
Copy link
Owner

This was an intentional choice. I want functions which emit SVG tags to share the name of said tag. So, 'group' tags are in SVG.

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants