|
18 | 18 | #:registered-subsections
|
19 | 19 | #:register-subsection
|
20 | 20 | #:with-subsection-collector)
|
| 21 | + (:import-from #:40ants-doc/ignored-words |
| 22 | + #:ignore-in-package) |
21 | 23 | (:export #:defautodoc)
|
22 | 24 | (:documentation "This module is not included into asd file because it requires additional dependencies."))
|
23 | 25 | (in-package #:40ants-doc/autodoc)
|
|
120 | 122 |
|
121 | 123 | (defun make-package-section (section-name package &key (ignore-symbol-p 'starts-with-percent-p))
|
122 | 124 | (declare (optimize (debug 3)))
|
123 |
| - (let* ((package-name (package-name package)) |
124 |
| - (title package-name) |
125 |
| - (accessors-and-readers (package-accessors-and-writers package |
126 |
| - :ignore-symbol-p ignore-symbol-p)) |
127 |
| - (entries (loop for symbol being the external-symbols of package |
128 |
| - for should-be-documented = (not (funcall ignore-symbol-p |
129 |
| - symbol)) |
130 |
| - ;; Usual functions |
131 |
| - when (and (fboundp symbol) |
132 |
| - should-be-documented |
133 |
| - (not (macro-function symbol)) |
134 |
| - (not (typep (symbol-function symbol) 'generic-function))) |
135 |
| - collect (list symbol 'function) into functions |
136 |
| - |
137 |
| - ;; Generic functions |
138 |
| - when (and (fboundp symbol) |
139 |
| - should-be-documented |
140 |
| - (typep (symbol-function symbol) 'generic-function) |
141 |
| - (not (member symbol accessors-and-readers |
142 |
| - :test 'eql))) |
143 |
| - collect (list symbol 'generic-function) into generics |
144 |
| - |
145 |
| - ;; Macroses |
146 |
| - when (and (fboundp symbol) |
147 |
| - should-be-documented |
148 |
| - (macro-function symbol)) |
149 |
| - collect (list symbol 'macro) into macros |
150 |
| - |
151 |
| - ;; Classes |
152 |
| - when (and (find-class symbol nil) |
153 |
| - should-be-documented) |
154 |
| - collect (make-class-entry symbol package-name |
155 |
| - :ignore-symbol-p ignore-symbol-p) |
156 |
| - into classes |
157 |
| - |
158 |
| - ;; Variables |
159 |
| - when (and (documentation symbol 'variable) |
160 |
| - should-be-documented) |
161 |
| - collect (list symbol 'variable) into variables |
162 |
| - |
163 |
| - ;; Types and not classes |
164 |
| - when (and (not (find-class symbol nil)) |
165 |
| - should-be-documented |
166 |
| - (or (documentation symbol 'type) |
167 |
| - (not (eq (swank-backend:type-specifier-arglist symbol) |
168 |
| - :not-available)))) |
169 |
| - collect (list symbol 'type) into types |
| 125 | + (flet ((ignore-symbol-p-wrapper (symbol) |
| 126 | + (when (and ignore-symbol-p |
| 127 | + (funcall ignore-symbol-p symbol)) |
| 128 | + (ignore-in-package symbol :package package) |
| 129 | + (values t)))) |
| 130 | + |
| 131 | + (let* ((package-name (package-name package)) |
| 132 | + (title package-name) |
| 133 | + (accessors-and-readers (package-accessors-and-writers package |
| 134 | + :ignore-symbol-p #'ignore-symbol-p-wrapper)) |
| 135 | + (entries (loop for symbol being the external-symbols of package |
| 136 | + for should-be-documented = (not (ignore-symbol-p-wrapper symbol)) |
| 137 | + ;; Usual functions |
| 138 | + when (and (fboundp symbol) |
| 139 | + should-be-documented |
| 140 | + (not (macro-function symbol)) |
| 141 | + (not (typep (symbol-function symbol) 'generic-function))) |
| 142 | + collect (list symbol 'function) into functions |
| 143 | + |
| 144 | + ;; Generic functions |
| 145 | + when (and (fboundp symbol) |
| 146 | + should-be-documented |
| 147 | + (typep (symbol-function symbol) 'generic-function) |
| 148 | + (not (member symbol accessors-and-readers |
| 149 | + :test 'eql))) |
| 150 | + collect (list symbol 'generic-function) into generics |
| 151 | + |
| 152 | + ;; Macroses |
| 153 | + when (and (fboundp symbol) |
| 154 | + should-be-documented |
| 155 | + (macro-function symbol)) |
| 156 | + collect (list symbol 'macro) into macros |
| 157 | + |
| 158 | + ;; Classes |
| 159 | + when (and (find-class symbol nil) |
| 160 | + should-be-documented) |
| 161 | + collect (make-class-entry symbol package-name |
| 162 | + :ignore-symbol-p #'ignore-symbol-p-wrapper) |
| 163 | + into classes |
| 164 | + |
| 165 | + ;; Variables |
| 166 | + when (and (documentation symbol 'variable) |
| 167 | + should-be-documented) |
| 168 | + collect (list symbol 'variable) into variables |
| 169 | + |
| 170 | + ;; Types and not classes |
| 171 | + when (and (not (find-class symbol nil)) |
| 172 | + should-be-documented |
| 173 | + (or (documentation symbol 'type) |
| 174 | + (not (eq (swank-backend:type-specifier-arglist symbol) |
| 175 | + :not-available)))) |
| 176 | + collect (list symbol 'type) into types |
170 | 177 |
|
171 |
| - finally (return |
172 |
| - (uiop:while-collecting (collect) |
173 |
| - (flet ((add-subsection (entries title) |
174 |
| - (let* ((section-name (symbolicate "@" |
175 |
| - package-name |
176 |
| - "?" |
177 |
| - title |
178 |
| - "-SECTION"))) |
179 |
| - (when entries |
180 |
| - (register-subsection |
181 |
| - `(defsection ,section-name (:title ,title |
182 |
| - :package ,package-name) |
183 |
| - ,@(sort (copy-list entries) |
184 |
| - #'string< |
185 |
| - :key #'first))) |
186 |
| - (collect `(,section-name section)))))) |
187 |
| - (add-subsection classes "Classes") |
188 |
| - (add-subsection generics "Generics") |
189 |
| - (add-subsection functions "Functions") |
190 |
| - (add-subsection macros "Macros") |
191 |
| - (add-subsection types "Types") |
192 |
| - (add-subsection variables "Variables"))))))) |
193 |
| - (when entries |
194 |
| - `(defsection ,section-name (:title ,title |
195 |
| - :package ,package-name) |
196 |
| - (,(symbolicate package-name) package) |
197 |
| - ,@entries)))) |
| 178 | + finally (return |
| 179 | + (uiop:while-collecting (collect) |
| 180 | + (flet ((add-subsection (entries title) |
| 181 | + (let* ((section-name (symbolicate "@" |
| 182 | + package-name |
| 183 | + "?" |
| 184 | + title |
| 185 | + "-SECTION"))) |
| 186 | + (when entries |
| 187 | + (register-subsection |
| 188 | + `(defsection ,section-name (:title ,title |
| 189 | + :package ,package-name) |
| 190 | + ,@(sort (copy-list entries) |
| 191 | + #'string< |
| 192 | + :key #'first))) |
| 193 | + (collect `(,section-name section)))))) |
| 194 | + (add-subsection classes "Classes") |
| 195 | + (add-subsection generics "Generics") |
| 196 | + (add-subsection functions "Functions") |
| 197 | + (add-subsection macros "Macros") |
| 198 | + (add-subsection types "Types") |
| 199 | + (add-subsection variables "Variables"))))))) |
| 200 | + (when entries |
| 201 | + `(defsection ,section-name (:title ,title |
| 202 | + :package ,package-name) |
| 203 | + (,(symbolicate package-name) package) |
| 204 | + ,@entries))))) |
198 | 205 |
|
199 | 206 |
|
200 | 207 | (defun make-entries (system &key
|
|
0 commit comments