]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/documentation-lib.scm
* tex/GNUmakefile (TEX_FILES): add texinfo.cnf
[lilypond.git] / scm / documentation-lib.scm
index a73b3b558625714052dbc50355b7b0ada03cc56a..4f7a0f05948dacb9c3c067230f0809eb46c7cda2 100644 (file)
@@ -1,12 +1,15 @@
-;;;
-;;; 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)
@@ -24,9 +27,7 @@
 (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  ))