Refactor and improve how fields are displayed

This commit is contained in:
oakes
2014-03-31 01:01:06 -04:00
parent adfdb9bc95
commit 499ecf3fc7
2 changed files with 34 additions and 25 deletions

View File

@@ -2,35 +2,28 @@
(:require [clojure.string :as string]
[hiccup.core :refer :all]))
(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)]))
param-name]))
(defn item
[[name text params]]
[{:keys [name text args]}]
[:div
[:p
[:b (str name)]
" "
(string/join ", " (map param params))]
(when (> (count text) 0)
[:i text])])
(string/join ", " (map param args))]
(when text [:i text])])
(defn create-from-file
[parsed-file]
(for [group (:groups parsed-file)]
[:div
[:h1 {} (:name group)]
(:docstring group)
(for [[name items] (:java group)]
[:div
(when (not= (:name group) name)