Hi folks,

I've spun off some functionality of the Compojure web framework into
two standalone libraries, Clout and Hiccup.

Clout is a HTTP routing library. It uses a similar style to the routes
in Ruby web frameworks like Rails and Sinatra, and is based off the
compojure.http.routes code. However, I've expanded the functionality
to allow keywords to be bound to arbitrary regular expressions:

  (route-compile "/user/:id" {:id #"\d+"})

More information and examples can be found on the GitHub page:
http://github.com/weavejester/clout

Hiccup is a HTML generation library, like clj-html. It's based off the
code in compojure.html, but I've improved its performance and tidied
things up a little. It comes with helper functions for generating
things like doctypes and forms:

  (doctype :html4)

  (form-to [:post "/bookmarks"]
    (label :url "URL")
      (text-field :url)
    (submit-button "Add"))

Hiccup also watches out for HTML tags that require explicit closing
tags (like <script>), and handles nil and boolean attributes
intelligently:

  user=> (html [:input {:type "checkbox", :name :example, :checked
true, :value nil}])
  "<input checked=\"checked\" name=\"example\" type=\"checkbox\" />"

Hiccup also expands seqs into the body of the tag, allowing the 'for'
macro to be used for iteraction:

  [:ul
    (for [x items]
      [:li x]))

Hiccup and Clout are still in development, but they are pretty much as
complete now as the equivalent libraries in Compojure. I'll be looking
to use Clout and Hiccup as dependencies for Compojure in future, but
these will be, in effect, completely independent libraries that can be
used in any Clojure web framework.

- James

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to