资源说明:Fast library for rendering HTML in Clojure
# Hiccup [![Build Status](https://travis-ci.org/weavejester/hiccup.svg?branch=master)](https://travis-ci.org/weavejester/hiccup) Hiccup is a library for representing HTML in Clojure. It uses vectors to represent elements, and maps to represent an element's attributes. ## Install Add the following dependency to your `project.clj` file: [hiccup "1.0.5"] ## Documentation * [Wiki](https://github.com/weavejester/hiccup/wiki) * [API Docs](http://weavejester.github.io/hiccup) ## Syntax Here is a basic example of Hiccup syntax: ```clojure user=> (use 'hiccup.core) nil user=> (html [:span {:class "foo"} "bar"]) "bar" ``` The first element of the vector is used as the element name. The second attribute can optionally be a map, in which case it is used to supply the element's attributes. Every other element is considered part of the tag's body. Hiccup is intelligent enough to render different HTML elements in different ways, in order to accommodate browser quirks: ```clojure user=> (html [:script]) "" user=> (html [:p]) "" ``` And provides a CSS-like shortcut for denoting `id` and `class` attributes: ```clojure user=> (html [:div#foo.bar.baz "bang"]) " " ``` If the body of the element is a seq, its contents will be expanded out into the element body. This makes working with forms like `map` and `for` more convenient: ```clojure user=> (html [:ul (for [x (range 1 4)] [:li x])]) "
- 1
- 2
- 3
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。