3 (define-condition validation-failure nil ((msg :initarg :msg :reader validation-failure-msg)))
5 (defun get-symb-type (symb)
7 ;((documentation symb 'variable) :variable)
8 ;((documentation symb 'structure) :structure)
9 ((documentation symb 'function) :function)))
11 (defun validate-package (pkg)
13 ((with-success-check (&rest f)
16 (validation-failure (v) (list :failure (validation-failure-msg v))))))
19 (do-external-symbols (symb pkg) (push symb symbs))
20 (setf symbs (sort symbs #'string< :key #'symbol-name))
23 (list (with-success-check (docgen-pkg:doc->ast (find-package pkg))))
27 (case (get-symb-type symb)
28 (:function (docgen-func:doc->ast symb))
29 (t (error (make-condition 'validation-failure :msg (format nil "Symbol ~A has no documentation" symb)))))))
32 (defun pretty-print-validate-packages (&rest pkgs)
36 ((failures (validate-package pkg)))
39 (format t "In package ~A, documentation error found:~% ~A" pkg (cadr failure)))
44 (defun export-package (pkg)
47 (do-external-symbols (symb pkg) (push symb symbs))
48 (setf symbs (sort symbs #'string< :key #'symbol-name))
49 (with-output-to-string (str)
50 (format str "~A~%~%" (docgen-pkg:ast->md (docgen-pkg:doc->ast (find-package pkg))))
51 (format str "~{~A~^~%~}"
54 (case (get-symb-type symb)
55 (:function (docgen-func:ast->md (docgen-func:doc->ast symb)))))