diff --git a/README.md b/README.md index 512f3ba..a311157 100644 --- a/README.md +++ b/README.md @@ -198,11 +198,19 @@ choose which. +<<<<<<< Updated upstream ## [class](0d91) `foo-random:foo-random-state` () ## [reader](d52a) `foo-random:state` (foo-random-state) () +======= +## [class](22c8) `foo-random:foo-random-state` () + + + +## [reader](c525) `foo-random:state` (foo-random-state) () +>>>>>>> Stashed changes Returns random foo's state. @@ -210,24 +218,40 @@ Hey we can also print states! +<<<<<<< Updated upstream ## [method](501f) `common-lisp:print-object` (object foo-random-state) stream ## [variable](ab78) `foo-random:*foo-state*` # +======= +## [method](37d4) `common-lisp:print-object` (object foo-random-state) stream + + + +## [variable](deae) `foo-random:*foo-state*` # +>>>>>>> Stashed changes Much like `*RANDOM-STATE*` but uses the `FOO` algorithm. +<<<<<<< Updated upstream ## [function](1bb1) `foo-random:gaussian-random` stddev &key (random-state \*foo-state\*) +======= +## [function](d75d) `foo-random:gaussian-random` stddev &key (random-state \*foo-state\*) +>>>>>>> Stashed changes Return not a random number from a zero mean normal distribution with `STDDEV`. +<<<<<<< Updated upstream ## [function](3d30) `foo-random:uniform-random` limit &key (random-state \*foo-state\*) +======= +## [function](4cc7) `foo-random:uniform-random` limit &key (random-state \*foo-state\*) +>>>>>>> Stashed changes Return a random number from the between 0 and `LIMIT` (exclusive) uniform distribution. @@ -250,12 +274,21 @@ with `FOO`: ``` [2133]: #x-28FOO-RANDOM-3A-2AFOO-STATE-2A-20-28VARIABLE-29-29 +<<<<<<< Updated upstream [0d91]: https://github.com/40ants/doc/blob/165e8162ca653039e2eb3de1ffa9f28603690678/full/tutorial.lisp#L35 [d52a]: https://github.com/40ants/doc/blob/165e8162ca653039e2eb3de1ffa9f28603690678/full/tutorial.lisp#L36 [501f]: https://github.com/40ants/doc/blob/165e8162ca653039e2eb3de1ffa9f28603690678/full/tutorial.lisp#L39 [ab78]: https://github.com/40ants/doc/blob/165e8162ca653039e2eb3de1ffa9f28603690678/full/tutorial.lisp#L42 [3d30]: https://github.com/40ants/doc/blob/165e8162ca653039e2eb3de1ffa9f28603690678/full/tutorial.lisp#L45 [1bb1]: https://github.com/40ants/doc/blob/165e8162ca653039e2eb3de1ffa9f28603690678/full/tutorial.lisp#L51 +======= +[22c8]: https://github.com/40ants/doc/blob/d6edb93b94c97783e13efa1e39f3b0d0d76cf747/full/tutorial.lisp#L35 +[c525]: https://github.com/40ants/doc/blob/d6edb93b94c97783e13efa1e39f3b0d0d76cf747/full/tutorial.lisp#L36 +[37d4]: https://github.com/40ants/doc/blob/d6edb93b94c97783e13efa1e39f3b0d0d76cf747/full/tutorial.lisp#L39 +[deae]: https://github.com/40ants/doc/blob/d6edb93b94c97783e13efa1e39f3b0d0d76cf747/full/tutorial.lisp#L42 +[4cc7]: https://github.com/40ants/doc/blob/d6edb93b94c97783e13efa1e39f3b0d0d76cf747/full/tutorial.lisp#L45 +[d75d]: https://github.com/40ants/doc/blob/d6edb93b94c97783e13efa1e39f3b0d0d76cf747/full/tutorial.lisp#L51 +>>>>>>> Stashed changes ```` `MGL-PAX` supported the plain text format which was more readble when viewed from a simple text editor, but I've dropped support for plain text in this fork diff --git a/full/commondoc/page.lisp b/full/commondoc/page.lisp index 6f8856d..0ad4115 100644 --- a/full/commondoc/page.lisp +++ b/full/commondoc/page.lisp @@ -227,9 +227,9 @@ var DOCUMENTATION_OPTIONS = { node) (documented-p (symbol) (member symbol references-symbols))) - + (40ants-doc-full/commondoc/mapper:map-nodes node #'collect-packages) - + ;; This blocks extends PACKAGES list with all other ;; package-inferred packages for the system (when *warn-on-undocumented-packages* (loop with primary-names = nil @@ -260,17 +260,16 @@ var DOCUMENTATION_OPTIONS = { '40ants-doc:section))) (push symbol (gethash package undocumented-symbols)))) finally (unless (zerop (hash-table-count undocumented-symbols)) - (warn - (with-output-to-string (s) - (format s "These symbols are external, but not documented:") - (loop for package being the hash-key of undocumented-symbols - using (hash-value symbols) - do (format s "~2& ~A:" - (package-name package)) - (loop for symbol in (sort symbols #'string< - :key #'symbol-name) - do (format s "~& - ~A" - symbol))))))))) + (warn "These symbols are external, but not documented:~%~A" + (with-output-to-string (s) + (loop for package being the hash-key of undocumented-symbols + using (hash-value symbols) + do (format s "~2& ~A:" + (package-name package)) + (loop for symbol in (sort symbols #'string< + :key #'symbol-name) + do (format s "~& - ~A" + symbol))))))))) node) (defun warn-on-references-to-internals (document) diff --git a/src/autodoc.lisp b/src/autodoc.lisp index 7dd9296..40dddde 100644 --- a/src/autodoc.lisp +++ b/src/autodoc.lisp @@ -23,14 +23,17 @@ (in-package #:40ants-doc/autodoc) -(defun class-readers-and-accessors (class-name) +(defun class-readers-and-accessors (class-name &key (ignore-symbol-p 'starts-with-percent-p)) (let* ((class (find-class class-name)) (slots (class-direct-slots class))) (loop for slot in slots - for readers = (slot-definition-readers slot) - for writers = (slot-definition-writers slot) + for readers = (remove-if ignore-symbol-p + (slot-definition-readers slot)) + for writers = (remove-if ignore-symbol-p + (mapcar #'second + (slot-definition-writers slot))) append readers into all-readers - append (mapcar #'second writers) into all-writers + append writers into all-writers finally (return (values (sort all-readers #'string<) (sort all-writers @@ -49,12 +52,13 @@ :key #'package-name)))) -(defun package-accessors-and-writers (package) +(defun package-accessors-and-writers (package &key (ignore-symbol-p 'starts-with-percent-p)) (loop with result = nil for symbol being the external-symbols of package when (find-class symbol nil) do (multiple-value-bind (readers accessors) - (class-readers-and-accessors symbol) + (class-readers-and-accessors symbol + :ignore-symbol-p ignore-symbol-p) (setf result (nunion result (nunion readers accessors)))) @@ -78,12 +82,13 @@ ;; collect `(,accessor (accessor ,class-name)))))) -(defun make-class-entry (class-name package-name) +(defun make-class-entry (class-name package-name &key (ignore-symbol-p 'starts-with-percent-p)) (check-type class-name symbol) (check-type package-name string) (multiple-value-bind (readers accessors) - (class-readers-and-accessors class-name) + (class-readers-and-accessors class-name + :ignore-symbol-p ignore-symbol-p) (let* ((title (symbol-name class-name)) (section-name (symbolicate @@ -113,20 +118,25 @@ `(,section-name section)))) -(defun make-package-section (section-name package) +(defun make-package-section (section-name package &key (ignore-symbol-p 'starts-with-percent-p)) (declare (optimize (debug 3))) (let* ((package-name (package-name package)) (title package-name) - (accessors-and-readers (package-accessors-and-writers package)) + (accessors-and-readers (package-accessors-and-writers package + :ignore-symbol-p ignore-symbol-p)) (entries (loop for symbol being the external-symbols of package + for should-be-documented = (not (funcall ignore-symbol-p + symbol)) ;; Usual functions when (and (fboundp symbol) + should-be-documented (not (macro-function symbol)) (not (typep (symbol-function symbol) 'generic-function))) collect (list symbol 'function) into functions ;; Generic functions when (and (fboundp symbol) + should-be-documented (typep (symbol-function symbol) 'generic-function) (not (member symbol accessors-and-readers :test 'eql))) @@ -134,19 +144,23 @@ ;; Macroses when (and (fboundp symbol) + should-be-documented (macro-function symbol)) collect (list symbol 'macro) into macros ;; Classes - when (find-class symbol nil) + when (and (find-class symbol nil) + should-be-documented) collect (make-class-entry symbol package-name) into classes ;; Variables - when (documentation symbol 'variable) + when (and (documentation symbol 'variable) + should-be-documented) collect (list symbol 'variable) into variables ;; Types and not classes when (and (not (find-class symbol nil)) + should-be-documented (or (documentation symbol 'type) (not (eq (swank-backend:type-specifier-arglist symbol) :not-available)))) @@ -183,7 +197,8 @@ (defun make-entries (system &key (show-system-description-p nil) - (ignore-packages nil)) + (ignore-packages nil) + (ignore-symbol-p 'starts-with-percent-p)) (with-subsection-collector () (loop for package in (system-packages system) for package-name = (package-name package) @@ -193,7 +208,8 @@ for section-name = (when collect-this-package (symbolicate "@" (string-upcase package-name) "?PACKAGE")) for package-section = (when section-name - (make-package-section section-name package)) + (make-package-section section-name package + :ignore-symbol-p ignore-symbol-p)) when package-section collect (list section-name 'section) into entries and @@ -205,15 +221,21 @@ entries)))))) +(defun starts-with-percent-p (symbol) + (str:starts-with-p "%" + (symbol-name symbol))) + + (defmacro defautodoc (name (&key system - (title "API") - (show-system-description-p nil) - (readtable-symbol '*readtable*) - (section-class '40ants-doc:section) - (external-docs nil) - (external-links nil) - (ignore-words nil) - (ignore-packages nil))) + (title "API") + (show-system-description-p nil) + (readtable-symbol '*readtable*) + (section-class '40ants-doc:section) + (external-docs nil) + (external-links nil) + (ignore-words nil) + (ignore-packages nil) + (ignore-symbol-p 'starts-with-percent-p))) "Macro DEFAUTODOC collects all packages of the ASDF system and analyzes all external symbols. In resulting documentation symbols are grouped by packages and types. @@ -252,7 +274,8 @@ (multiple-value-bind (subsections entries) (make-entries system :show-system-description-p show-system-description-p - :ignore-packages ignore-packages) + :ignore-packages ignore-packages + :ignore-symbol-p ignore-symbol-p) `(progn (defsection ,name (:title ,title :readtable-symbol ,readtable-symbol diff --git a/src/changelog.lisp b/src/changelog.lisp index a1c6ea1..d9a8ba5 100644 --- a/src/changelog.lisp +++ b/src/changelog.lisp @@ -155,6 +155,8 @@ "CLEAN-URLS" ;; These objects are not documented yet: "40ANTS-DOC/COMMONDOC/XREF:XREF")) + (0.24.0 2025-05-12 + "* Autodoc macro now accepts IGNORE-SYMBOL-P argument and by default ignores symbols starting with `%` character.") (0.23.0 2025-01-06 "* IGNORE-PACKAGES argument was added to DEFSECTION macro. Packages listed in this argument allows to muffle this warning: