Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type definitions now supported by 40ANTS-DOC/AUTODOC:DEFAUTODOC macro. #56

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions full/locatives/type.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,33 @@
(cons locative-type locative-args)))
(arglist (swank-backend:type-specifier-arglist symbol))
(docstring (40ants-doc/docstring:get-docstring symbol 'type))
(children (when docstring
(40ants-doc-full/commondoc/markdown:parse-markdown docstring))))
(docstring-children
(when docstring
(40ants-doc-full/commondoc/markdown:parse-markdown docstring)))
(type-expansion
#+sbcl
(multiple-value-bind (expansion ok)
(handler-case (sb-ext:typexpand-1 symbol)
(serious-condition ()
(values nil nil)))
(when ok
expansion))
#-sbcl
nil)
(expansion-children
(when type-expansion
(40ants-doc-full/commondoc/markdown:parse-markdown
(with-output-to-string (s)
(format s "```
~S
```"
type-expansion))))))

(40ants-doc-full/commondoc/bullet:make-bullet reference
:arglist arglist
:children children
:children (remove nil
(list docstring-children
expansion-children))
:ignore-words symbol)))


Expand Down
9 changes: 9 additions & 0 deletions src/autodoc.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#:section
#:defsection)
(:import-from #:str)
(:import-from #:swank-backend)
(:import-from #:alexandria
#:symbolicate)
(:import-from #:40ants-doc/locatives
Expand Down Expand Up @@ -144,6 +145,13 @@
when (documentation symbol 'variable)
collect (list symbol 'variable) into variables

;; Types and not classes
when (and (not (find-class symbol nil))
(or (documentation symbol 'type)
(not (eq (swank-backend:type-specifier-arglist symbol)
:not-available))))
collect (list symbol 'type) into types

finally (return
(uiop:while-collecting (collect)
(flet ((add-subsection (entries title)
Expand All @@ -164,6 +172,7 @@
(add-subsection generics "Generics")
(add-subsection functions "Functions")
(add-subsection macros "Macros")
(add-subsection types "Types")
(add-subsection variables "Variables")))))))
(when entries
`(defsection ,section-name (:title ,title
Expand Down
4 changes: 4 additions & 0 deletions src/changelog.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"CSS"
"SLY"
"API"
"SBCL"
"COMMONDOC:SECTION"
"COLLECT-REACHABLE-OBJECTS"
"LOCATE-AND-COLLECT-REACHABLE-OBJECTS"
Expand All @@ -153,6 +154,9 @@
"CLEAN-URLS"
;; These objects are not documented yet:
"40ANTS-DOC/COMMONDOC/XREF:XREF"))
(0.20.0 2024-12-14
"* Type definitions now supported by 40ANTS-DOC/AUTODOC:DEFAUTODOC macro.
* Type expansion is shown for type definitions when building doc on SBCL.")
(0.19.0 2024-12-13
"* Argument IGNORE-PACKAGES was added to 40ANTS-DOC/AUTODOC:DEFAUTODOC macro.
It can be used to exclude some packages from autogenerated docs.
Expand Down
Loading