A partial markup acts as a chain of markup commands where everything but
the final markup has already been supplied.
For example:
bold-red-markup = \markup \bold \with-color #red \etc
\markup \bold-red "text"
\markuplist \column-lines \bold-red { One Two Three }
Please note that in order for \markup to recognize the resulting markup
command inside of markup expressions, the identifier to which the
resulting markup command is assigned needs to have "-markup" appended to
its name: LilyPond encodes markup command names in this manner so that
markup commands can use the same name as other entities outside of
markup mode.
Note also that this will not work with the markup macro since the latter
additionally requires the definition of a suitable make-bold-red-markup
command.
--- /dev/null
+\version "2.19.24"
+
+\header
+{ texidoc = "Partial markups acts as a chain of markup
+ commands where everything but the final markup has already been
+ supplied."
+}
+
+\layout { ragged-right = ##t }
+
+bold-red-markup = \markup \bold \with-color #red \etc
+
+\markup \bold-red "Single markup"
+\markuplist \column-lines \bold-red { Markups in a list. }
extern Variable multi_measure_rest;
extern Variable music_function;
extern Variable music_function_call_error;
extern Variable multi_measure_rest;
extern Variable music_function;
extern Variable music_function_call_error;
+ extern Variable partial_markup;
extern Variable partial_music_function;
extern Variable property_operation;
extern Variable repeat;
extern Variable partial_music_function;
extern Variable property_operation;
extern Variable repeat;
Variable multi_measure_rest ("multi-measure-rest");
Variable music_function ("music-function");
Variable music_function_call_error ("music-function-call-error");
Variable multi_measure_rest ("multi-measure-rest");
Variable music_function ("music-function");
Variable music_function_call_error ("music-function-call-error");
+ Variable partial_markup ("partial-markup");
Variable partial_music_function ("partial-music-function");
Variable property_operation ("property-operation");
Variable repeat ("repeat");
Variable partial_music_function ("partial-music-function");
Variable property_operation ("property-operation");
Variable repeat ("repeat");
$$ = parser->lexer_->eval_scm_token ($1, @1);
}
| FRACTION
$$ = parser->lexer_->eval_scm_token ($1, @1);
}
| FRACTION
| full_markup_list
| context_modification
| score_block
| full_markup_list
| context_modification
| score_block
| FRACTION
| string
| embedded_scm
| FRACTION
| string
| embedded_scm
| full_markup_list
| context_modification
| partial_function ETC
| full_markup_list
| context_modification
| partial_function ETC
- { parser->lexer_->push_markup_state (); }
- markup_top {
- $$ = $3;
+ {
+ parser->lexer_->push_markup_state ();
+ }
+ ;
+
+full_markup:
+ markup_mode markup_top {
+ $$ = $2;
+ parser->lexer_->pop_state ();
+ }
+ ;
+
+partial_markup:
+ markup_mode markup_head_1_list ETC
+ {
+ $$ = MAKE_SYNTAX (partial_markup, @2, $2);
parser->lexer_->pop_state ();
}
;
parser->lexer_->pop_state ();
}
;
(make-map-markup-commands-markup-list
compose complex) completed))))))))
(make-map-markup-commands-markup-list
compose complex) completed))))))))
+(define-public (partial-markup commands)
+ ;; Like composed-markup-list, except that the result is a single
+ ;; markup command that can be applied to one markup
+ (define (compose arg)
+ (fold
+ (lambda (cmd prev) (append cmd (list prev)))
+ arg
+ commands))
+ (let ((chain (lambda (layout props arg)
+ (interpret-markup layout props (compose arg)))))
+ (set-object-property! chain 'markup-signature (list markup?))
+ chain))
+
(define-public (property-operation ctx music-type symbol . args)
(let* ((props (case music-type
((PropertySet) (list 'value (car args)))
(define-public (property-operation ctx music-type symbol . args)
(let* ((props (case music-type
((PropertySet) (list 'value (car args)))