-
Notifications
You must be signed in to change notification settings - Fork 124
/
generate-docs.pxi
54 lines (45 loc) · 1.51 KB
/
generate-docs.pxi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
(ns pixie.generate-docs
(:require [pixie.io :as io]
[pixie.string :as string]))
(let [[namespace] program-arguments]
(println "==============")
(println (name namespace))
(println "==============")
(load-ns (symbol namespace))
(println)
;;Should be sorting the map
;;Like so: (sort-by first map)
;;However, I'm holding off until sort is properly supported
(doseq [[k v] (ns-map (the-ns namespace))]
(println (name k))
(println "====================================")
(println)
(if-let [m (meta @v)]
(do
;(println m)
(if-let [doc (:doc m)];;
(println doc)
(println "No doc available :("))
(println)
(when-let (examples (:examples m))
(println "**Examples:**")
(doseq [[code _ result] examples]
(println)
(println code)
(println)
(when (not (nil? result))
(println "=> " result)))
(println))
(when-let (signatures (:signatures m))
(println "**Signatures:**")
(println)
(doseq [sig signatures]
(println (str "- " sig)))
(println))
(when (and (:line-number m) (:file m))
(let [file (str "pixie/" (last (string/split (:file m) "/")))]
(println (str "http://github.com/pixie-lang/pixie/blob/master/"
file "#L" (:line-number m))))
(println)))
(println "No meta data available :("))
(println)))