[armedbear-cvs] r13689 - trunk/abcl/doc/manual
mevenson at common-lisp.net
mevenson at common-lisp.net
Wed Nov 2 13:12:08 UTC 2011
Author: mevenson
Date: Wed Nov 2 06:12:07 2011
New Revision: 13689
Log:
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.
Modified:
trunk/abcl/doc/manual/grovel.lisp
Modified: trunk/abcl/doc/manual/grovel.lisp
==============================================================================
--- trunk/abcl/doc/manual/grovel.lisp Wed Nov 2 06:11:50 2011 (r13688)
+++ trunk/abcl/doc/manual/grovel.lisp Wed Nov 2 06:12:07 2011 (r13689)
@@ -1,8 +1,10 @@
#-abcl We're only grovelling ABCL docstrings here.
(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
- :doing (format stream "~&~A~%~%"(symbol-as-tex symbol)))))
+ (let ((output-file (format nil "~A.tex" (string-downcase (package-name package)))))
+ (with-open-file (stream output-file :direction :output)
+ (format t "Writing output to ~A.~%" output-file)
+ (loop :for symbol :being :each :external-symbol :of package
+ :doing (format stream "~&~A~%~%" (symbol-as-tex symbol))))))
(asdf:load-system 'swank) ;; XXX Does this load the SWANK-BACKEND package as well
@@ -11,21 +13,33 @@
(loop :for arg :in (arglist symbol)
:collecting
(format nil
- (if (string= (subseq (symbol-name arg) 0 1) #\&)
+ ;;; XXX should really check the entire input for TeX escapes
+ (if (and (symbolp arg)
+ (or (string= (subseq (symbol-name arg) 0 1) #\&)
+ (string= (subseq (symbol-name arg) 0 1) #\%)))
"\\~A"
"~A")
- (string-downcase (symbol-name arg))))
+ (if (symbolp arg)
+ (string-downcase (symbol-name arg))
+ (format nil "~(~A~)" 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")))
+ '((:function
+ . "Function")
+ (:macro
+ . "Macro")
+ (:variable
+ . "Variable")
+ (:class
+ . "Class")
+ (:special-operator
+ . "Special Operator")
+ (:generic-function
+ . "Generic Function")))
(defun symbol-as-tex (symbol)
"Return the TeX representation of a SYMBOL as Tex."
@@ -48,6 +62,9 @@
((find :class doc)
(setf type :class
documentation (second doc)))
+ ((find :special-operator doc)
+ (setf type :special-operator
+ documentation (second doc)))
(t
(warn "Unknown type of documentation for symbol ~A: ~A"
symbol doc)))
@@ -55,9 +72,10 @@
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)
+ (format nil "~&\\paragraph{}~&\\label{~A:~A}~&\\index{~A}~&--- ~A: \\textbf{~A} [\\textbf{~A}] \\textit{~A}~%~%\\begin{adjustwidth}{5em}{5em}~&~A~&\\end{adjustwidth}"
(package-name (find-package (symbol-package symbol)))
+ (symbol-name symbol)
+ (symbol-name symbol)
(cdr (assoc type *type-alist*))
symbol-name
package-name
More information about the armedbear-cvs
mailing list