Improve formatting
This commit is contained in:
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user