From 33f71ee2c062b4e377e146920ef48ea8c41d6fe8 Mon Sep 17 00:00:00 2001 From: Neil Puttock Date: Fri, 22 Jul 2011 00:01:31 +0100 Subject: [PATCH] Add Notation appendix for context mod identifiers. * Documentation/notation/notation-appendices.itely: add node for context modifications * lily/context-mod.cc: add type predicate ly:context-mod? * ly/context-mods-init.ly (RemoveEmptyStaves): add docstring via \description * scm/document-context-mods.scm: new file for generating context-mod documentation * scm/document-identifiers.scm (identifier +;;;; +;;;; LilyPond is free software: you can redistribute it and/or modify +;;;; it under the terms of the GNU General Public License as published by +;;;; the Free Software Foundation, either version 3 of the License, or +;;;; (at your option) any later version. +;;;; +;;;; LilyPond is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;;; GNU General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU General Public License +;;;; along with LilyPond. If not, see . + +(use-modules (ice-9 format)) + +(define (grob-property-path path) + (string-join (map symbol->string path) " ")) + +(define (document-mod-list op) + (let ((tag (car op)) + (name-sym (cadr op)) + (args (cddr op))) + (case tag + ((push) + (let ((value (car args)) + (path (cdr args))) + (string-append + "@item Sets " + (format "grob property @code{~a} " + (grob-property-path path)) + (format "in @code{@rinternals{~a}} to ~a." + name-sym + (scm->texi value)) + "\n"))) + ((pop) + (string-append + "@item Reverts " + (format "grob property @code{~a} " + (grob-property-path (car args))) + (format "in @code{@rinternals{~a}}." + name-sym) + "\n")) + ((assign) + (format "@item Sets translator property @code{~a} to ~a.\n" + name-sym + (scm->texi (car args)))) + ((unset) + (format "@item Unsets translator property @code{~a}.\n" + name-sym)) + ((consists) + (format "@item Adds @code{@rinternals{~a}}.\n" name-sym)) + ((remove) + (format "@item Removes @code{@rinternals{~a}}.\n" name-sym)) + (else "")))) + +(define (document-context-mod context-mod-pair) + (let* ((name-sym (car context-mod-pair)) + (mod-list (ly:get-context-mods (cdr context-mod-pair))) + (docstring (filter (lambda (mod) + (eq? (car mod) 'description)) + mod-list))) + (format + "@item @code{~a} +@findex ~a +~a +@itemize +~{~a ~} +@end itemize +" + name-sym + name-sym + (if (pair? docstring) (cadar docstring) "(undocumented; fixme)") + (map document-mod-list mod-list)))) + +(define (document-mod obj-pair) + (cond + ((ly:context-mod? (cdr obj-pair)) + (document-context-mod obj-pair)) + (else + #f))) + +(define context-mods-doc-string + (format + "@table @asis +~a +@end table +" + (string-join + (filter + identity + (map + document-mod + (sort + (ly:module->alist (current-module)) + identifierstring (car a)) - (symbol->string (car b)))) - - (define-public (identifiers-doc-string) (format #f "@table @asis diff --git a/scm/documentation-generate.scm b/scm/documentation-generate.scm index b1d9fcda2d..b2aa9637b6 100644 --- a/scm/documentation-generate.scm +++ b/scm/documentation-generate.scm @@ -34,6 +34,7 @@ "document-music.scm" "document-type-predicates.scm" "document-identifiers.scm" + "document-context-mods.scm" "document-backend.scm" "document-markup.scm")) @@ -72,6 +73,9 @@ (identifiers-doc-string) (open-output-file "identifiers.tely")) +(display + context-mods-doc-string + (open-output-file "context-mod-identifiers.tely")) (display (backend-properties-doc-string all-user-grob-properties) diff --git a/scm/documentation-lib.scm b/scm/documentation-lib.scm index af48e55c6b..013cc2a437 100644 --- a/scm/documentation-lib.scm +++ b/scm/documentation-lib.scm @@ -175,6 +175,10 @@ string-to-use). If QUOTE? is #t, embed table in a @quotation environment." (define (writing-wip x) (ly:message (_ "Writing ~S...") x)) +(define (identifierstring (car a)) + (symbol->string (car b)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; property stuff. diff --git a/scripts/auxiliar/ref_check.tely b/scripts/auxiliar/ref_check.tely index 5d795eedfb..ed7363148e 100644 --- a/scripts/auxiliar/ref_check.tely +++ b/scripts/auxiliar/ref_check.tely @@ -15,6 +15,7 @@ Manual names and reference keywords: Files to be excluded (not available in git): @exclude colorado.itexi @exclude computer-notation.itexi +@exclude context-mod-identifiers.tely @exclude context-properties.tely @exclude engravingbib.itexi @exclude identifiers.tely diff --git a/scripts/build/website-known-missing-files.txt b/scripts/build/website-known-missing-files.txt index 4f4cd85bb0..941aa8cd11 100644 --- a/scripts/build/website-known-missing-files.txt +++ b/scripts/build/website-known-missing-files.txt @@ -2,6 +2,7 @@ ancient-notation.itely chords.itely colorado.itexi computer-notation.itexi +context-mod-identifiers.tely context-properties.tely contexts-and-engravers.itely editorial-annotations.itely -- 2.39.2