Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Clean up README.

  • Loading branch information...
commit 049319598b01585b97c5e4ecfbb46202bb14ab32 1 parent 6d71e46
Mark McGranaghan mmcgrana authored

Showing 1 changed file with 8 additions and 15 deletions. Show diff stats Hide diff stats

  1. +8 15 README.markdown → README.md
23 README.markdown → README.md
Source Rendered
... ... @@ -1,9 +1,4 @@
1   -`clj-html` is a Clojure library for fast and expressive HTML templates
2   -
3   -Overview
4   ---------
5   -
6   -A Clojure library for expanding expressive markup templates into efficient code, drawing on the functional interface and markup syntax of [compojure's html library](http://github.com/weavejester/compojure/tree/master) and the compilation approach of [cl-who](http://www.weitz.de/cl-who/).
  1 +`clj-html` is a Clojure library for expanding expressive markup templates into efficient code, drawing on the functional interface and markup syntax of [compojure's html library](http://github.com/weavejester/compojure/tree/master) and the compilation approach of [cl-who](http://www.weitz.de/cl-who/).
7 2
8 3 Examples
9 4 --------
@@ -18,9 +13,8 @@ A simple template:
18 13 (.append html-builder "<body><div id=\"content\">Hello World</div></body>")
19 14 (.toString html-builder))
20 15
21   - ;evaluates to:
  16 + ; evaluates to:
22 17 "<body><div id=\"content\">Hello World</div></body>"
23   - </code></pre>
24 18
25 19 A template with non-literal values:
26 20
@@ -44,7 +38,6 @@ A template with non-literal values:
44 38 <h1 class=\"greeting\">Hello</h1> \
45 39 <p class=\"message\">from clj-html</p> \
46 40 </div></body>"
47   - </code></pre>
48 41
49 42 A more involved template:
50 43
@@ -63,19 +56,19 @@ A more involved template:
63 56 Details - Core
64 57 --------------
65 58
66   -The primary entry point into the `clj-html.core` library is the macro `html`, which expands into code that will render the given template, returning a string. @html@ accepts a vararg list of forms,each of which will be expanded according to the following rules:
  59 +The primary entry point into the `clj-html.core` library is the macro `html`, which expands into code that will render the given template, returning a string. `html` accepts a vararg list of forms, each of which will be expanded according to the following rules:
67 60
68 61 Any atom (string, number, etc.) or list (code) will be evaluated as-is. If it logically false then nothing is added to the html, otherwise the result is coerced to a string and added to the html output.
69 62
70   -A vector with a keyword as its first element will be treated as markup tag syntax. A tag can use CSS syntax to declare id and/or classes (`:div#myid.myclass`).
  63 +A vector with a keyword as its first element will be treated as markup tag syntax. A tag can use CSS syntax to declare an id and/or classes (`:div#myid.myclass`).
71 64
72   -The second element in the vector is an optional literal map of additional attributes to add to the tag (`[:link {:rel "stylesheet" :href "style.css"}]`). The keys must be literal keywords, though the values can be either literal values or expressions to be computed during evaluation. If the value for a key is logically false, no text is added for that key/value pair. If the value is equal to @true@ then the `"attrname=\"attrname\""` convention is used.
  65 +The second element in the vector is an optional literal map of additional attributes to add to the tag (`[:link {:rel "stylesheet" :href "style.css"}]`). The keys must be literal keywords, though the values can be either literal values or expressions to be computed during evaluation. If the value for a key is logically false, no text is added for that key/value pair. If the value is equal to `true` then the `"attrname=\"attrname\""` convention is used.
73 66
74 67 The remaining values in the tag vector are considered the inner content of the tag and are expanded recursively.
75 68
76 69 If no inner forms are given (`[:br]`]) then the tag that is created is self-closing (`<br />`). Otherwise a wrapping tag is created.
77 70
78   -`clj-html.core` also includes the `htmli`, accepts very similar arguments to `html` but operates as an interpreter instead of a compiler. For a discussion of the tradeoffs between these two, see "this Gist":http://gist.github.com/45136.
  71 +`clj-html.core` also includes the `htmli`, accepts very similar arguments to `html` but operates as an interpreter instead of a compiler. For a discussion of the tradeoffs between these two, see [this Gist](http://gist.github.com/45136).
79 72
80 73 Details - Utils
81 74 ---------------
@@ -103,7 +96,7 @@ The macro `domap-str` is useful for rendering an inline snippet for each element
103 96 [:p.name (:name person)]
104 97 [:p.city (:city person)]]))])
105 98
106   -Also included are several methods of the form `*-html*`. These are designed to reduce the need for eg:
  99 +Also included are several methods of the form `*-html`. These are designed to reduce the need for eg:
107 100
108 101 (html
109 102 [:div
@@ -119,7 +112,7 @@ Also included are several methods of the form `*-html*`. These are designed to r
119 112
120 113 Currently we have `if-html`, `when-html`, `when-let-html`, and `for-html`.
121 114
122   -Finally, you can use `defhtml` to define methods that are html templates without needing to include the outer @html@ manually:
  115 +Finally, you can use `defhtml` to define methods that are html templates without needing to include the outer `html` manually:
123 116
124 117 (defhtml message [text]
125 118 [:div#message

0 comments on commit 0493195

Please sign in to comment.
Something went wrong with that request. Please try again.