Changeset 13689


Ignore:
Timestamp:
11/02/11 13:12:07 (12 years ago)
Author:
Mark Evenson
Message:

First semi-working version of groveling ABCL docstrings into LaTeX.

Still needs to be more rigourous about escaping certain LaTeX
characters such as #\% which I am currenly editing by hand.

File:
1 edited

Legend:

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

    r13686 r13689  
    11#-abcl We're only grovelling ABCL docstrings here.
    22(defun grovel-docstrings-as-tex (&optional (package (find-package :java)))
    3   (with-open-file (stream "java.tex" :direction :output)
    4     (loop :for symbol :being :each :external-symbol :of package
    5        :doing (format stream "~&~A~%~%"(symbol-as-tex symbol)))))
     3  (let ((output-file (format nil "~A.tex" (string-downcase (package-name package)))))
     4    (with-open-file (stream output-file :direction :output)
     5      (format t "Writing output to ~A.~%" output-file)
     6      (loop :for symbol :being :each :external-symbol :of package
     7         :doing (format stream "~&~A~%~%" (symbol-as-tex symbol))))))
    68
    79(asdf:load-system 'swank) ;; XXX Does this load the SWANK-BACKEND package as well
     
    1214         :collecting
    1315         (format nil
    14                  (if (string= (subseq (symbol-name arg) 0 1) #\&)
     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) #\%)))
    1520                     "\\~A"
    1621                     "~A")
    17                  (string-downcase (symbol-name arg))))
     22                 (if (symbolp arg)
     23                     (string-downcase (symbol-name arg))
     24                     (format nil "~(~A~)" arg))))
    1825    (t (e)
    1926      (progn (warn "Failed to form arglist for ~A: ~A" symbol e)
     
    2229
    2330(defvar *type-alist*
    24   '((:function . "Function")
    25     (:macro . "Macro")
    26     (:variable . "Variable")
    27     (:class . "Class")
    28     (:generic-function . "Generic Function")))
     31  '((:function
     32     . "Function")
     33    (:macro
     34     . "Macro")
     35    (:variable
     36     . "Variable")
     37    (:class
     38     . "Class")
     39    (:special-operator
     40     . "Special Operator")
     41    (:generic-function
     42     . "Generic Function")))
    2943
    3044(defun symbol-as-tex (symbol)
     
    4963           (setf type :class
    5064                 documentation (second doc)))
     65          ((find :special-operator doc)
     66           (setf type :special-operator
     67                 documentation (second doc)))
    5168          (t
    5269           (warn "Unknown type of documentation for symbol ~A: ~A"
     
    5673              package-name (string-downcase
    5774                            (package-name (find-package (symbol-package symbol)))))
    58         (format nil "\\label{~A:~A}~&--- ~A: \\textbf{~A} [\\textbf{~A}] \\textit{~A}~%~%~A"
     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)))
    5977                (symbol-name symbol)
    60                 (package-name (find-package (symbol-package symbol)))
     78                (symbol-name symbol)
    6179                (cdr (assoc type *type-alist*))
    6280                symbol-name
Note: See TracChangeset for help on using the changeset viewer.