Though strings count as markup according to the type predicate `markup?',
passing a string to a music function is currently only possible if the
type predicate is `string?' or `scm?'
This patch adds parser rules which support strings passed as markup, thus
making it easier to define music functions which default to using strings
unless extra formatting is required.
--- /dev/null
+\version "2.13.8"
+
+\header {
+ texidoc = "Music functions accept strings as markup arguments
+when using the type predicate @code{markup?}
+"
+}
+
+testFunc =
+#(define-music-function (parser location text music) (markup? ly:music?)
+ ;; dummy function, does nothing
+ music)
+
+\relative c' {
+ \testFunc "test string"
+ c2 <c \testFunc "test string" e>
+}
EXPECT_MARKUP function_arglist full_markup {
$$ = scm_cons ($3, $2);
}
+ | EXPECT_MARKUP function_arglist simple_string {
+ $$ = scm_cons ($3, $2);
+ }
| EXPECT_SCM function_arglist function_scm_argument {
$$ = scm_cons ($3, $2);
}
| EXPECT_MARKUP function_arglist_nonmusic full_markup {
$$ = scm_cons ($3, $2);
}
+ | EXPECT_MARKUP function_arglist_nonmusic simple_string {
+ $$ = scm_cons ($3, $2);
+ }
| EXPECT_SCM function_arglist_nonmusic function_scm_argument {
$$ = scm_cons ($3, $2);
}