(in-package :quickref) (defun get-columns-length (size) (if (equal size 1) (values 1 0 0) (multiple-value-bind (split remainder) (floor size 3) (case remainder (0 (values split split split)) (1 (values (+ split 1) (+ split 1) (- split 1))) (2 (values (+ split 1) (+ split 1) split)))))) (defun build-cell (s) (format nil "~A" s s)) (defun print-columns (l size file) (multiple-value-bind (lfirst lsecond lthird) (get-columns-length size) (do ((n 0 (+ n 1)) (f l (cdr f)) (s (nthcdr lfirst l) (cdr s)) (th (nthcdr (+ lfirst lsecond) l) (cdr th))) ((= n lfirst) nil) (if (>= n lsecond) (format file "~A~%" (build-cell (car f))) (if (>= n lthird) (format file "~A~A~%" (build-cell (car f)) (build-cell (car s))) (format file "~A~A~A~%" (build-cell (car f)) (build-cell (car s)) (build-cell (car th)))))))) (defun get-first-letter (sequence) (subseq (remove-cl-prefix sequence) 0 1)) (defun is-number (string) (let ((chara (char string 0))) (and (>= (char-code chara) (char-code #\0)) (<= (char-code chara) (char-code #\9))))) (defun letter-has-not-changed (previous new) (if (and (is-number previous) (is-number new)) t (string= previous new))) (defun print-index-letter (letter file) (if (is-number letter) (format file "~%#~%~%") (let ((upletter (string-upcase letter))) (format file "~%~A~%~%" upletter upletter)))) (defun print-index-header (file) (format file " Quickref

Documentation generated with Declt.

Quickref

Reference manuals for Quicklisp libraries.

Jump to:   #  ~%") (loop for c across "ABCDEFGHIJKLMNOPQRSTUVWXYZ" do (format file "~C  ~%" c c)) (format file "
~%")) (defun build-index () (let ((quickref-dir (from-homedir "quickref/"))) (with-open-file (file (merge-pathnames "index.html" quickref-dir) :direction :output :if-exists :supersede :if-does-not-exist :create) (print-index-header file) (let* ((dir-list (sort (get-directory-list quickref-dir) #'string< :key #'remove-cl-prefix)) (current-letter (get-first-letter (first dir-list))) (length 0) (pos dir-list)) (loop until (endp pos) do (if (letter-has-not-changed current-letter (get-first-letter (car pos))) (progn (setq length (+ length 1)) (setq pos (cdr pos))) (progn (print-index-letter current-letter file) (print-columns dir-list length file) (setq length 0) (setq dir-list pos) (setq current-letter (get-first-letter (car pos)))))) (print-index-letter current-letter file) (print-columns dir-list length file)) (format file "~%")))) (defun log-texi-error (err texi) (with-open-file (file (format nil "texi-logfiles/~A.logfile" (pathname-name texi)) :direction :output :if-exists :supersede :if-does-not-exist :create) (format file err))) (defun build-texi (texi makeinfo-path) (let ((out (with-output-to-string (out) (sb-ext:run-program makeinfo-path (list "--html" (namestring texi) "-o" (namestring (from-homedir (format nil "quickref/~A" (pathname-name texi)))) "--css-ref" "/document.css" "-c" "TOP_NODE_UP_URL=/" "--force") :output out)))) (when (not (string= out "")) (log-texi-error out texi)))) (defun build-texis (makeinfo-path) (let ((quickref-dir (from-homedir "quickref/"))) (if (probe-file quickref-dir) (clean-directory quickref-dir) (ensure-directories-exist quickref-dir))) (let ((texis (get-texi-pathnames))) (dolist (texi texis) (build-texi texi makeinfo-path))))
Index Entry