]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add Notation appendix for context mod identifiers.
authorNeil Puttock <n.puttock@gmail.com>
Thu, 21 Jul 2011 23:01:31 +0000 (00:01 +0100)
committerNeil Puttock <n.puttock@gmail.com>
Sun, 7 Aug 2011 14:19:39 +0000 (15:19 +0100)
* 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<?):

  move to documentation-lib.scm

* scm/documentation-generate.scm:

  load document-context-mods.scm and output documentation to
  context-mod-identifiers.tely

* scm/documentation-lib.scm (identifier<?):

  moved from document-identifiers.scm so it can be used in
  document-context-mods.scm too

* scripts/auxiliar/ref_check.tely:

  exclude context-mod-identifiers.tely

* scripts/build/website-known-missing-files.txt:

  add context-mod-identifiers.tely

Documentation/notation/notation-appendices.itely
lily/context-mod.cc
ly/context-mods-init.ly
scm/document-context-mods.scm [new file with mode: 0644]
scm/document-identifiers.scm
scm/documentation-generate.scm
scm/documentation-lib.scm
scripts/auxiliar/ref_check.tely
scripts/build/website-known-missing-files.txt

index 66a907f7096c49ddce8ae0bbb21ea7896d89f563..ded7f6e624c2e67ed63968731f8666e6b0e4e30a 100644 (file)
@@ -30,6 +30,7 @@
 * All context properties::
 * Layout properties::
 * Available music functions::
+* Context modification identifiers::
 * Predefined type predicates::
 * Scheme functions::
 @end menu
@@ -1375,6 +1376,13 @@ Internals Reference:
 
 @include identifiers.tely
 
+@node Context modification identifiers
+@appendixsec Context modification identifiers
+
+The following commands are defined for use as context modifications
+within a @code{\layout} or @code{\with} block.
+
+@include context-mod-identifiers.tely
 
 @node Predefined type predicates
 @appendixsec Predefined type predicates
index 200ba7c6dc209aebcf05508bbfc4223c11948d85..5fccf6c4d2985f5e865a33fb96f1f5a3d9300192 100644 (file)
@@ -32,6 +32,7 @@ Context_mod::Context_mod (Context_mod const &s)
 #include "ly-smobs.icc"
 IMPLEMENT_SIMPLE_SMOBS (Context_mod);
 IMPLEMENT_DEFAULT_EQUAL_P (Context_mod);
+IMPLEMENT_TYPE_P (Context_mod, "ly:context-mod?");
 
 int
 Context_mod::print_smob (SCM smob, SCM port, scm_print_state *)
index be3ade7e049818028a102aa5452f58d62feecb31..6d942d7e93e3d39f54edb6081b5369509c7b96de 100644 (file)
@@ -28,4 +28,6 @@ RemoveEmptyStaves = \with {
   \remove "Hara_kiri_engraver"
   \consists "Hara_kiri_engraver"
   \override VerticalAxisGroup #'remove-empty = ##t
+  \description "Remove staves which are considered to be empty according
+to the list of interfaces set by @code{keepAliveInterfaces}."
 }
diff --git a/scm/document-context-mods.scm b/scm/document-context-mods.scm
new file mode 100644 (file)
index 0000000..85f46de
--- /dev/null
@@ -0,0 +1,100 @@
+;;;; This file is part of LilyPond, the GNU music typesetter.
+;;;;
+;;;; Copyright (C) 2011 Neil Puttock <n.puttock@gmail.com>
+;;;;
+;;;; 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 <http://www.gnu.org/licenses/>.
+
+(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))
+       identifier<?)))
+    "")))
index b456acf334a14f6a4dc974ae9918813033259d20..838de55e558db9bad72d1fafc3972318dd2ce54a 100644 (file)
    (else
     #f)))
 
-
-(define (identifier<? a b)
-  (ly:string-ci<?
-   (symbol->string (car a))
-   (symbol->string (car b))))
-
-
 (define-public (identifiers-doc-string)
   (format #f
    "@table @asis
index b1d9fcda2ddac42f8128b880f5d34bf15982f91f..b2aa9637b66159a928b7809c415ab69cb9aeaeb9 100644 (file)
@@ -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)
index af48e55c6b51a32b40a1f1e223e5ef1daf62e2fb..013cc2a4377bc0b373db7364221feedc96fe6d95 100644 (file)
@@ -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 (identifier<? a b)
+  (ly:string-ci<?
+   (symbol->string (car a))
+   (symbol->string (car b))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; property  stuff.
index 5d795eedfb1ee98c51563d0af3e9d15bfec795f4..ed7363148ed5a64451be5f8260388a3d521e41ff 100644 (file)
@@ -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
index 4f4cd85bb075859a3bf56051ccab2096ce39c5ad..941aa8cd117ec28a064bfe6af7b404f1a1a1e147 100644 (file)
@@ -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