cleaning up some of the docs

This commit is contained in:
fogus 2011-01-25 11:21:18 -05:00
parent d65715b7a6
commit ee68f253ac
3 changed files with 22 additions and 12 deletions

View file

@ -84,10 +84,6 @@
;; ## Project Info Parsing
;; Marginalia will parse info out of your project.clj to display in
;; the generated html file's header.
;;
;; ![TODO](http://images.fogus.me/badges/todo.png "POM") add pom.xml support.
(defn parse-project-file

View file

@ -16,6 +16,7 @@
"Quick and dirty dsl for inline css rules, similar to hiccup.
ex. `(css [:h1 {:color \"blue\"}] [:div.content p {:text-indent \"1em\"}])`
-> `h1 {color: blue;} div.content p {text-indent: 1em;}`"
[& rules]
(html [:style {:type "text/css"}
@ -49,8 +50,13 @@
(def mdp (com.petebevin.markdown.MarkdownProcessor.))
(defn md
"Markdown string to html converter. Translates strings like \"# header!\"
-> `\"<h1>header!</h1>\"`"
"Markdown string to html converter. Translates strings like:
\"# header!\" -> `\"<h1>header!</h1>\"`
\"## header!\" -> `\"<h2>header!</h2>\"`
..."
[s]
(.markdown mdp s))
@ -58,13 +64,14 @@
"Inserts super-fancy characters into the doc section."
[s]
(-> s
(str/replace #"-&gt;" "&rarr;")
(str/replace #"->" "&rarr;")
(str/replace #"&quot;" "\"")))
;; As a result of docifying then grouping, you'll end up with a seq like this one:
;;
;; [{:docs [{:docs-text "Some doc text"}]
;; :codes [{:code-text "(def something \"hi\")"}]}]
;; <pre><code>[...
;; {:docs [{:docs-text "Some doc text"}]
;; :codes [{:code-text "(def something \"hi\")"}]}
;; ...]</code></pre>
;;
;; `docs-to-html` and `codes-to-html` convert their respective entries into html,
;; and `group-to-html` calls them on each seq item to do so.
@ -88,7 +95,8 @@
"Converts a docs section to html by threading each doc line through the forms
outlined above.
ex. `(docs-to-html [{:doc-text \"#hello world!\"} {:docstring-text \"I'm a docstring!}])
ex. (docs-to-html [{:doc-text \"# hello world!\"} {:docstring-text \"I'm a docstring!}])
-> `\"<h1>hello world!</h1><br />\"`
"
[docs]

View file

@ -71,7 +71,13 @@
(defn strip-docstring [docstring raw]
(-> raw
(replace (str \" docstring \") "")
(replace (str \" (-> docstring
str
(replace "\"" "\\\"")
;; (replace "\\" "")
)
\")
"")
(replace #"\n\s*\n" "\n")
(replace #"\n\s*\)" ")")))