From ee68f253ac8732a47e39a8fd50c256b5076f1008 Mon Sep 17 00:00:00 2001 From: fogus Date: Tue, 25 Jan 2011 11:21:18 -0500 Subject: [PATCH] cleaning up some of the docs --- src/marginalia/core.clj | 4 ---- src/marginalia/html.clj | 22 +++++++++++++++------- src/marginalia/parser.clj | 8 +++++++- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/marginalia/core.clj b/src/marginalia/core.clj index 2e13cab..33fd870 100644 --- a/src/marginalia/core.clj +++ b/src/marginalia/core.clj @@ -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 diff --git a/src/marginalia/html.clj b/src/marginalia/html.clj index 9dab2f3..108f1f8 100644 --- a/src/marginalia/html.clj +++ b/src/marginalia/html.clj @@ -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!\" - -> `\"

header!

\"`" + "Markdown string to html converter. Translates strings like: + + \"# header!\" -> `\"

header!

\"` + + \"## header!\" -> `\"

header!

\"` + + ..." [s] (.markdown mdp s)) @@ -58,13 +64,14 @@ "Inserts super-fancy characters into the doc section." [s] (-> s - (str/replace #"->" "→") + (str/replace #"->" "→") (str/replace #""" "\""))) ;; 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\")"}]}] +;;
[...
+;; {:docs [{:docs-text "Some doc text"}]
+;;  :codes [{:code-text "(def something \"hi\")"}]}
+;; ...]
;; ;; `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!}]) + -> `\"

hello world!


\"` " [docs] diff --git a/src/marginalia/parser.clj b/src/marginalia/parser.clj index 7db73e9..d3329f6 100644 --- a/src/marginalia/parser.clj +++ b/src/marginalia/parser.clj @@ -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*\)" ")")))