forked from cbaggers/rtg-math
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstaple.ext.lisp
74 lines (66 loc) · 2.39 KB
/
staple.ext.lisp
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
;;------------------------------------------------------------
(defvar *documented-packages*
'(:rtg-math.vector2
:rtg-math.vector3
:rtg-math.vector4
:rtg-math.vector2.non-consing
:rtg-math.vector3.non-consing
:rtg-math.vector4.non-consing
:rtg-math.vectors
:rtg-math.matrix2
:rtg-math.matrix3
:rtg-math.matrix4
:rtg-math.matrix2.non-consing
:rtg-math.matrix3.non-consing
:rtg-math.matrix4.non-consing
:rtg-math.matrices
:rtg-math.quaternions
:rtg-math.quaternions.non-consing
:rtg-math.polar
:rtg-math.spherical
:rtg-math.projection
:rtg-math.projection.non-consing
:rtg-math.region.line3
:rtg-math.region.ray3
:rtg-math.region.line-segment3
:rtg-math.region.axis-aligned-box.non-consing
:rtg-math.region.axis-aligned-box
:rtg-math.region
:rtg-math
:rtg-math.types))
(defmethod staple:system-options append
((system (eql (asdf:find-system :rtg-math))))
(list :name "RTG-MATH"
:template (asdf:system-relative-pathname
:varjo "docs/staple/template.ctml")
:documentation (asdf:system-relative-pathname
:rtg-math "docs/header.md")
:packages *documented-packages*
:out (asdf:system-relative-pathname
:rtg-math "docs/rtg-math-reference.html")
:if-exists :supersede))
(defmethod staple:render-docstring
(string (system (eql (asdf:find-system :rtg-math))))
(typecase string
(string (staple:render-docstring-markdown string))
(null (plump:parse "<i>No docstring provided.</i>"))))
;;------------------------------------------------------------
(defclass rtg-func (staple:symb-function)
((args :initform nil :initarg :args)))
(defmethod staple:symb-type ((f rtg-func))
(declare (ignore f))
"function")
(staple:define-converter rtg-func (symbol package)
(let ((name (symbol-name symbol))
(pname (package-name package)))
(when (and (staple:symbol-function-p symbol)
(find pname
*documented-packages*
:test #'string=)
(eq (nth-value 1 (find-symbol name package))
:external))
(list (make-instance 'rtg-func :symbol symbol)))))
(defmethod staple:symb-arguments ((symb rtg-func))
(let ((symbol (staple:symb-symbol symb)))
(or (first (gethash symbol %rtg-math::*signatures*))
(call-next-method))))