同感enlive较复杂。前段时间,转向了Mustache。

沈锋
美味书签 http://mei.fm



On Wed, Jul 18, 2012 at 11:59 AM, dennis zhuang <killme2...@gmail.com>wrote:

> 其实就是几行代码封装下,我觉的velocity比什么enlive好用多了。
>
> 2012/7/18 Shen, Feng <shen...@gmail.com>
>
> 不错不错。
>> velocity 在java中用得较广。
>> 这样为potential 的 clojure用户铺了一下道路。
>>
>> 沈锋
>> 美味书签 http://meiwei.fm <http://mei.fm>
>>
>>
>>
>> On Wed, Jul 18, 2012 at 12:00 AM, dennis zhuang <killme2...@gmail.com>wrote:
>>
>>> A little error in getting started missing :age
>>>
>>> (render "test.vm" :name "dennis" :age 29)
>>>
>>>
>>> 2012/7/17 dennis zhuang <killme2...@gmail.com>
>>>
>>>> Hi,all
>>>>
>>>>     Apache velocity <http://velocity.apache.org/>is a great java
>>>> template engine used widely. I want to use it in clojure with compojure and
>>>> ring framework,so i've created this project---ring.velocity.
>>>>
>>>> Home: https://github.com/killme2008/ring.velocity
>>>> Getting started:
>>>>
>>>>   Adds dependency in leiningen project.clj:
>>>>
>>>>   [ring.velocity "0.1.0-SNAPSHOT"]
>>>>
>>>> Create a directory named templates in your project directory to keep
>>>> all velocity templates.
>>>>
>>>> Create a template templates/test.vm:
>>>>
>>>>   hello,$name,your age is $age.
>>>>
>>>> Use ring.velocity in your namespace:
>>>>
>>>>   (use '[ring.velocity.core :only [render]])
>>>>
>>>> Use render function to render template with vars:
>>>>
>>>>   (render "test.vm" :name "dennis" 29)
>>>>
>>>> The test.vm will be interpreted equals to:
>>>>
>>>>   hello,dennis,your age is 29.
>>>>
>>>> Use ring.velocity in compojure:
>>>>
>>>>   (defroutes app-routes
>>>>      (GET "/" [] (render "test.vm" :name "dennis" :age 29))
>>>>      (route/not-found "Not Found"))
>>>>
>>>> Use ring.velocity in ring:
>>>>
>>>>   (use '[ring.util.response])
>>>>   (response (render "test.vm" :name "dennis" :age 29))
>>>>
>>>> Custom velocity properties,just put a file named
>>>> ring-velocity.properties to your classpath or resource paths.The
>>>> default velocity properties is in 
>>>> src/default/velocity.properties<https://github.com/killme2008/ring.velocity/blob/master/src/default/velocity.properties>
>>>> .
>>>>
>>>> --
>>>> 庄晓丹
>>>> Email:        killme2...@gmail.com xzhu...@avos.com
>>>> Site:           http://fnil.net
>>>> Twitter:      @killme2008
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> 庄晓丹
>>> Email:        killme2...@gmail.com xzhu...@avos.com
>>> Site:           http://fnil.net
>>> Twitter:      @killme2008
>>>
>>>
>>>
>>>
>>
>
>
> --
> 庄晓丹
> Email:        killme2...@gmail.com xzhu...@avos.com
> Site:           http://fnil.net
> Twitter:      @killme2008
>
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to