1 (in-package #:docgen-pkg)
3 (defun fire-error (msg) (error (make-instance 'docgen:validation-failure :msg msg)))
6 (when (not (documentation pkg t)) (fire-error (format nil "Package ~A has no documentation" (package-name pkg))))
12 ((< 120 (length str)) (fire-error (format nil "Package description longer than 120 characters: ~A" str)))
13 ((cl-ppcre:scan "^ " str) (fire-error (format nil "Package description line started with space: ~A" str)))
14 ((cl-ppcre:scan " $" str) (fire-error (format nil "Package description line ended with space: ~A" str)))))
18 ((not strs) (list ""))
19 ((string= "" (car strs)) (cons "" (combine (cdr strs))))
22 ((rest (combine (cdr strs))))
23 (cons (format nil "~A~A~A" (car strs) (if (string/= "" (car rest)) " " "") (car rest)) (cdr rest)))))))
25 ((lines (cl-ppcre:split "\\n" (documentation pkg t))))
28 ((paragraphs (combine lines)))
29 (when (< 120 (length (first paragraphs))) (fire-error "First package paragraph is longer than 120 characters"))
30 (when (find "" paragraphs :test #'string=) (fire-error "Package description has two empty lines in it"))
31 (cons (package-name pkg) paragraphs)))))
34 (format nil "# Package ~A~%~%~{~A~^~%~%~}"