diff options
-rw-r--r-- | README.md | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -262,27 +262,27 @@ Simple example: Complex example, adapted from Spinneret documentation: ::text - (deftag :easy-input (label (name (gensym)) - (id name) (type "text") . other-attrs) default - ^(progn - (:label :for ,name ,label) - (:input :name ,name :id ,id :type ,type - ,*other-attrs :value (progn ,*default)))) + (deftag :easy-input (label (name (gensym)) + (id name) (type "text") . other-attrs) default + ^(progn + (:label :for ,name ,label) + (:input :name ,name :id ,id :type ,type + ,*other-attrs :value (progn ,*default)))) Note that `progn` here isn't the Lisp `progn` operator; it is recognized by the `deftag` expansion mechanism as a way of producing multiple elements. To invoke `:easy-input`, we might do this: ::text - 5> (with-html-output (*stdout* nil :indent t) - (:div :class "cls" - (:easy-input :name "foo" :id "foo-23" + 5> (with-html-output (*stdout* nil :indent t) + (:div :class "cls" + (:easy-input :name "foo" :id "foo-23" :style "style" :label "lab" "123"))) - <div class='cls'> - <label for='foo'>lab - </label> - <input name='foo' id='foo-23' type='text' style='style' value='123' /> - </div> + <div class='cls'> + <label for='foo'>lab + </label> + <input name='foo' id='foo-23' type='text' style='style' value='123' /> + </div> Note a small flexibility: the `body` argument `"123"` of `:easy-input` wasn't inserted as an element in the middle of the tag as in the simple example, but |