2 ;;; engraver-documentation-lib.scm -- Functions for engraver 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>
10 (eval-string (ly-gulp-file "translator-description.scm"))
12 ;; alist of translater descriptions
13 (define (document-translator-property sym)
16 "@code{" (symbol->string sym) "} "
17 "(" (type-name (object-property sym 'translation-type?)) "):")
18 (object-property sym 'translation-doc)))
20 ;; First level Engraver description and
21 ;; second level Context description
22 (define (document-engraver where engraver-descr)
25 (level (if (eq? where 'context) 3 2))
26 (props (car (cdddr engraver-descr)))
27 (name (car engraver-descr))
28 (desc (cadr engraver-descr))
29 (objs (caddr engraver-descr))
33 (texi-section level (engraver-name name) (eq? where 'context))
39 (texi-section (+ level 1) "Properties" #f)
40 (description-list->texi
41 (map (lambda (x) (document-translator-property x)) props))))
45 "This engraver creates \n "
46 (human-listify (map reffy (map grob-name objs)))
52 (let* ((paper-alist (My_lily_parser::paper_description))
53 (context-description-alist (map cdr paper-alist))
57 (let ((context (cdr (assoc 'type-name x)))
59 (list (cdr (assoc 'group-type x)))
60 (cdr (assoc 'consists x))
61 (cdr (assoc 'end-consists x)))))
63 (if (member name consists)
66 context-description-alist))))
68 name " is part of contexts: "
69 (human-listify (map reffy (map context-name contexts))))))))
72 ;; First level Engraver description
73 (define (document-separate-engraver top description)
74 (let ((name (car description)))
77 (node (engraver-name name))
78 (document-engraver 'self description))))
80 ;; Second level, part of Context description
81 (define (document-engraver-by-name name)
84 (eg (assoc (string->symbol name) engraver-description-alist))
88 (string-append "Engraver " name ", not documented.\n")
89 (document-engraver 'context (cdr eg))
93 (define (context-doc-string context-desc)
96 (name (cdr (assoc 'type-name context-desc)))
97 (desc-handle (assoc (string->symbol name) context-description-alist))
98 (desc (if (pair? desc-handle) (cdr desc-handle) ""))
100 (accepts (cdr (assoc 'accepts context-desc)))
102 (list (cdr (assoc 'group-type context-desc)))
103 (cdr (assoc 'consists context-desc))
104 (cdr (assoc 'end-consists context-desc))
112 "This context is a `bottom' context; it can not contain other contexts."
114 name " can contain \n"
115 (human-listify (map reffy (map context-name accepts)))))
117 "\n\nThis context is built from the following engravers: "
119 (human-listify (map reffy (map engraver-name consists)))
121 (map document-engraver-by-name consists))))))
124 ;; First level Context description
125 (define (document-context top context-desc)
126 (let ((name (cdr (assoc 'type-name context-desc)))
127 (doc (context-doc-string context-desc)))
130 (node (context-name name))
131 (texi-section 2 (context-name name) #f)
135 (define (document-paper name)
137 (sort (My_lily_parser::paper_description)
138 (lambda (x y) (string<? (car x) (car y)))))
139 (names (sort (map car paper-alist) string<?))
140 (contexts (map cdr paper-alist))
141 (doc (apply string-append
142 (map (lambda (x) (document-context name x)) contexts))))
145 (texi-node-menu name (map (lambda (x) (cons (context-name x) ""))
149 (define (document-all-engravers name)
150 (let* ((descs (map cdr engraver-description-alist))
151 (names (map car engraver-description-alist))
152 (doc (apply string-append
153 (map (lambda (x) (document-separate-engraver name x))
157 (texi-node-menu name (map (lambda (x) (cons (engraver-name x) ""))
161 (define (document-all-engraver-properties name)
164 (ps (sort (map symbol->string all-translation-properties) string<?))
165 (sortedsyms (map string->symbol ps))
166 (propdescs (map document-translator-property sortedsyms))
167 (texi (description-list->texi propdescs))
172 (texi-section 1 name #f)