Skip to content

Instantly share code, notes, and snippets.

@whamtet
Created June 5, 2024 11:38
Show Gist options
  • Save whamtet/158130471ae630a7132ada81199c6e3f to your computer and use it in GitHub Desktop.
Save whamtet/158130471ae630a7132ada81199c6e3f to your computer and use it in GitHub Desktop.
(def hidden-matcher #"(#)?([^\.]+)\.?(.+)?")
(defmacro hiddens [& args]
`(list
~@(for [[k-str v] (partition 2 args)]
(let [[_ id? k class] (re-find hidden-matcher k-str)]
[:input (cond-> {:type "hidden" :name k}
id? (assoc :id k)
class (assoc :class class)
(not= nil v) (assoc :value v))]))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment