]> git.donarmstrong.com Git - lilypond.git/commitdiff
Make \footnote a post-event
authorDavid Kastrup <dak@gnu.org>
Sun, 6 May 2012 18:53:51 +0000 (20:53 +0200)
committerDavid Kastrup <dak@gnu.org>
Fri, 11 May 2012 10:18:57 +0000 (12:18 +0200)
ly/music-functions-init.ly
python/convertrules.py
scm/define-music-types.scm

index 59a11264f7c741d84d3c854494adfd3f8cdfad2c..842da9ace606dc026169808b6b5e664603cfc214 100644 (file)
@@ -342,7 +342,7 @@ featherDurations=
      argument))
 
 footnote =
-#(define-music-function (parser location text offset grob-name footnote)
+#(define-event-function (parser location text offset grob-name footnote)
    ((markup?) number-pair? (symbol? '()) markup?)
    (_i "Attach @var{text} at @var{offset} with @var{text} referring to
 @var{footnote}.  If @var{text} is given as @code{\\default}, use
index 5c94c59e1f7a88a42aa4cad91598cff460f37965..acabe0237e452869b4648caf98180af7c8ace815 100644 (file)
@@ -3346,6 +3346,25 @@ def conv (str):
                   sub_tempo, str)
     return str
 
+@rule((2, 15, 39), r"\footnote -> <>\footnote, -\footnote -> \footnote")
+def conv (str):
+    def not_first (s):
+        def match_fun (m):
+            if m.group (1):
+                return m.group (0)
+            return m.expand (s)
+        return match_fun
+    str = re.sub ("(" + matchmarkup + ")|"
+                  + r"(?<![-_^])((?:[-_^][-_^])*)(\\footnote(?:\s*"
+                  + matchmarkup + ")?" + matcharg + "(?:" + matcharg
+                  + ")?\s+" + matchmarkup + ")",
+                  not_first (r"\2<>\3"), str)
+    str = re.sub ("(" + matchmarkup + ")|"
+                  + r"(?<![-_^])((?:[-_^][-_^])*)-(\\footnote(?:\s*"
+                  + matchmarkup + ")?" + matcharg + "(?:" + matcharg
+                  + ")?\s+" + matchmarkup + ")",
+                  not_first (r"\2\3"), str)
+    return str
 
 # Guidelines to write rules (please keep this at the end of this file)
 #
index 0b828c1516c161f78e1a98d67b37954d629b64a5..658027c88c24a6dd5f545c9aac71bc4a0f1e2901 100644 (file)
@@ -228,7 +228,7 @@ duration stored in @code{duration}.")
 
     (FootnoteEvent
      . ((description . "Footnote a grob.")
-       (types . (general-music event footnote-event))
+       (types . (general-music event post-event footnote-event))
        ))
 
     (GlissandoEvent