Skip to content

Adds optional doc strings to defsnippet #115

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/net/cgrand/enlive_html.clj
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,11 @@

(defmacro defsnippet
"Define a named snippet -- equivalent to (def name (snippet source selector args ...))."
[name source selector args & forms]
`(def ~name (snippet ~source ~selector ~args ~@forms)))
[name source selector doc-string? args & forms]
(if (string? doc-string?)
`(def ~name ~doc-string? (snippet ~source ~selector ~args ~@forms))
;; doc-string? is the args, the forms are args + forms
`(def ~name (snippet ~source ~selector ~doc-string? ~@(cons args forms)))))

(defmacro deftemplate
"Defines a template as a function that returns a seq of strings."
Expand Down