Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added some help about the use of templates #10

Open
wants to merge 2 commits into from

2 participants

@rapenne-s

I added an example on how-to use the template system. I'm very new to LISP, the code is working but I don't know if it's of good quality.

@fukamachi fukamachi commented on the diff
README.markdown
@@ -128,6 +128,30 @@ Caveman adopt CL-EMB as the default template engine. A package, named `myapp.vie
Of course, you can use other template engines, such as "cl-markup".
+Example of using cl-markup for rendering
+```common-lisp
+@url GET "/mypage"
+(defun func-test(params)
+ (setf params (nconc
+ (list :MUSIC)
+ (list (list
+ '(:artist "DJ X" :song "Track 1")
+ '(:artist "DJ Y" :song "Track 8")
+ '(:artist "DJ Z" :song "Let's rock!")))))
@fukamachi Owner

This part could be written as a list for readability.

  (setf params '(:music
                 ((:artist "DJ X" :song "Track 1")
                  (:artist "DJ Y" :song "Track 8")
                  (:artist "DJ X" :song "Let's rock!"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@fukamachi fukamachi commented on the diff
README.markdown
@@ -128,6 +128,30 @@ Caveman adopt CL-EMB as the default template engine. A package, named `myapp.vie
Of course, you can use other template engines, such as "cl-markup".
+Example of using cl-markup for rendering
@fukamachi Owner

s/cl-markup/cl-emb/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 7, 2012
  1. Added some help about using the templates

    Zplay authored
  2. Corrected a special char instead of a e

    Zplay authored
This page is out of date. Refresh to see the latest.
Showing with 24 additions and 0 deletions.
  1. +24 −0 README.markdown
View
24 README.markdown
@@ -128,6 +128,30 @@ Caveman adopt CL-EMB as the default template engine. A package, named `myapp.vie
Of course, you can use other template engines, such as "cl-markup".
+Example of using cl-markup for rendering
@fukamachi Owner

s/cl-markup/cl-emb/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+```common-lisp
+@url GET "/mypage"
+(defun func-test(params)
+ (setf params (nconc
+ (list :MUSIC)
+ (list (list
+ '(:artist "DJ X" :song "Track 1")
+ '(:artist "DJ Y" :song "Track 8")
+ '(:artist "DJ Z" :song "Let's rock!")))))
@fukamachi Owner

This part could be written as a list for readability.

  (setf params '(:music
                 ((:artist "DJ X" :song "Track 1")
                  (:artist "DJ Y" :song "Track 8")
                  (:artist "DJ X" :song "Let's rock!"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ (render "track-list.tpl" params))
+```
+
+In the file "track-list.tpl" which is in the templates folder
+```common-lisp
+<!-- track-list.tpl -->
+<% @loop music %>
+ <% @var artist %> tonight with <% @var song %><br />
+<% @endloop %>
+
+```
+
+You can also find more resources and examples of the official page : http://common-lisp.net/project/cl-emb/
+
### Configuration
Caveman uses ".lisp" file as configuration file in `#p"config/"` directory. When a project is just generated, you might be able to find `dev.lisp` in it. It will be used when "start" the project application with "dev" mode.
Something went wrong with that request. Please try again.