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

Export the normalize-element API #149

Open
johnmcconnell opened this issue Dec 7, 2017 · 2 comments
Open

Export the normalize-element API #149

johnmcconnell opened this issue Dec 7, 2017 · 2 comments

Comments

@johnmcconnell
Copy link

johnmcconnell commented Dec 7, 2017

Hi,

I have the following use case:

Given some complex hiccup structure, I would like to dynamically append classes to children of the hiccup element in a parent function. I would like an API like the following.

For example,

(:require [hiccup.compiler :as c])

(def current-hiccup (complex-hiccup-structure))

(def wanted-hiccup
  (let [[tag attrs children] (c/normalize-element current-hiccup)]
    [tag attrs (map (partial add-class "child-class") current-hiccup)])))  

I noticed normalize-element is in the compilier namespace: https://github.com/weavejester/hiccup/blob/master/src/hiccup/compiler.clj#L87 but that is not documented. Can we document that namespace?

@weavejester
Copy link
Owner

I don't want to make the compiler namespace entirely public, but exposing normalize-element, perhaps as part of hiccup.util is a possibility. I'll need to consider it.

@johnmcconnell
Copy link
Author

Cool!

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