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 (self-evaluating? x)
17 (or (number? x) (string? x) (procedure? x) (boolean? x)))
22 ;; ((x1 (regexp-substitute/global #f "\([^@]\){" x 'pre "\1@{" 'post))
23 ;; ((x2 (regexp-substitute/global #f "\([^@]\){" x 'pre "\1@{" 'post))
24 ;; ((x3 (regexp-substitute/global #f "\([^@]\)@" x 'pre "\1@@" 'post))
28 (define (scm->string val)
30 (if (self-evaluating? val) "" "'")
32 (call-with-output-string (lambda (port) (display val port))))
40 "\n@node " name ",,,"))
44 ;; Hmm, texinfo doesn't have ``part''
47 (2 . "@unnumberedsec")
48 (3 . "@unnumberedsubsec")
49 (4 . "@unnumberedsubsubsec")
50 (5 . "@unnumberedsubsubsec")
53 (define (section level name)
54 (string-append "\n" (cdr (assoc level section-alist)) " " name "\n"))
56 (define (description-list items-alist)
60 (map (lambda (x) (string-append "\n@item " (car x) "\n" (cdr x)))
64 (define (texi-menu items-alist)
68 (map (lambda (x) (string-append "\n* " (car x) ":: " (cdr x)))
71 ;; Menus don't appear in html, so we make a list ourselves
74 (description-list (map (lambda (x) (cons (reffy (car x)) (cdr x)))
80 (define (texi-node-menu name items-alist)
84 (texi-menu items-alist)))
86 (define (texi-file-head name file-name top items-alist)
88 "\\input texinfo @c -*-texinfo-*-"
89 "\n@setfilename " file-name ".info"
94 (texi-menu items-alist)
98 (define (context-name name)
99 (string-append "Context " name))
101 (define (engraver-name name)
104 (define (element-name name)
105 (string-append "Element " name))
107 (define (interface-name name)
111 (string-append "@ref{" x "}"))
113 (define (human-listify l)
116 ((null? (cdr l)) (car l))
117 ((null? (cddr l)) (string-append (car l) " and " (cadr l)))
118 (else (string-append (car l) ", " (human-listify (cdr l))))
121 (define (writing-wip x)
122 (display (string-append "\nWriting " x " ... ") (current-error-port)))