1 (in-package #:docgen-struc)
3 (defun fire-error (msg) (error (make-instance 'docgen:validation-failure :msg msg)))
5 (defun doc->ast (struc)
11 ((< 120 (length str)) (fire-error (format nil "Structure description longer than 120 characters: ~A" str)))
12 ((cl-ppcre:scan "^ " str) (fire-error (format nil "Structure description line started with space: ~A" str)))
13 ((cl-ppcre:scan " $" str) (fire-error (format nil "Structure description line ended with space: ~A" str)))))
17 ((not strs) (list ""))
18 ((string= "" (car strs)) (cons "" (combine (cdr strs))))
21 ((rest (combine (cdr strs))))
22 (cons (format nil "~A~A~A" (car strs) (if (string/= "" (car rest)) " " "") (car rest)) (cdr rest)))))))
24 ((lines (cl-ppcre:split "\\n" (documentation struc 'structure))))
27 ((paragraphs (combine lines)))
28 (when (find "" paragraphs :test #'string=) (fire-error "Structure description has two empty lines in it"))
31 ((typep (make-instance struc) 'condition) :condition)
33 (cons struc paragraphs))))))
36 (format nil "## ~@(~A~) ~A~%~%~{~A~%~^~%~}"
41 (defun ast->category-name (ast)
43 (:condition "condition")
46 (defun ast->short-name (ast)
47 (format nil "~(~A~)" (second ast)))
49 (defun ast->link (ast)
50 (format nil "~(~A-~A~)" (first ast) (second ast)))
52 (defun ast->short-desc (ast)