-;;;
-;;; documentation-lib.scm -- Assorted Functions for generated documentation
-;;;
-;;; source file of the GNU LilyPond music typesetter
-;;;
-;;; (c) 2000--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-;;; Jan Nieuwenhuizen <janneke@gnu.org>
-
-(use-modules (oop goops))
+;;;;
+;;;; documentation-lib.scm -- Assorted Functions for generated documentation
+;;;;
+;;;; source file of the GNU LilyPond music typesetter
+;;;;
+;;;; (c) 2000--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+;;;; Jan Nieuwenhuizen <janneke@gnu.org>
+
+(use-modules (oop goops)
+ (srfi srfi-13)
+ (srfi srfi-1)
+ )
(define-class <texi-node> ()
(children #:init-value '() #:accessor node-children #:init-keyword #:children)
(define (dump-node node port level)
(display
(string-append
- "\n@html"
- "\n<hr>"
- "\n@end html\n@node "
+ "\n@node "
(node-name node)
"\n\n"
(texi-section-command level) " "
(apply string-append
(map (lambda (x)
(string-append
- (pad-string-to
+ (string-pad-right
(string-append "\n* " (car x) ":: ")
(+ maxwid 8)
)
;; prepend GNU for dir, must be unique
"\n* GNU " name ": (" file-name "). " name "."
"\n@end direntry"
+ "@documentlanguage en\n"
+ "@documentencoding ISO-8859-1\n"
+
))
(display (string-append "\nWriting " x " ... ") (current-error-port)))
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; property stuff.
-(define (property->texi where sym)
- "Document SYM for WHERE (which can be translation, backend, music)"
- (let* (
- (name (symbol->string sym))
+(define (property->texi where sym . rest)
+ "Document SYM for WHERE (which can be translation, backend, music),
+with init values from ALIST (1st optional argument)
+"
+ (let* ((name (symbol->string sym))
+ (alist (if (pair? rest) (car rest) '()))
(type?-name (string->symbol
(string-append (symbol->string where) "-type?")))
(doc-name (string->symbol
(string-append (symbol->string where) "-doc")))
(type (object-property sym type?-name))
(typename (type-name type))
- (desc (object-property sym doc-name)))
+ (desc (object-property sym doc-name))
+ (handle (assoc sym alist))
+ )
(if (eq? desc #f)
- (error "No description for property ~S" sym)
- )
+ (error "No description for property ~S" sym))
+
(cons
(string-append "@code{" name "} "
- "(" typename ")")
+ "(" typename ")"
+ (if handle
+ (string-append
+ ":\n\n"
+ (scm->texi (cdr handle))
+ "\n\n")
+ "")
+
+
+ )
desc)
))
-(define (document-property-value sym alist)
- "Extract value for SYM from ALIST, return as texi string"
- (let* ((handle (assoc sym alist)))
- (if (eq? handle #f)
- "(unset)"
- (scm->texi (cdr handle)))))
-
-
-(define (backend-property->texi sym)
- (property->texi 'backend sym))
-
-(define (document-property sym where alist)
- "Document SYM. If GROB-DESCRIPTION is not #f, it's an alist
-containing default values."
- (let*
- ((without (property->texi where sym))
- (rv
-
- (cons (car without)
- (if (eq? alist #f)
- (cdr without)
- (string-append
- (cdr without)
- "\nDefault value: "
- (document-property-value sym alist)))))
-
- )
-; (display rv)
- rv ))