Skip to content

Instantly share code, notes, and snippets.

@lancepantz
Created July 1, 2011 01:12
Show Gist options
  • Save lancepantz/1057673 to your computer and use it in GitHub Desktop.
Save lancepantz/1057673 to your computer and use it in GitHub Desktop.
(defn generate-method-block [heading ns methods]
(let [methods (name methods)]
(html [:p.route-type heading]
(anchor ns methods))))
(defn generate-top
"Generate top-level page."
[ns-prefix suffix]
(let [nss (filter (partial re-find (-> ns-prefix str re-pattern))
(map str (all-ns)))]
(html4
[:head (include-css "/css/docs.css")]
[:body
[:div#ns-body
[:h1#ns-name ns-prefix]
(for [ns nss]
(html
[:h2 [:a {:href (ns-url ns)} ns]]
(let [{read-methods :read write-methods :write} (group-by-method ns suffix)
name (comp seq (partial map extract-name))]
(html (generate-method-block "Write Routes:" ns write-methods)
(generate-method-block "Read Routes:" ns read-methods)))))]])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment