2 ;;; documentation-lib.scm -- Assorted Functions for generated documentation
4 ;;; source file of the GNU LilyPond music typesetter
6 ;;; (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 ;;; Jan Nieuwenhuizen <janneke@gnu.org>
9 (define (uniqued-alist alist acc)
11 (if (assoc (caar alist) acc)
12 (uniqued-alist (cdr alist) acc)
13 (uniqued-alist (cdr alist) (cons (car alist) acc)
16 (define (processing name)
17 (display (string-append "\nProcessing " name " ... ") (current-error-port)))
19 (define (self-evaluating? x)
20 (or (number? x) (string? x) (procedure? x) (boolean? x)))
25 ;; ((x1 (regexp-substitute/global #f "\([^@]\){" x 'pre "\1@{" 'post))
26 ;; ((x2 (regexp-substitute/global #f "\([^@]\){" x 'pre "\1@{" 'post))
27 ;; ((x3 (regexp-substitute/global #f "\([^@]\)@" x 'pre "\1@@" 'post))
31 (define (scm->string val)
33 (if (self-evaluating? val) "" "'")
35 (call-with-output-string (lambda (port) (display val port))))
43 "\n@node " name ",,,"))
47 ;; Hmm, texinfo doesn't have ``part''
50 (2 . "@unnumberedsec")
51 (3 . "@unnumberedsubsec")
52 (4 . "@unnumberedsubsubsec")
53 (5 . "@unnumberedsubsubsec")
56 (define (section level name)
57 (string-append "\n" (cdr (assoc level section-alist)) " " name "\n"))
59 (define (description-list items-alist)
63 (map (lambda (x) (string-append "\n@item " (car x) "\n" (cdr x)))
67 (define (texi-menu items-alist)
71 (map (lambda (x) (string-append "\n* " (car x) ":: " (cdr x)))
74 ;; Menus don't appear in html, so we make a list ourselves
77 (description-list (map (lambda (x) (cons (reffy (car x)) (cdr x)))
83 (define (texi-node-menu name items-alist)
87 (texi-menu items-alist)))
89 (define (texi-file-head name file-name top items-alist)
91 "\\input texinfo @c -*-texinfo-*-"
92 "\n@setfilename " file-name ".info"
97 (texi-menu items-alist)
101 (define (context-name name)
102 (string-append "Context " name))
104 (define (engraver-name name)
107 (define (element-name name)
108 (string-append "Element " name))
110 (define (interface-name name)
114 (string-append "@ref{" x "}"))
116 (define (human-listify l)
119 ((null? (cdr l)) (car l))
120 ((null? (cddr l)) (string-append (car l) " and " (cadr l)))
121 (else (string-append (car l) ", " (human-listify (cdr l))))
124 (define (writing-wip x)
125 (display (string-append "\nWriting " x " ... ") (current-error-port)))