Skip to content
Browse files

Clean up README.

  • Loading branch information...
1 parent 6d71e46 commit 049319598b01585b97c5e4ecfbb46202bb14ab32 @mmcgrana mmcgrana committed Dec 25, 2009
Showing with 8 additions and 15 deletions.
  1. +8 −15 README.markdown → README.md
View
23 README.markdown → README.md
@@ -1,9 +1,4 @@
-`clj-html` is a Clojure library for fast and expressive HTML templates
-
-Overview
---------
-
-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/).
+`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/).
Examples
--------
@@ -18,9 +13,8 @@ A simple template:
(.append html-builder "<body><div id=\"content\">Hello World</div></body>")
(.toString html-builder))
- ;evaluates to:
+ ; evaluates to:
"<body><div id=\"content\">Hello World</div></body>"
- </code></pre>
A template with non-literal values:
@@ -44,7 +38,6 @@ A template with non-literal values:
<h1 class=\"greeting\">Hello</h1> \
<p class=\"message\">from clj-html</p> \
</div></body>"
- </code></pre>
A more involved template:
@@ -63,19 +56,19 @@ A more involved template:
Details - Core
--------------
-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:
+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:
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.
-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`).
+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`).
-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.
+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.
The remaining values in the tag vector are considered the inner content of the tag and are expanded recursively.
If no inner forms are given (`[:br]`]) then the tag that is created is self-closing (`<br />`). Otherwise a wrapping tag is created.
-`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.
+`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).
Details - Utils
---------------
@@ -103,7 +96,7 @@ The macro `domap-str` is useful for rendering an inline snippet for each element
[:p.name (:name person)]
[:p.city (:city person)]]))])
-Also included are several methods of the form `*-html*`. These are designed to reduce the need for eg:
+Also included are several methods of the form `*-html`. These are designed to reduce the need for eg:
(html
[:div
@@ -119,7 +112,7 @@ Also included are several methods of the form `*-html*`. These are designed to r
Currently we have `if-html`, `when-html`, `when-let-html`, and `for-html`.
-Finally, you can use `defhtml` to define methods that are html templates without needing to include the outer @html@ manually:
+Finally, you can use `defhtml` to define methods that are html templates without needing to include the outer `html` manually:
(defhtml message [text]
[:div#message

0 comments on commit 0493195

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