[armedbear-cvs] r13686 - trunk/abcl/doc/manual
mevenson at common-lisp.net
mevenson at common-lisp.net
Tue Nov 1 20:57:30 UTC 2011
Author: mevenson
Date: Tue Nov 1 13:57:30 2011
New Revision: 13686
Log:
Starting to grovel resonable Tex from the docstrings (unfinished).
Modified:
trunk/abcl/doc/manual/grovel.lisp
Modified: trunk/abcl/doc/manual/grovel.lisp
==============================================================================
--- trunk/abcl/doc/manual/grovel.lisp Tue Nov 1 13:57:15 2011 (r13685)
+++ trunk/abcl/doc/manual/grovel.lisp Tue Nov 1 13:57:30 2011 (r13686)
@@ -2,29 +2,40 @@
(defun grovel-docstrings-as-tex (&optional (package (find-package :java)))
(with-open-file (stream "java.tex" :direction :output)
(loop :for symbol :being :each :external-symbol :of package
- :collecting (symbol-as-tex symbol))))
+ :doing (format stream "~&~A~%~%"(symbol-as-tex symbol)))))
(asdf:load-system 'swank) ;; XXX Does this load the SWANK-BACKEND package as well
-(defun arglist-as-string (symbol)
- (loop :for arg :in (arglist symbol)
- :collecting (format nil "~A" (symbol-name arg))))
+(defun arglist-as-tex (symbol)
+ (handler-case
+ (loop :for arg :in (arglist symbol)
+ :collecting
+ (format nil
+ (if (string= (subseq (symbol-name arg) 0 1) #\&)
+ "\\~A"
+ "~A")
+ (string-downcase (symbol-name arg))))
+ (t (e)
+ (progn (warn "Failed to form arglist for ~A: ~A" symbol e)
+ (list "")))))
+
(defvar *type-alist*
'((:function . "Function")
(:macro . "Macro")
(:variable . "Variable")
+ (:class . "Class")
(:generic-function . "Generic Function")))
(defun symbol-as-tex (symbol)
"Return the TeX representation of a SYMBOL as Tex."
- (let (type documentation arglist doc)
+ (let (type documentation arglist doc symbol-name package-name)
(when (setf doc (swank-backend:describe-symbol-for-emacs symbol))
(cond
((find :function doc)
(setf type :function
documentation (second doc)
- arglist (arglist-as-string symbol)))
+ arglist (format nil "~{~A~^ ~}" (arglist-as-tex symbol))))
((find :variable doc)
(setf type :variable
documentation (second doc)))
@@ -33,13 +44,26 @@
documentation (second doc)))
((find :generic-function doc)
(setf type :generic-function
- documentation (second doc))))
- (format nil "\\ref{~A:~A}~&--- ~A [\\textbf{~A}]: ~A"
+ documentation (second doc)))
+ ((find :class doc)
+ (setf type :class
+ documentation (second doc)))
+ (t
+ (warn "Unknown type of documentation for symbol ~A: ~A"
+ symbol doc)))
+ (setf symbol-name (string-downcase
+ symbol)
+ package-name (string-downcase
+ (package-name (find-package (symbol-package symbol)))))
+ (format nil "\\label{~A:~A}~&--- ~A: \\textbf{~A} [\\textbf{~A}] \\textit{~A}~%~%~A"
(symbol-name symbol)
- (package-name (symbol-package symbol))
+ (package-name (find-package (symbol-package symbol)))
(cdr (assoc type *type-alist*))
- (symbol-name symbol)
- (package-name (symbol-package symbol))))))
+ symbol-name
+ package-name
+ (if arglist arglist "")
+ (if documentation documentation "")))))
+
More information about the armedbear-cvs
mailing list