Improve formatting

This commit is contained in:
oakes
2014-03-30 21:48:55 -04:00
parent 1891ca3463
commit 58828802e9
2 changed files with 27 additions and 16 deletions

View File

@@ -1,18 +1,36 @@
(ns play-clj-doclet.html
(:require [hiccup.core :refer :all]))
(:require [clojure.string :as string]
[hiccup.core :refer :all]))
(defn create-item
(defn camel->keyword
[s]
(->> (string/split (string/replace s "_" "-") #"(?<=[a-z])(?=[A-Z])")
(map string/lower-case)
(string/join "-")
keyword))
(defn param
[[type-name param-name]]
(html [:span {}
[:span {:class "type-name"} "^" type-name]
" "
(-> param-name camel->keyword name)]))
(defn item
[[name text params]]
[:div
[:h3 (str name)]
[:p
[:b (str name)]
" "
(string/join ", " (map param params))]
[:i text]])
(defn create-section
(defn section
[[clj-name items]]
[:div
[:h2 {} clj-name]
(map create-item items)])
(map item (sort-by first items))])
(defn create-html
(defn create
[doc-map]
(html (map create-section doc-map)))
(html (map section doc-map)))