:莊周夢蝶

生活、程序、未來
   :: 首頁 ::  ::  :: 聚合  :: 管理

Ring.velocity:render velocity templates for ring in clojure

Posted on 2012-07-18 00:07 dennis 閱讀(9255) 評論(0)  編輯  收藏 所屬分類: my open-source 、Clojure

Home: https://github.com/killme2008/ring.velocity

棒球比分大小怎么算 www.355548.live A Clojure library designed to render velocity template for ring in clojure.

Usage

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" :age 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.

License

Copyright © 2012 dennis zhuang[killme2008@gmail.com]

Distributed under the Eclipse Public License, the same as Clojure.

Home: https://github.com/killme2008/ring.velocity

{ganrao} 捕鱼达人1安卓单机版 飞鱼体彩如何看规律 熊猫棋牌游戏下载 pk10冠军四码规律破解 三肖期期中免费公开 海王捕鱼官网 兴动棋牌哈尔滨麻将 申城棋牌正宗 网络做什么赚钱 捕鱼达人3最早的版本 闲来陕西麻将 秒速*赛车网址 单双中特资料 南京麻将50算法 中超联赛赛程表 大地棋牌怎么玩