]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/document-backend.scm
Merge branch 'lilypond/translation' of ssh://git.sv.gnu.org/srv/git/lilypond into...
[lilypond.git] / scm / document-backend.scm
index d291b2299cdad34e1d307931fd1fb8d1712dec4a..41c2aab60c9fc03831f14c5a3694b72138ba2b75 100644 (file)
@@ -1,14 +1,36 @@
-;;;; backend-documentation-lib.scm -- Functions for backend documentation
+;;;; document-backend.scm -- Functions for backend documentation
 ;;;;
 ;;;; source file of the GNU LilyPond music typesetter
-;;;; 
-;;;; (c) 2000--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
+;;;;
+;;;; (c) 2000--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
 ;;;; Jan Nieuwenhuizen <janneke@gnu.org>
 
+(define (sort-grob-properties x)
+  ;; force 'meta to the end of each prop-list
+  (let ((meta (assoc 'meta x)))
+    (append (sort (assoc-remove! x 'meta) ly:alist-ci<?)
+            (list meta))))
+
+;; properly sort all grobs, properties, and interfaces
+;; within the all-grob-descriptions alist
+(map
+  (lambda (x)
+    (let* ((props      (assoc-ref all-grob-descriptions (car x)))
+           (meta       (assoc-ref props 'meta))
+           (interfaces (assoc-ref meta 'interfaces)))
+      (set! all-grob-descriptions
+        (sort (assoc-set! all-grob-descriptions (car x)
+               (sort-grob-properties
+                (assoc-set! props 'meta
+                 (assoc-set! meta 'interfaces
+                  (sort interfaces ly:symbol-ci<?)))))
+              ly:alist-ci<?))))
+  all-grob-descriptions)
+
 (define (interface-doc-string interface grob-description)
   (let* ((name (car interface))
         (desc (cadr interface))
-        (props (sort (caddr interface) symbol<?))
+        (props (caddr interface))
         (docfunc (lambda (pr)
                    (property->texi
                     'backend pr grob-description)))
 
      (if (pair? uprops)
         (string-append
-         "\n\n@unnumberedsubsubsec User settable properties:\n"
+         "\n\n@subsubheading User settable properties:\n"
          (description-list->texi user-propdocs #t))
         "")
 
      (if (pair? iprops)
         (string-append
-         "\n\n@unnumberedsubsubsec Internal properties:\n"
+         "\n\n@subsubheading Internal properties:\n"
          (description-list->texi internal-propdocs #t))
         ""))))
 
 
 ;; First level Interface description
 (define (interface-doc interface)
-  (let ((name (symbol->string (car interface))))
+  (let* ((name (symbol->string (car interface)))
+        (interface-list (human-listify
+                         (map ref-ify
+                              (sort
+                               (map symbol->string
+                                    (hashq-ref iface->grob-table
+                                               (car interface)
+                                               '()))
+                               ly:string-ci<?)))))
     (make <texi-node>
       #:name name
       #:text (string-append
              (interface-doc-string (cdr interface) '())
              "\n\n"
-             "This grob interface is used in the following graphical objects: "
-             (human-listify
-              (map ref-ify
-                   (sort 
-                    (map symbol->string
-                         (hashq-ref iface->grob-table (car interface) '()))
-                    string<?)))
+             "This grob interface "
+             (if (equal? interface-list "none")
+                 "is not used in any graphical object"
+                 (string-append
+                  "is used in the following graphical object(s): "
+                  interface-list))
              "."))))
 
 (define (grob-alist->texi alist)
@@ -86,27 +115,41 @@ node."
         (name (cdr (assoc 'name meta)))
         ;;       (bla (display name))
         (ifaces (map lookup-interface (cdr (assoc 'interfaces meta))))
-        (ifacedoc (map (lambda (iface)
-                         (if (pair? iface)
-                             (ref-ify (symbol->string (car iface)))
-                             (ly:error (_ "pair expected in doc ~s") name)))
-                       (reverse ifaces)))
+        (ifacedoc (map ref-ify
+                       (sort
+                        (map (lambda (iface)
+                               (if (pair? iface)
+                                   (symbol->string (car iface))
+                                   (ly:error (_ "pair expected in doc ~s") name)))
+                             ifaces)
+                        ly:string-ci<?)))
         (engravers (filter
-                    (lambda (x) (engraver-makes-grob? name x)) all-engravers-list))
+                    (lambda (x) (engraver-makes-grob? name x))
+                    all-engravers-list))
         (namestr (symbol->string name))
-        (engraver-names (map symbol->string (map ly:translator-name engravers))))
+        (engraver-names (map symbol->string
+                             (map ly:translator-name engravers)))
+        (engraver-list (human-listify
+                        (map ref-ify
+                             (map engraver-name engraver-names)))))
 
     (make <texi-node>
       #:name namestr
       #:text
       (string-append
-       namestr " objects are created by: "
-       (human-listify (map ref-ify
-                          (map engraver-name engraver-names)))
-       "\n\nStandard settings: \n\n"
+       namestr " objects "
+       (if (equal? engraver-list "none")
+          "are not created by any engraver"
+          (string-append
+           "are created by: "
+           engraver-list))
+       "."
+
+       "\n\nStandard settings:\n\n"
        (grob-alist->texi description)
-       "\n\nThis object supports the following interfaces: \n"
-       (human-listify ifacedoc)))))
+       "\n\nThis object supports the following interface(s):\n"
+       (human-listify ifacedoc)
+       "."))))
 
 (define (all-grobs-doc)
   (make <texi-node>
@@ -121,7 +164,8 @@ node."
      (cons (cons key val)  prior))
    '() (ly:all-grob-interfaces)))
 
-(set! interface-description-alist (sort interface-description-alist alist<?))
+(set! interface-description-alist
+  (sort interface-description-alist ly:alist-ci<?))
 
 ;;;;;;;;;; check for dangling backend properties.
 (define (mark-interface-properties entry)
@@ -153,7 +197,7 @@ node."
     (map interface-doc interface-description-alist)))
 
 (define (backend-properties-doc-string lst)
-  (let* ((ps (sort (map symbol->string lst) string<?))
+  (let* ((ps (sort (map symbol->string lst) ly:string-ci<?))
         (descs (map (lambda (prop)
                       (property->texi 'backend (string->symbol prop) '())) ps))
         (texi (description-list->texi descs #f)))