1.0.10.17: Reformat string, and fix compiler warning.
[sbcl/tcr.git] / doc / manual / create-contrib-doc-list.lisp
blob2d4db6ba85919f1625bab45ea334bcad6c206b49
1 ;;;; -*- lisp -*-
3 ;;;; "Lisp as scripting language -- discuss"
5 ;;;; Generate contrib-docs.texi-temp from any texinfo files found in
6 ;;;; the contrib/ sub-tree.
8 (defun nodename (texi-file)
9 (with-open-file (f texi-file)
10 (loop for line = (read-line f)
11 while line
12 do (let ((index (search "@node" line)))
13 (when index
14 (return-from nodename
15 (subseq line (+ index 1 (length "@node"))))))))
16 (error "No `@node' line found in file ~A" texi-file))
18 (let ((texi-files (directory "../../contrib/**/*.texinfo")))
19 (with-open-file (out "contrib-doc-list.texi-temp" :direction :output
20 :if-does-not-exist :create :if-exists :supersede)
21 (write-string "@c -*- texinfo -*-
23 @c Include documentation for contrib modules.
24 @c This is a generated file - do not edit!
26 " out)
27 (write-line "@menu" out)
28 (dolist (texi-file texi-files)
29 (let ((nodename (nodename texi-file)))
30 (format out "* ~A::~%" nodename)))
31 (write-line "@end menu" out)
32 (terpri out)
33 (dolist (texi-file texi-files)
34 (format out "@page~%@include ~A~%"
35 (namestring (make-pathname
36 :directory (list* :relative :up :up
37 (last
38 (pathname-directory texi-file) 2))
39 :name (pathname-name texi-file)
40 :type (pathname-type texi-file)))))))
42 (sb-ext:quit)