]> git.donarmstrong.com Git - lilypond.git/blob - scm/document-markup.scm
Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / scm / document-markup.scm
1 ;;;; document-markup.scm -- part of generated backend documentation
2 ;;;;
3 ;;;;  source file of the GNU LilyPond music typesetter
4 ;;;; 
5 ;;;; (c) 1998--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 ;;;;                 Jan Nieuwenhuizen <janneke@gnu.org>
7
8 (define (doc-markup-function func)
9   (let* ((doc-str  (procedure-documentation func))
10          (f-name (symbol->string (procedure-name  func)))
11          (c-name (regexp-substitute/global #f "-markup$" f-name  'pre "" 'post))
12          (sig (object-property func 'markup-signature))
13          (arg-names (let ((arg-list (cadr (procedure-source func))))
14                       (if (list? arg-list)
15                           (map symbol->string (cddr arg-list))
16                           (make-list (length sig) "arg"))))
17          (sig-type-names (map type-name sig))
18          (signature-str
19           (string-join
20            (map (lambda (x) (string-append
21                              "@var{" (car x) "} ("  (cadr x) ")" ))
22                 (zip arg-names  sig-type-names))
23            " " )))
24     
25     (string-append
26      "\n\n@item @code{\\" c-name "} " signature-str
27      
28      "\n@findex " f-name "\n"
29      "\n@cindex @code{" c-name "}\n"
30      
31      (if (string? doc-str)
32          doc-str
33          ""))))
34
35 (define (markup-function<? a b)
36   (string<? (symbol->string (procedure-name a)) (symbol->string (procedure-name b))))
37
38 (define (markup-doc-string)
39   (string-append
40    
41    "@table @asis"
42    (apply string-append
43           
44           (map doc-markup-function
45                (sort markup-function-list markup-function<?)))
46    "\n@end table"))
47
48 (define (markup-doc-node)
49   (make <texi-node>
50     #:name "Markup functions"
51     #:desc "Definitions of the markup functions."
52     #:text (markup-doc-string)))