Navigation Menu

Skip to content

Commit

Permalink
Added index links to each namespace page
Browse files Browse the repository at this point in the history
  • Loading branch information
weavejester committed Oct 31, 2011
1 parent 3d464b6 commit 6841f94
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 deletions.
4 changes: 2 additions & 2 deletions resources/codox/css/default.css
Expand Up @@ -2,11 +2,11 @@ body {
font-family: sans-serif;
}

.publics {
.index {
padding: 0;
}

.publics li {
.index li {
display: inline;
padding: 0 .5em;
}
Expand Down
46 changes: 22 additions & 24 deletions src/codox/writer/html.clj
Expand Up @@ -12,47 +12,45 @@
(defn- var-uri [namespace var]
(str (ns-filename namespace) "#" (:name var)))

(defn html-doc [title & body]
(defn- html-page [title & body]
(html5
[:head
[:title title]
(include-css "css/default.css")]
[:body body]))
[:body
[:h1 title]
body]))

(defn- make-var-links [namespace]
[:ul.index
(for [var (:publics namespace)]
[:li (link-to (var-uri namespace var) (:name var))])])

(defn- make-index [namespaces]
(html5
[:head
[:title "API documentation"]
(include-css "css/default.css")]
[:body
[:h1 "API documentation"]
(for [namespace namespaces]
[:div.namespace
[:h2 (link-to (ns-filename namespace) (:name namespace))]
[:pre.doc (:doc namespace)]
[:ul.publics
(for [var (:publics namespace)]
[:li (link-to (var-uri namespace var) (:name var))])]])]))
(html-page
"API documentation"
(for [namespace namespaces]
[:div.namespace
[:h2 (link-to (ns-filename namespace) (:name namespace))]
[:pre.doc (:doc namespace)]
(make-var-links namespace)])))

(defn- var-usage [var]
(for [arglist (:arglists var)]
(list* (:name var) arglist)))

(defn- make-ns-page [namespace]
(html5
[:head
[:title (:name namespace) " documentation"]
(include-css "css/default.css")]
[:body
[:h1 (:name namespace) " documentation"]
[:pre.doc (:doc namespace)]
(for [var (:publics namespace)]
(html-page
(str (:name namespace) " documentation")
[:pre.doc (:doc namespace)]
(make-var-links namespace)
(for [var (:publics namespace)]
[:div.public {:id (:name var)}
[:h3 (:name var)]
[:div.usage
(for [form (var-usage var)]
[:code (pr-str form)])]
[:pre.doc (:doc var)]])]))
[:pre.doc (:doc var)]])))

(defn- copy-resource [src dest]
(io/copy (io/input-stream (io/resource src))
Expand Down

0 comments on commit 6841f94

Please sign in to comment.