Namespaces

 
1.0.0-SNAPSHOT Arrow_down_16x16
  • (defsnippet name source selector args & forms)
Define a named snippet -- equivalent to (def name (snippet source selector args ...)).

1 Example top

  • ;; snippet1.html
    ;; <h1>Welcome <span id="name">Rich</span></h1>
    
    (defsnippet snippet1
       "snippet1.html"
       [[:h1]]
       [name]
       [:#name] (content name))
    
    ;; template1.html
    ;; <html><body><div id="snippetinsert"/></body></html>
    (deftemplate template1
       "template1.html"
       [name]
       [:#snippetinsert] (content (snippet1 name)))
    
    (template1 "Steven")
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source net/cgrand/enlive_html.clj:578 top

(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)))
Vars in net.cgrand.enlive-html/defsnippet: defmacro name source concat list seq
Used in 0 other vars

Comments top

No comments for defsnippet. Log in to add a comment.