Clojure 模板引擎 mustache.clj

码农软件 · 软件分类 · 模板引擎 · 2019-08-23 21:43:38

软件介绍

mustache.clj 是一个mustache模板的Clojure实现。 在开发Rssminer时,因需要一个更快更轻巧的模板库,而开发。

特点:

  1. 零依赖,小巧。包含源代码的jar仅16K
  2. 速度快。在i5机器上,一个测试中,每秒可生成约300M的HTML 
  3. 通过Macro,完成模板到函数的转化,使用简单

示例代码:

(deftemplate template (slurp "test/sample.tpl"))

(def data {:title "mustache.clj"
           :desc "Logic-less {{mustache}} templates for Clojure"
           :tags [{:tag "Clojure"}
                  {:tag "Mustache"}
                  {:tag "Performance"}]})

(println (template data))

<!-- 模板 test/sample.tpl -->
<h1>{{ title }}</h1>
<p class="desc">{{ desc }}</p>
<ul>
  {{#tags}}
    <li class="tag">{{ tag }}</li>{{/tags}}
  {{# hidden }}
    this will not show, if hidden is false or empty list
  {{/ hidden }}
</ul>
输出:
<h1>mustache.clj</h1>
<p class="desc">Logic-less {{mustache}} templates for Clojure</p>
<ul>
    <li class="tag">Clojure</li>
    <li class="tag">Mustache</li>
    <li class="tag">Performance</li>
</ul>

本文地址:https://codercto.com/soft/d/13027.html

百度SEM竞价推广

百度SEM竞价推广

马明泽 / 电子工业出版社 / 2017-5 / 59

竞价推广已成为企业昀主要的网络营销方式,《百度SEM竞价推广:策略、方法、技巧与实战》以百度竞价推广为基础,全面阐述了整个竞价推广过程中的重要环节,涉及大量账户操作实战技巧,以及解决各类难点的方法,其中包括搜索引擎营销基础、百度搜索推广介绍、账户结构搭建技巧、关键词与创意的使用技巧、质量度优化与提升、账户工具的使用、百度推广客户端的使用、企业搜索推广方案制作、百度网盟推广、着陆页分析、效果优化与数......一起来看看 《百度SEM竞价推广》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具