Skip to content

Export the normalize-element API #149

@johnmcconnell

Description

@johnmcconnell

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions