real lists.
* lily/lexer.ll: remove < > from markup lexer mode.
* scm/new-markup.scm (map-markup-command-list): helper function
used in parser.yy to map markup commands on a markup list.
* scripts/convert-ly.py (conv): add rule for converting
\markup < > to \markup { }
* ly/titling-init.ly:
* input/test/coriolan-margin.ly:
* input/regression/new-markup-syntax.ly:
* input/regression/new-markup-scheme.ly:
* input/regression/multi-measure-rest-text.ly:
* input/regression/markup-stack.ly:
* input/regression/markup-score.ly:
* input/regression/instrument-name-markup.ly:
* input/mutopia/W.A.Mozart/mozart-hrn-3.ly:
* input/mutopia/R.Schumann/romanze-op28-2.ly:
* input/mutopia/J.S.Bach/wtk1-fugue2.ly:
* input/wilhelmus.ly:
* Documentation/user/notation.itely:
* Documentation/user/music-glossary.tely:
* Documentation/user/changing-defaults.itely: change < > to { } in
markups
+2004-11-28 Nicolas Sceaux <nicolas.sceaux@free.fr>
+
+ * scm/new-markup.scm (map-markup-command-list): helper function
+ used in parser.yy to map markup commands on a markup list.
+
+ * lily/parser.yy: get rid off < > in markups by treating { } as
+ real lists.
+
+ * lily/lexer.ll: remove < > from markup lexer mode.
+
+ * scripts/convert-ly.py (conv): add rule for converting
+ \markup < > to \markup { }
+
+ * ly/titling-init.ly:
+ * input/test/coriolan-margin.ly:
+ * input/regression/new-markup-syntax.ly:
+ * input/regression/new-markup-scheme.ly:
+ * input/regression/multi-measure-rest-text.ly:
+ * input/regression/markup-stack.ly:
+ * input/regression/markup-score.ly:
+ * input/regression/instrument-name-markup.ly:
+ * input/mutopia/W.A.Mozart/mozart-hrn-3.ly:
+ * input/mutopia/R.Schumann/romanze-op28-2.ly:
+ * input/mutopia/J.S.Bach/wtk1-fugue2.ly:
+ * input/wilhelmus.ly:
+ * Documentation/user/notation.itely:
+ * Documentation/user/music-glossary.tely:
+ * Documentation/user/changing-defaults.itely: change < > to { } in
+ markups
+
2004-11-28 Han-Wen Nienhuys <hanwen@xs4all.nl>
* lily/accidental-placement.cc (position_accidentals): shortcut if
@unnumbered New features in 2.5 since 2.4
@itemize @bullet
+@item
+In markups, expressions stacked with @code{\column},
+@code{\center-align}, etc, are not grouped with @code{< ... >} anymore,
+but with @code{@{ ... @}}, eg:
+@example
+\markup \column @{ @{ first line @} @{ second line @} @}
+@end example
+
@item
LilyPond will now avoid line breaks that cause long texts to stick
outside of the page staff.
In markup mode you can compose expressions, similar to mathematical
expressions, XML documents, and music expressions. The braces group
notes into horizontal lines. Other types of lists also exist: you can
-stack expressions grouped with @code{<} and @code{>} vertically with
+stack expressions grouped vertically with
the command @code{\column}. Similarly, @code{\center-align} aligns
texts by their center lines:
@lilypond[quote,verbatim,fragment,relative=1]
-c1^\markup { \column < a bbbb c > }
-c1^\markup { \center-align < a bbbb c > }
-c1^\markup { \line < a b c > }
+c1^\markup { \column { a bbbb c } }
+c1^\markup { \center-align { a bbbb c } }
+c1^\markup { \line { a b c } }
@end lilypond
d1 |
g,4^\segno a b c |
b a g2_\markup{
- \line < "d.s. " \tiny \raise #1 \musicglyph #"scripts-segno" > }
+ \line { "d.s. " \tiny \raise #1 \musicglyph #"scripts-segno" } }
\bar "|."
}
@end lilypond
@lilypond[quote,fragment,verbatim,raggedright]
\set Staff.instrument = \markup {
- \column < "Clarinetti"
- { "in B" \smaller \flat } > }
+ \column { "Clarinetti"
+ { "in B" \smaller \flat } } }
c''1
@end lilypond
{
\fatText
s^\markup {
- \column <
+ \column {
"vaticana"
{ " " \musicglyph #"accidentals-vaticana-1"
" " \musicglyph #"accidentals-vaticana0" }
- >
- \column <
+ }
+ \column {
"medicaea"
{ " " \musicglyph #"accidentals-medicaea-1" }
- >
- \column <
+ }
+ \column {
"hufnagel"
{ " " \musicglyph #"accidentals-hufnagel-1" }
- >
- \column <
+ }
+ \column {
"mensural"
{ " " \musicglyph #"accidentals-mensural-1"
" " \musicglyph #"accidentals-mensural1" }
- >
+ }
}
}
\layout {
@lilypond[quote,raggedright,fragment]
\new Lyrics \lyricmode {
- \markup { \column <
+ \markup { \column {
\typewriter "vaticana"
{ " " \musicglyph #"custodes-vaticana-u0" }
- > }
- \markup { \column <
+ } }
+ \markup { \column {
\typewriter "medicaea"
{ " " \musicglyph #"custodes-medicaea-u0" }
- >}
- \markup { \column <
+ }}
+ \markup { \column {
\typewriter "hufnagel"
{ " " \musicglyph #"custodes-hufnagel-u0" }
- >}
- \markup { \column <
+ }}
+ \markup { \column {
\typewriter "mensural"
{ " " \musicglyph #"custodes-mensural-u0" }
- >}
+ }}
}
@end lilypond
% create 2/4 + 5/8
tsMarkup =\markup {
\number {
- \column < "2" "4" >
+ \column { "2" "4" }
\musicglyph #"scripts-stopped"
- \bracket \column < "5" "8" >
+ \bracket \column { "5" "8" }
}
}
footer = "Mutopia-2002/08/19-6"
tagline = \markup { \smaller
- \column <
- \fill-line < \footer "" >
- \fill-line < { "This music is part of the Mutopia project, "
+ \column {
+ \fill-line { \footer "" }
+ \fill-line { { "This music is part of the Mutopia project, "
\typewriter { "http://sca.uwaterloo.ca/Mutopia/" }
- "." } >
- \fill-line < { "It has been typeset and placed in the public "
- "domain by " \maintainer "." } >
- \fill-line < { "Unrestricted modification and redistribution "
+ "." } }
+ \fill-line { { "It has been typeset and placed in the public "
+ "domain by " \maintainer "." } }
+ \fill-line { { "Unrestricted modification and redistribution "
"is permitted and encouraged---copy this music "
- "and share it!" } >
- >
+ "and share it!" } }
+ }
}
lastupdated = "2002/August/19"
}
%}
-\version "2.4.0"
+\version "2.5.2"
#(set-global-staff-size 16)
-\version "2.4.0"
+\version "2.5.2"
\header {
title = "Romanzen"
\override Staff.InstrumentName #'font-magnification = #1
\override Staff.InstrumentName #'extra-offset = #'(0 . 6)
% \set Staff.instrument = "\\begin{turn}{-90}{Rechte Hand}\\end{turn}"
- \set Staff.instrument = \markup { \column < Rechte Hand > \hspace #2 }
+ \set Staff.instrument = \markup { \column { Rechte Hand } \hspace #2 }
\clef F <<\global \context Voice = "midv" \rightb>>
}
\context Staff = "down" {
footer = "Mutopia-2002/05/21-25"
tagline = \markup { \smaller
- \column <
- \fill-line < \footer "" >
- \fill-line < { "This music is part of the Mutopia project,"
+ \column {
+ \fill-line { \footer "" }
+ \fill-line { { "This music is part of the Mutopia project,"
\typewriter { "http://sca.uwaterloo.ca/Mutopia/" }
- } >
- \fill-line < #(ly:export (string-append "It has been typeset and placed in the public "
- "domain by " maintainer ".")) >
- \fill-line < #(ly:export (string-append "Unrestricted modification and redistribution"
+ } }
+ \fill-line { #(ly:export (string-append "It has been typeset and placed in the public "
+ "domain by " maintainer ".")) }
+ \fill-line { #(ly:export (string-append "Unrestricted modification and redistribution"
" is permitted and encouraged---copy this music"
- " and share it!")) >
- >
+ " and share it!")) }
+ }
}
}
%{
%}
-\version "2.4.0"
+\version "2.5.2"
\include "mozart-hrn3-defs.ily"
\include "mozart-hrn3-allegro.ily"
}
-\version "2.4.0"
+\version "2.5.2"
textFlat = \markup {\smaller \flat}
\score {
\new Staff {
- \set Staff.instrument = \markup { \column < "Clarinetti" { "in B" \textFlat } > }
+ \set Staff.instrument = \markup { \column { "Clarinetti" { "in B" \textFlat } } }
\set Staff.instr = \markup { \smaller { "Cl(B" \textFlat ")" } }
{ c''1 \break c'' }
texidoc = "Use \\score block as markup command."
}
-\version "2.4.0"
+\version "2.5.2"
tuning = \markup {
\score {
\header {
title = "Solo Cello Suites"
subtitle = "Suite IV"
- subsubtitle = \markup { \fill-line < { "Originalstimmung: " \tuning } > }
+ subsubtitle = \markup { \fill-line { { "Originalstimmung: " \tuning } } }
}
\relative {
-\version "2.4.0"
+\version "2.5.2"
\header {texidoc="Markup scripts may be stacked."}
\layout { raggedright = ##t}
-\score { { c''^\markup { "a" \column < "1" \bold "2" "3" > } } }
+\score { { c''^\markup { "a" \column { "1" \bold "2" "3" } } } }
-\version "2.4.0"
+\version "2.5.2"
\header {
\score { {
\time 3/4
\set Score.skipBars = ##t
- R2._\markup { \center-align < \musicglyph #"scripts-dfermata" \roman "Ad lib" > }
+ R2._\markup { \center-align { \musicglyph #"scripts-dfermata" \roman "Ad lib" } }
R2.^\fermataMarkup
R2.^"4"
R2.*3_\markup { \roman "a1b2c3" }
texts using a similar syntax as @code{\\markup}."
}
-\version "2.4.0"
+\version "2.5.2"
\score {
{
\fatText
\raise #0.2 \hbracket \bold bar
\override #'(baseline-skip . 4)
- \bracket \column < baz bazr bla >
+ \bracket \column { baz bazr bla }
\hspace #2.0
\override #'(font-family . music) {
\lookup #"noteheads-0"
\musicglyph #"accidentals--1"
\combine "X" "+"
\combine "o" "/"
- \box \column < { "string 1" } { "string 2" } >
+ \box \column { { "string 1" } { "string 2" } }
"$\\emptyset$"
\italic Norsk
\super "2"
texidoc = "With the new markup syntax, text may be written in various manners."
}
-\version "2.4.0"
+\version "2.5.2"
\score {
\raise #0.2 \hbracket \bold bar
\override #'(baseline-skip . 4)
- \bracket \column < baz bazr bla >
+ \bracket \column { baz bazr bla }
\hspace #2.0
\override #'(font-family . music) {
\lookup #"noteheads-0"
\combine "X" "+"
\combine "o" "/"
% \char-number #"abc1234abc"
- \box \column < { "string 1" } { "string 2" } >
+ \box \column { { "string 1" } { "string 2" } }
"$\\emptyset$"
\italic Norsk
\super "2"
-\version "2.4.0"
+\version "2.5.2"
% Ugh, we need to override some LaTeX titling stuff
}
clarinetti = \relative c' {
- \set Staff.instrument = \markup { \column < "Clarinetti" { "in B" \raisedFlat } > }
+ \set Staff.instrument = \markup { \column { "Clarinetti" { "in B" \raisedFlat } } }
\set Staff.instr = \markup { \smaller { "Cl(B" \raisedFlat ")" } }
c1 c
}
corni = \relative c' {
- \set Staff.instrument = \markup { \column < "Corni" { "in E" \raisedFlat } > }
+ \set Staff.instrument = \markup { \column { "Corni" { "in E" \raisedFlat } } }
\set Staff.instr = \markup { \smaller { "Cor(E" \raisedFlat ")" } }
c1 c
}
trombe = \relative c' {
- \set Staff.instrument = \markup \column < "2 Trombe" "(C)" >
- \set Staff.instr = \markup \column < "Tbe." "(C)" >
+ \set Staff.instrument = \markup \column { "2 Trombe" "(C)" }
+ \set Staff.instr = \markup \column { "Tbe." "(C)" }
c1 c
}
timpani = \relative c' {
- \set Staff.instrument = \markup \column < "Timpani" "(C-G)" >
+ \set Staff.instrument = \markup \column { "Timpani" "(C-G)" }
\set Staff.instr = #"Timp."
c1 c
}
violoncello = \relative c' {
- \set Staff.instrument = \markup \column < "Violoncello" "e" "Contrabasso" >
- \set Staff.instr = \markup \column < "Vc." "Cb." >
+ \set Staff.instrument = \markup \column { "Violoncello" "e" "Contrabasso" }
+ \set Staff.instr = \markup \column { "Vc." "Cb." }
c1 c
}
-\version "2.4.0"
+\version "2.5.2"
%{
Markup titles also available for direct PostScript output:
}
sizeTest = \markup {
- \column <
+ \column {
{ \normalsize "normalsize"
\hspace #5
\smaller "smaller"
\hspace #5
\bigger \bigger \bigger "bigger"
}
- >
+ }
}
\encoding "latin1"
piece = "Piece"
%% Override automatic book title
- %% bookTitle = \markup { \fill-line < \huge\bold \title > > }
+ %% bookTitle = \markup { \fill-line { \huge\bold \title } }
}
\book {
-\version "2.4.0"
+\version "2.5.2"
\header {
texidoc = "Wilhelmus van Nassouwe"
oneHalfNoteTime = \markup {
\override #'(baseline-skip . 0)
- \column < { \number "1" } { \smaller \smaller \note #"2" #-0.5 } >
+ \column { { \number "1" } { \smaller \smaller \note #"2" #-0.5 } }
}
\layout {
\" {
start_quote ();
}
- \< {
- return '<';
- }
- \> {
- return '>';
- }
\\score {
return SCORE;
}
[{}] {
return YYText ()[0];
}
- [^<>#{}"\\ \t\n\r\f]+ {
+ [^#{}"\\ \t\n\r\f]+ {
String s (YYText ());
char c = s[s.length () - 1];
%type <scm> Generic_prefix_music_scm
%type <scm> lyric_element
%type <scm> Alternative_music
-%type <scm> markup markup_line markup_list markup_list_body full_markup
+%type <scm> full_markup markup_composed_list markup_braced_list markup_braced_list_body markup_head_1_item markup_head_1_list markup simple_markup markup_top
%type <scm> mode_changing_head
%type <scm> mode_changing_head_with_context
%type <scm> object_id_setting
| questions '?' { $$ ++; }
;
-
+/*
+This should be done more dynamically if possible.
+*/
full_markup:
MARKUP_IDENTIFIER {
$$ = $1;
- }
+ }
| MARKUP
{ THIS->lexer_->push_markup_state (); }
- markup
- { $$ = $3;
- THIS->lexer_->pop_state ();
- }
+ markup_top {
+ $$ = $3;
+ THIS->lexer_->pop_state ();
+ }
;
-
-/*
-This should be done more dynamically if possible.
-*/
-markup:
- STRING {
- $$ = make_simple_markup (THIS->lexer_->encoding (), $1);
+markup_top:
+ markup_composed_list {
+ $$ = scm_list_2 (ly_scheme_function ("line-markup"), $1);
}
- | MARKUP_HEAD_EMPTY {
- $$ = scm_list_1 ($1);
+ | markup_head_1_list simple_markup {
+ $$ = scm_car (scm_call_2 (ly_scheme_function ("map-markup-command-list"), $1, scm_list_1 ($2)));
}
- | MARKUP_HEAD_MARKUP0 markup {
- $$ = scm_list_2 ($1, $2);
+ | simple_markup {
+ $$ = $1;
}
- | MARKUP_HEAD_MARKUP0_MARKUP1 markup markup {
- $$ = scm_list_3 ($1, $2, $3);
+ | markup_braced_list {
+ $$ = scm_list_2 (ly_scheme_function ("line-markup"), $1);
}
- | MARKUP_HEAD_SCM0_MARKUP1 SCM_T markup {
- $$ = scm_list_3 ($1, $2, $3);
+ ;
+
+markup_composed_list:
+ markup_head_1_list markup_braced_list {
+ $$ = scm_call_2 (ly_scheme_function ("map-markup-command-list"), $1, $2);
+
}
- | markup_line {
- $$ = $1;
+ ;
+
+markup_braced_list:
+ '{' markup_braced_list_body '}' {
+ $$ = scm_reverse_x ($2, SCM_EOL);
}
- | MARKUP_HEAD_LIST0 markup_list {
- $$ = scm_list_2 ($1,$2);
+ ;
+
+markup_braced_list_body:
+ /* empty */ { $$ = scm_list (SCM_EOL); }
+ | markup_braced_list_body markup {
+ $$ = scm_cons ($2, $1);
}
- | MARKUP_HEAD_SCM0 embedded_scm {
- $$ = scm_list_2 ($1, $2);
+ | markup_braced_list_body markup_composed_list {
+ $$ = scm_append_x (scm_list_2 (scm_reverse_x ($2, SCM_EOL), $1));
}
- | MARKUP_HEAD_SCM0_SCM1_MARKUP2 embedded_scm embedded_scm markup {
- $$ = scm_list_4 ($1, $2, $3, $4);
+ ;
+
+markup_head_1_item:
+ MARKUP_HEAD_MARKUP0 {
+ $$ = scm_list_1 ($1);
}
- | MARKUP_HEAD_SCM0_SCM1_SCM2 embedded_scm embedded_scm embedded_scm {
- $$ = scm_list_4 ($1, $2, $3, $4);
+ | MARKUP_HEAD_SCM0_MARKUP1 embedded_scm {
+ $$ = scm_list_2 ($1, $2);
}
- | MARKUP_HEAD_SCM0_SCM1 embedded_scm embedded_scm {
+ | MARKUP_HEAD_SCM0_SCM1_MARKUP2 embedded_scm embedded_scm {
$$ = scm_list_3 ($1, $2, $3);
}
+ ;
+
+markup_head_1_list:
+ markup_head_1_item {
+ $$ = scm_list_1 ($1);
+ }
+ | markup_head_1_list markup_head_1_item {
+ $$ = scm_cons ($2, $1);
+ }
+ ;
+
+simple_markup:
+ STRING {
+ $$ = make_simple_markup (THIS->lexer_->encoding (), $1);
+ }
| MARKUP_IDENTIFIER {
$$ = $1;
}
scm_gc_unprotect_object (sc->self_scm ());
THIS->lexer_->pop_state ();
}
+ | MARKUP_HEAD_SCM0 embedded_scm {
+ $$ = scm_list_2 ($1, $2);
+ }
+ | MARKUP_HEAD_SCM0_SCM1_SCM2 embedded_scm embedded_scm embedded_scm {
+ $$ = scm_list_4 ($1, $2, $3, $4);
+ }
+ | MARKUP_HEAD_SCM0_SCM1 embedded_scm embedded_scm {
+ $$ = scm_list_3 ($1, $2, $3);
+ }
+ | MARKUP_HEAD_EMPTY {
+ $$ = scm_list_1 ($1);
+ }
+ | MARKUP_HEAD_LIST0 markup_braced_list {
+ $$ = scm_list_2 ($1,$2);
+ }
+ | MARKUP_HEAD_MARKUP0_MARKUP1 markup markup {
+ $$ = scm_list_3 ($1, $2, $3);
+ }
;
-
-markup_list:
- chord_open markup_list_body chord_close { $$ = scm_reverse_x ($2, SCM_EOL); }
- ;
-
-markup_line:
- '{' markup_list_body '}' {
- SCM line = ly_scheme_function ("line-markup");
- $$ = scm_list_2 (line, scm_reverse_x ($2, SCM_EOL));
+markup:
+ markup_head_1_list simple_markup {
+ $$ = scm_car (scm_call_2 (ly_scheme_function ("map-markup-command-list"), $1, scm_list_1 ($2)));
}
- ;
-
-markup_list_body:
- /**/ { $$ = SCM_EOL; }
- | markup_list_body markup {
- $$ = scm_cons ($2, $1);
+ | simple_markup {
+ $$ = $1;
+ }
+ | markup_braced_list {
+ $$ = scm_list_2 (ly_scheme_function ("line-markup"), $1);
}
;
-
%%
void
bookTitleMarkup = \markup {
- \column <
- \fill-line < \fromproperty #'header:dedication >
- \fill-line <
+ \column {
+ \fill-line { \fromproperty #'header:dedication }
+ \fill-line {
\huge \bigger \bigger \bigger \bold \fromproperty #'header:title
- >
- \fill-line <
+ }
+ \fill-line {
\override #'(baseline-skip . 3)
- \column <
- \fill-line <
+ \column {
+ \fill-line {
\huge \bigger \bigger
\bold \fromproperty #'header:subtitle
- >
- \fill-line <
+ }
+ \fill-line {
\huge \bigger
\bold \fromproperty #'header:subsubtitle
- >
- >
- >
- \fill-line <
+ }
+ }
+ }
+ \fill-line {
\fromproperty #'header:poet
\fromproperty #'header:instrument
- \column <
+ \column {
\fromproperty #'header:composer
\fromproperty #'header:arranger
- >
- >
- >
+ }
+ }
+ }
}
scoreTitleMarkup = \markup {
- \fill-line <
+ \fill-line {
\fromproperty #'header:piece
\fromproperty #'header:opus
- >
+ }
}
oddHeaderMarkup = \markup
-\fill-line <
+\fill-line {
""
\fromproperty #'header:instrument
\fromproperty #'page:page-number-string
->
+}
evenHeaderMarkup = \markup
-\fill-line <
+\fill-line {
\fromproperty #'page:page-number-string
\fromproperty #'header:instrument
""
->
+}
oddFooterMarkup = \markup {
- \column <
- \fill-line <
+ \column {
+ \fill-line {
% put copyright only on pagenr. 1
\on-the-fly #(lambda (layout props arg)
empty-stencil
))
\fromproperty #'header:copyright
- >
- \fill-line <
+ }
+ \fill-line {
% put tagline only on last page
\on-the-fly #(lambda (layout props arg)
(if (chain-assoc-get 'page:last? props #f)
empty-stencil
))
\fromproperty #'header:tagline
- >
- >
+ }
+ }
}
(let ((proc (markup-symbol-to-proc (string->symbol (string-append code "-markup")))))
(and proc (cons proc (markup-command-keyword proc)))))
+;;;;;;;;;;;;;;;;;;;;;;
+;;; used in parser.yy to map a list of markup commands on markup arguments
+(define-public (map-markup-command-list commands markups)
+ "`markups' being a list of markups, eg (markup1 markup2 markup3),
+and `commands' a list of commands with their scheme arguments, in reverse order,
+eg: ((italic) (raise 4) (bold)), maps the commands on each markup argument, eg:
+ ((bold (raise 4 (italic markup1)))
+ (bold (raise 4 (italic markup2)))
+ (bold (raise 4 (italic markup3))))
+"
+ (map-in-order (lambda (arg)
+ (let ((result arg))
+ (for-each (lambda (cmd)
+ (set! result (append cmd (list result))))
+ commands)
+ result))
+ markups))
+
;;;;;;;;;;;;;;;;;;;;;;
;;; markup type predicates
conv,
'ly:import-module -> ly:module-copy'))
+def conv (str):
+ str = re.sub (r'\\(column|fill-line|dir-column|center-align|right-align|left-align|bracketed-y-column)\s*<([^<]*)>',
+ r'\\\1 {\2}', str)
+ str = re.sub (r'\\(column|fill-line|dir-column|center-align|right-align|left-align|bracketed-y-column)\s*<([^<]*)>',
+ r'\\\1 {\2}', str)
+ str = re.sub (r'\\(column|fill-line|dir-column|center-align|right-align|left-align|bracketed-y-column)\s*<([^<]*)>',
+ r'\\\1 {\2}', str)
+ return str
+conversions.append (((2, 5, 2),
+ conv,
+ '\markup .. < .. > .. -> \markup .. { .. } ..'))
################################
# END OF CONVERSIONS