Ignore:
Timestamp:
02/06/12 11:21:48 (9 years ago)
Author:
rschlatte
Message:

Manual: fix grovel.lisp, add to Makefile (not run by default)

... also create new versions of generated files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/doc/manual/grovel.lisp

    r13689 r13858  
    1 #-abcl We're only grovelling ABCL docstrings here.
     1
    22(defun grovel-docstrings-as-tex (&optional (package (find-package :java)))
    33  (let ((output-file (format nil "~A.tex" (string-downcase (package-name package)))))
     
    77         :doing (format stream "~&~A~%~%" (symbol-as-tex symbol))))))
    88
     9(require :asdf)
     10
    911(asdf:load-system 'swank) ;; XXX Does this load the SWANK-BACKEND package as well
     12
     13(defun texify-string (string &optional remove)
     14  (with-output-to-string (s)
     15    (loop for char across string
     16         do (if (find char '(#\& #\% #\#))
     17                (unless remove
     18                  (write-char #\\ s)
     19                  (write-char char s))
     20                (write-char char s)))))
     21
     22(defun texify (thing)
     23  "Return STRING with LaTeX-sensitive characters escaped.
     24Downcase symbol names but leave strings alone."
     25  (cond ((listp thing)
     26         (format nil "~A" (mapcar #'texify thing)))
     27        ((stringp thing) (texify-string thing))
     28        ((symbolp thing) (texify-string (string-downcase (symbol-name thing))))))
    1029
    1130(defun arglist-as-tex (symbol)
    1231  (handler-case
    1332      (loop :for arg :in (arglist symbol)
    14          :collecting
    15          (format nil
    16                  ;;; XXX should really check the entire input for TeX escapes
    17                  (if (and (symbolp arg)
    18                           (or (string= (subseq (symbol-name arg) 0 1) #\&)
    19                               (string= (subseq (symbol-name arg) 0 1) #\%)))
    20                      "\\~A"
    21                      "~A")
    22                  (if (symbolp arg)
    23                      (string-downcase (symbol-name arg))
    24                      (format nil "~(~A~)" arg))))
     33         :collecting (texify arg))
    2534    (t (e)
    2635      (progn (warn "Failed to form arglist for ~A: ~A" symbol e)
     
    7382              package-name (string-downcase
    7483                            (package-name (find-package (symbol-package symbol)))))
    75         (format nil "~&\\paragraph{}~&\\label{~A:~A}~&\\index{~A}~&--- ~A: \\textbf{~A} [\\textbf{~A}] \\textit{~A}~%~%\\begin{adjustwidth}{5em}{5em}~&~A~&\\end{adjustwidth}"
    76                 (package-name (find-package (symbol-package symbol)))
    77                 (symbol-name symbol)
    78                 (symbol-name symbol)
     84        (format nil "~&\\paragraph{}
     85\\label{~A:~A}
     86\\index{~A}
     87--- ~A: \\textbf{~A} [\\textbf{~A}] \\textit{~A}
     88
     89\\begin{adjustwidth}{5em}{5em}
     90~A
     91\\end{adjustwidth}"
     92                (texify-string (package-name (find-package (symbol-package symbol))) t)
     93                (texify-string (symbol-name symbol) t)
     94                (texify-string (symbol-name symbol) t)
    7995                (cdr (assoc type *type-alist*))
    80                 symbol-name
    81                 package-name
     96                (texify symbol-name)
     97                (texify package-name)
    8298                (if arglist arglist "")
    83                 (if documentation documentation "")))))
     99                (if documentation (texify documentation) "")))))
    84100               
    85101               
Note: See TracChangeset for help on using the changeset viewer.