Fixed the namespace doc extraction

This commit is contained in:
fogus 2011-01-18 15:31:01 -05:00
parent b4d55c409c
commit baf5b4ff1e
2 changed files with 12 additions and 17 deletions

View file

@ -1,15 +1,5 @@
(ns marginalia.html
"# Utilities for converting parse results into html.
## Plus a few other goodies.
Here's a random code block (println \"hi!\")
Like I said:
* utils for docs -> html
* other goodies
hello world"
"Utilities for converting parse results into html."
(:use [hiccup.core :only (html escape-html)]
[hiccup.page-helpers :only (doctype)])
(:require [clojure.string :as str])
@ -60,7 +50,7 @@
(defn md
"Markdown string to html converter. Translates strings like \"# header!\"
-> \"<h1>header!</h1>"
-> `\"<h1>header!</h1>\"`"
[s]
(.markdown mdp s))
@ -99,7 +89,7 @@
outlined above.
ex. `(docs-to-html [{:doc-text \"#hello world!\"} {:docstring-text \"I'm a docstring!}])
-> \"<h1>hello world!</h1><br />\"`
-> `\"<h1>hello world!</h1><br />\"`
"
[docs]
(-> docs

View file

@ -75,6 +75,15 @@
(strip-docstring docstring raw)
(if nspace sym nspace-sym)])))
(defmethod dispatch-form 'ns
[form raw nspace-sym]
(let [[ds r s] (extract-common-docstring form raw nspace-sym)]
(let [ds (nth form 2)
ds (when (string? ds) ds)]
[ds
(strip-docstring ds r)
s])))
(defmethod dispatch-form 'def
[form raw nspace-sym]
(extract-common-docstring form raw nspace-sym))
@ -83,10 +92,6 @@
[form raw nspace-sym]
(extract-common-docstring form raw nspace-sym))
(defmethod dispatch-form 'ns
[form raw nspace-sym]
(extract-common-docstring form raw nspace-sym))
(defmethod dispatch-form 'defprotocol
[form raw nspace-sym]
;; this needs some work to extract embedded docstrings