Commit b3376c89 authored by Antoine Martin's avatar Antoine Martin
Browse files

Cleaner organisation of the output files

parent 779d373e
(in-package :quickref)
(defun from-homedir (relative-path)
(merge-pathnames relative-path (user-homedir-pathname)))
(defparameter *quickref-basedir* (user-homedir-pathname))
(defun from-quickref-dir (relative-path)
(merge-pathnames relative-path (quickref-dir)))
(defun quickref-dir ()
(merge-pathnames "quickref/" *quickref-basedir*))
(defun clean-directory (path)
(dolist (dir (directory (merge-pathnames "*/" (truename path))))
......@@ -30,7 +35,7 @@
(defun get-texi-pathnames ()
(loop for texi in (directory (all-texis))
collect texi))
collect texi))
(defun quicklisp-software ()
(namestring
......@@ -43,11 +48,18 @@
(ensure-directories-exist directory)))
(defun log-texi-error (err texi)
(let ((filepathname (from-homedir
(format nil "texi-logfiles/~A.log"
(let ((filepathname (from-quickref-dir
(format nil "logs/makeinfo/~A.log"
(pathname-name texi)))))
(with-open-file (file filepathname
:direction :output
:if-exists :supersede
:if-does-not-exist :create)
(format file err))))
(defun setup-quickref-dir (&key declt makeinfo)
(when declt
(clean-or-create (from-quickref-dir "logs/declt-map/")))
(when makeinfo
(clean-or-create (from-quickref-dir "logs/makeinfo/"))
(clean-or-create (from-quickref-dir "website/"))))
......@@ -57,7 +57,7 @@
release.
The resulting .texi file is placed inside the release's directory, in
~/quicklisp/dists/quicklisp/software/."
(clean-or-create (from-homedir "declt-logfiles/"))
(setup-quickref-dir :declt t)
(map-releases
(merge-pathnames "map-declt.lisp"
(asdf:system-source-directory "quickref"))))
......@@ -83,6 +83,7 @@ to creating the corresponding html files with makeinfo.
The final website structure is created in ~/quickref/, the various logs can
be found in ~/texi-logfiles/ and ~/declt-logfiles/ for now."
(setup-quickref-dir :declt t :makeinfo t)
(let ((*makeinfo-path* makeinfo-path)
(*log-errors* log-errors))
(when uninstall
......
......@@ -21,17 +21,17 @@
((= n lfirst) nil)
(cond ((>= n lsecond)
(format file
"<tr>~A</tr>~%"
(build-cell (car f))))
"<tr>~A</tr>~%"
(build-cell (car f))))
((>= n lthird)
(format file
"<tr>~A~A</tr>~%"
(build-cell (car f)) (build-cell (car s))))
"<tr>~A~A</tr>~%"
(build-cell (car f)) (build-cell (car s))))
(t
(format file "<tr>~A~A~A</tr>~%"
(build-cell (car f))
(build-cell (car s))
(build-cell (car th))))))))
(build-cell (car f))
(build-cell (car s))
(build-cell (car th))))))))
;; #### FIXME: check that we don't miss any weirdly named libraries (non
;; alphabetic, non numeric).
......@@ -72,31 +72,30 @@ and adds the right letter anchors before each section.
The resulting file is written at ~/quickref/index.html"
(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-file-list quickref-dir) #'string<
:key #'remove-cl-prefix))
(current-letter (get-first-letter (first dir-list)))
(length 0)
(pos dir-list))
;; #### FIXME: consider learning how to use LOOP.
(loop until (endp pos)
do (if (letter-has-not-changed current-letter (get-first-letter (car pos)))
(progn (incf length)
(setq pos (cdr pos)))
(progn
(print-index-letter current-letter file)
(print-columns dir-list length file)
(setq length 0
dir-list pos
current-letter (get-first-letter (car pos))))))
(print-index-letter current-letter file)
(print-columns dir-list length file))
(format file "</body>~%"))))
(with-open-file (file (from-quickref-dir "website/index.html")
:direction :output
:if-exists :supersede
:if-does-not-exist :create)
(print-index-header file)
(let* ((dir-list (sort (get-file-list (quickref-dir)) #'string<
:key #'remove-cl-prefix))
(current-letter (get-first-letter (first dir-list)))
(length 0)
(pos dir-list))
;; #### FIXME: consider learning how to use LOOP.
(loop until (endp pos)
do (if (letter-has-not-changed current-letter (get-first-letter (car pos)))
(progn (incf length)
(setq pos (cdr pos)))
(progn
(print-index-letter current-letter file)
(print-columns dir-list length file)
(setq length 0
dir-list pos
current-letter (get-first-letter (car pos))))))
(print-index-letter current-letter file)
(print-columns dir-list length file))
(format file "</body>~%")))
(defun build-texi (texi)
(format t "Generating html file for ~A~%" (pathname-name texi))
......@@ -105,8 +104,8 @@ The resulting file is written at ~/quickref/index.html"
*makeinfo-path*
(list "--html" (namestring texi)
"-o" (namestring
(from-homedir
(format nil "quickref/~A.html" (pathname-name texi))))
(from-quickref-dir
(format nil "website/~A.html" (pathname-name texi))))
"--css-ref" "/document.css"
"-c" "TOP_NODE_UP_URL=/"
"--no-split"
......@@ -120,9 +119,8 @@ The resulting file is written at ~/quickref/index.html"
(defun build-texis (&key (makeinfo-path *makeinfo-path*) (log-errors *log-errors*))
"Calls makeinfo on each .texi file, places the resulting html files in ~/quickref/"
(setup-quickref-dir :makeinfo t)
(let ((*makeinfo-path* makeinfo-path)
(*log-errors* log-errors))
(clean-or-create (from-homedir "quickref/"))
(clean-or-create (from-homedir "texi-logfiles/"))
(dolist (texi (get-texi-pathnames))
(build-texi texi))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment