update to work with documentation and add 'cake plugin namespaces' to header

This commit is contained in:
ninjudd 2010-12-23 02:42:50 +08:00 committed by Fogus
parent bacca1876f
commit c3a64b9bfa
3 changed files with 22 additions and 3 deletions

View file

@ -127,15 +127,20 @@
;; current line start with a quote?
(and (re-find #"\(defn" last-code-text)
(re-find #"^\"" (str/trim (str line))))
;; Is the last line's code-text a deftask, and does the
;; current line start with a quote?
(and (re-find #"\(deftask" last-code-text)
(re-find #"^\"" (str/trim (str line))))
;; Is the last line's code-text the start of a ns
;; decl, and does the current line start with a quote?
(and (re-find #"\(ns" last-code-text)
(re-find #"^\"" (str/trim (str line))))
;; Is the prev line a docstring line, the current line _not_
;; start with a ( or [, and the current line not an empty string?
;; start with a ( or [ or {, and the current line not an empty string?
(and (:docstring-text l)
(not (re-find #"^\(" (str/trim (str line))))
(not (re-find #"^\[" (str/trim (str line))))
(not (re-find #"^\{" (str/trim (str line))))
(not= "" (str/trim (str line))))
;; Is the prev line a docstring, the prev line not end with a quote,
;; and the current line not an empty string?

View file

@ -135,6 +135,13 @@
[:td {:class "dep-version"} (second %)]])
deps)]])))
(defn cake-plugins-html [tasks]
(when tasks
(html [:div {:class "plugins"}
[:h3 "cake plugin namespaces"]
[:ul
(map #(vector :li %) tasks)]])))
;; Is <h1/> overloaded? Maybe we should consider redistributing
;; header numbers instead of adding classes to all the h1 tags.
(defn header-html [project-info]
@ -147,7 +154,8 @@
[:br]
(md (:description project-info))]
(dependencies-html (:dependencies project-info))
(dependencies-html (:dev-dependencies project-info) "dev dependencies")]
(dependencies-html (:dev-dependencies project-info) "dev dependencies")
(cake-plugins-html (:tasks project-info))]
[:td {:class "codes"
:style "text-align: center; vertical-align: middle;color: #666;padding-right:20px"}
[:br]
@ -244,6 +252,12 @@
:border-right "none"
:margin-bottom "-6px"}]
[:.dependencies :.dep-version {:text-align "right"}]
[:.plugins :ul {:margin-left "20px"
:padding-left "0px"
:padding-top 0
:margin-top 0}]
[:.plugins :li {:list-style-type "none"
:padding-left 0}]
[:.header :p {:margin-left "20px"}]))
(def floating-toc-css

View file

@ -10,6 +10,6 @@
(deftask marg
"Run marginalia against your project code."
"Optionally, you can pass a file or directories to control what documentation is generated and in what order."
"Optionally, you can pass files or directories to control what documentation is generated and in what order."
{files :marg}
(run-marginalia files))