X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fdocument-backend.scm;h=0ba63b2cfc46163b41850d7e8221a436c61b99c8;hb=HEAD;hp=71ba5a274fa616c3bbf111fab909af2f0eab4657;hpb=08560a1b8076630c4fc6cb9b902614d8b74fd6fc;p=lilypond.git diff --git a/scm/document-backend.scm b/scm/document-backend.scm index 71ba5a274f..0ba63b2cfc 100644 --- a/scm/document-backend.scm +++ b/scm/document-backend.scm @@ -1,6 +1,6 @@ ;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; Copyright (C) 2000--2012 Han-Wen Nienhuys +;;;; Copyright (C) 2000--2015 Han-Wen Nienhuys ;;;; Jan Nieuwenhuizen ;;;; ;;;; LilyPond is free software: you can redistribute it and/or modify @@ -16,104 +16,107 @@ ;;;; You should have received a copy of the GNU General Public License ;;;; along with LilyPond. If not, see . -(define (sort-grob-properties x) +(define (sort-grob-properties props) ;; force 'meta to the end of each prop-list - (let ((meta (assoc 'meta x))) - (append (sort (assoc-remove! x 'meta) ly:alist-citexi - 'backend pr grob-description))) - (iprops (filter (lambda (x) (object-property x 'backend-internal)) - props)) - (uprops (filter - (lambda (x) (not (object-property x 'backend-internal))) - props)) - (user-propdocs (map docfunc uprops)) - (internal-propdocs (map docfunc iprops))) + (desc (cadr interface)) + (props (caddr interface)) + (docfunc (lambda (pr) + (property->texi + 'backend pr grob-description))) + (iprops (filter (lambda (x) (object-property x 'backend-internal)) + props)) + (uprops (filter + (lambda (x) (not (object-property x 'backend-internal))) + props)) + (user-propdocs (map docfunc uprops)) + (internal-propdocs (map docfunc iprops))) (string-append desc (if (pair? uprops) - (string-append - "\n\n@subsubheading User settable properties:\n" - (description-list->texi user-propdocs #t)) - "") + (string-append + "\n\n@subsubheading User settable properties:\n" + (description-list->texi user-propdocs #t)) + "") (if (pair? iprops) - (string-append - "\n\n@subsubheading Internal properties:\n" - (description-list->texi internal-propdocs #t)) - "")))) + (string-append + "\n\n@subsubheading Internal properties:\n" + (description-list->texi internal-propdocs #t)) + "")))) (define iface->grob-table (make-hash-table 61)) ;; extract ifaces, and put grob into the hash table. -(map +(for-each (lambda (x) (let* ((meta (assoc-get 'meta (cdr x))) - (ifaces (assoc-get 'interfaces meta))) - - (map (lambda (iface) - (hashq-set! - iface->grob-table iface - (cons (car x) - (hashq-ref iface->grob-table iface '())))) - ifaces))) + (ifaces (assoc-get 'interfaces meta))) + + (for-each (lambda (iface) + (hashq-set! + iface->grob-table iface + (cons (car x) + (hashq-ref iface->grob-table iface '())))) + ifaces))) all-grob-descriptions) ;; First level Interface description (define (interface-doc 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-cistring + (hashq-ref iface->grob-table + (car interface) + '())) + ly:string-ci #:name name #:text (string-append - (interface-doc-string (cdr interface) '()) - "\n\n" - "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)) - ".")))) + (interface-doc-string (cdr interface) '()) + "\n\n" + "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) (let* ((uprops (filter (lambda (x) (not (object-property x 'backend-internal))) - (map car alist)))) + (map car alist)))) (description-list->texi (map (lambda (y) (property->texi 'backend y alist)) - uprops) + uprops) #t))) (define (grob-doc description) @@ -121,26 +124,26 @@ node." (let* ((meta (assoc-get 'meta description)) - (name (assoc-get 'name meta)) - ;; (bla (display name)) - (ifaces (map lookup-interface (assoc-get 'interfaces meta))) - (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-cistring name)) - (engraver-names (map symbol->string - (map ly:translator-name engravers))) - (engraver-list (human-listify - (map ref-ify - (map engraver-name engraver-names))))) + (name (assoc-get 'name meta)) + ;; (bla (display name)) + (ifaces (map lookup-interface (assoc-get 'interfaces meta))) + (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-cistring name)) + (engraver-names (map symbol->string + (map ly:translator-name engravers))) + (engraver-list (human-listify + (map ref-ify + (map engraver-name engraver-names))))) (make #:name namestr @@ -148,13 +151,13 @@ node." (string-append namestr " objects " (if (equal? engraver-list "none") - "are not created by any engraver" - (string-append - "are created by: " - engraver-list)) + "are not created by any engraver" + (string-append + "are created by: " + engraver-list)) "." - "\n\nStandard settings:\n\n" + "\n\nStandard settings:\n" (grob-alist->texi description) "\n\nThis object supports the following interface(s):\n" (human-listify ifacedoc) @@ -173,30 +176,40 @@ node." (cons (cons key val) prior)) '() (ly:all-grob-interfaces))) +;; sort user-settable and internal props within each grob-interface (set! interface-description-alist - (sort interface-description-alist ly:alist-ci @@ -207,9 +220,9 @@ node." (define (backend-properties-doc-string lst) (let* ((ps (sort (map symbol->string lst) ly:string-citexi 'backend (string->symbol prop) '())) ps)) - (texi (description-list->texi descs #f))) + (descs (map (lambda (prop) + (property->texi 'backend (string->symbol prop) '())) ps)) + (texi (description-list->texi descs #f))) texi)) ;;(dump-node (grob-doc (cdadr all-grob-descriptions)) (current-output-port) 0 )