From: Nicolas Sceaux Date: Sun, 28 Nov 2004 17:50:32 +0000 (+0000) Subject: * lily/parser.yy: get rid off < > in markups by treating { } as X-Git-Tag: release/2.5.14~478 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=3d04206a83222e89d99ddf1a0766b6b74f158967;p=lilypond.git * lily/parser.yy: get rid off < > in markups by treating { } as 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 --- diff --git a/ChangeLog b/ChangeLog index f7b206304a..6b14efbfcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +2004-11-28 Nicolas Sceaux + + * 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 * lily/accidental-placement.cc (position_accidentals): shortcut if diff --git a/Documentation/topdocs/NEWS.texi b/Documentation/topdocs/NEWS.texi index 4f57ab6251..68edfa400a 100644 --- a/Documentation/topdocs/NEWS.texi +++ b/Documentation/topdocs/NEWS.texi @@ -7,6 +7,14 @@ @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. diff --git a/Documentation/user/changing-defaults.itely b/Documentation/user/changing-defaults.itely index 11102c2088..54afeed982 100644 --- a/Documentation/user/changing-defaults.itely +++ b/Documentation/user/changing-defaults.itely @@ -1461,14 +1461,14 @@ For clarity, you can also do this for single arguments, e.g., 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 diff --git a/Documentation/user/music-glossary.tely b/Documentation/user/music-glossary.tely index 0cd3ccea89..51e371af4f 100644 --- a/Documentation/user/music-glossary.tely +++ b/Documentation/user/music-glossary.tely @@ -1145,7 +1145,7 @@ another place frequently near the beginning marked by a sign: 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 diff --git a/Documentation/user/notation.itely b/Documentation/user/notation.itely index 9434abfebf..cfe0244059 100644 --- a/Documentation/user/notation.itely +++ b/Documentation/user/notation.itely @@ -5175,8 +5175,8 @@ names, for example @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 @@ -5944,24 +5944,24 @@ select ancient accidentals. Supported styles are { \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 { @@ -6458,22 +6458,22 @@ supported are @code{vaticana}, @code{medicaea}, @code{hufnagel}, and @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 @@ -7756,9 +7756,9 @@ created with a markup text. This markup text is inserted in the % 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" } } } diff --git a/input/mutopia/J.S.Bach/wtk1-fugue2.ly b/input/mutopia/J.S.Bach/wtk1-fugue2.ly index a758949987..990a0fda1d 100644 --- a/input/mutopia/J.S.Bach/wtk1-fugue2.ly +++ b/input/mutopia/J.S.Bach/wtk1-fugue2.ly @@ -17,17 +17,17 @@ 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" } @@ -44,7 +44,7 @@ to match up. %} -\version "2.4.0" +\version "2.5.2" diff --git a/input/mutopia/R.Schumann/romanze-op28-2.ly b/input/mutopia/R.Schumann/romanze-op28-2.ly index 2a0430f826..5fd784b3d3 100644 --- a/input/mutopia/R.Schumann/romanze-op28-2.ly +++ b/input/mutopia/R.Schumann/romanze-op28-2.ly @@ -5,7 +5,7 @@ #(set-global-staff-size 16) -\version "2.4.0" +\version "2.5.2" \header { title = "Romanzen" @@ -259,7 +259,7 @@ leftb = \transpose c cis { \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" { diff --git a/input/mutopia/W.A.Mozart/mozart-hrn-3.ly b/input/mutopia/W.A.Mozart/mozart-hrn-3.ly index bbb95c951c..2ba9a4563c 100644 --- a/input/mutopia/W.A.Mozart/mozart-hrn-3.ly +++ b/input/mutopia/W.A.Mozart/mozart-hrn-3.ly @@ -20,17 +20,17 @@ 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!")) } + } } } %{ @@ -41,7 +41,7 @@ virtuoso that taught in Geneva. %} -\version "2.4.0" +\version "2.5.2" \include "mozart-hrn3-defs.ily" \include "mozart-hrn3-allegro.ily" diff --git a/input/regression/instrument-name-markup.ly b/input/regression/instrument-name-markup.ly index 747b5aa7f8..e32678dd63 100644 --- a/input/regression/instrument-name-markup.ly +++ b/input/regression/instrument-name-markup.ly @@ -7,14 +7,14 @@ including alterations. " } -\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'' } diff --git a/input/regression/markup-score.ly b/input/regression/markup-score.ly index 29694cd530..971c30850e 100644 --- a/input/regression/markup-score.ly +++ b/input/regression/markup-score.ly @@ -2,7 +2,7 @@ texidoc = "Use \\score block as markup command." } -\version "2.4.0" +\version "2.5.2" tuning = \markup { \score { @@ -19,7 +19,7 @@ tuning = \markup { \header { title = "Solo Cello Suites" subtitle = "Suite IV" - subsubtitle = \markup { \fill-line < { "Originalstimmung: " \tuning } > } + subsubtitle = \markup { \fill-line { { "Originalstimmung: " \tuning } } } } \relative { diff --git a/input/regression/markup-stack.ly b/input/regression/markup-stack.ly index 158e025cbe..92668fbdef 100644 --- a/input/regression/markup-stack.ly +++ b/input/regression/markup-stack.ly @@ -1,6 +1,6 @@ -\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" } } } } diff --git a/input/regression/multi-measure-rest-text.ly b/input/regression/multi-measure-rest-text.ly index 8d4329b9eb..b1e8294a55 100644 --- a/input/regression/multi-measure-rest-text.ly +++ b/input/regression/multi-measure-rest-text.ly @@ -1,4 +1,4 @@ -\version "2.4.0" +\version "2.5.2" \header { @@ -13,7 +13,7 @@ Texts may be added to the multi-measure rests. \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" } diff --git a/input/regression/new-markup-scheme.ly b/input/regression/new-markup-scheme.ly index 80bb978e90..7f7aa3166f 100644 --- a/input/regression/new-markup-scheme.ly +++ b/input/regression/new-markup-scheme.ly @@ -5,7 +5,7 @@ texts using a similar syntax as @code{\\markup}." } -\version "2.4.0" +\version "2.5.2" \score { { \fatText @@ -14,7 +14,7 @@ \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" @@ -23,7 +23,7 @@ \musicglyph #"accidentals--1" \combine "X" "+" \combine "o" "/" - \box \column < { "string 1" } { "string 2" } > + \box \column { { "string 1" } { "string 2" } } "$\\emptyset$" \italic Norsk \super "2" diff --git a/input/regression/new-markup-syntax.ly b/input/regression/new-markup-syntax.ly index c9bdb22b01..94c82ce122 100644 --- a/input/regression/new-markup-syntax.ly +++ b/input/regression/new-markup-syntax.ly @@ -2,7 +2,7 @@ texidoc = "With the new markup syntax, text may be written in various manners." } -\version "2.4.0" +\version "2.5.2" \score { @@ -13,7 +13,7 @@ texidoc = "With the new markup syntax, text may be written in various manners." \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" @@ -26,7 +26,7 @@ texidoc = "With the new markup syntax, text may be written in various manners." \combine "X" "+" \combine "o" "/" % \char-number #"abc1234abc" - \box \column < { "string 1" } { "string 2" } > + \box \column { { "string 1" } { "string 2" } } "$\\emptyset$" \italic Norsk \super "2" diff --git a/input/test/coriolan-margin.ly b/input/test/coriolan-margin.ly index 0f9a9c58bc..a23da9e432 100644 --- a/input/test/coriolan-margin.ly +++ b/input/test/coriolan-margin.ly @@ -1,5 +1,5 @@ -\version "2.4.0" +\version "2.5.2" % Ugh, we need to override some LaTeX titling stuff @@ -42,7 +42,7 @@ oboi = \relative c' { } 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 @@ -55,21 +55,21 @@ fagotti = \relative 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 @@ -95,8 +95,8 @@ viola = \relative 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 } diff --git a/input/test/title-markup.ly b/input/test/title-markup.ly index 7feac6326e..0be842162e 100644 --- a/input/test/title-markup.ly +++ b/input/test/title-markup.ly @@ -1,4 +1,4 @@ -\version "2.4.0" +\version "2.5.2" %{ Markup titles also available for direct PostScript output: @@ -37,7 +37,7 @@ latinTest = \markup { } sizeTest = \markup { - \column < + \column { { \normalsize "normalsize" \hspace #5 \smaller "smaller" @@ -55,7 +55,7 @@ sizeTest = \markup { \hspace #5 \bigger \bigger \bigger "bigger" } - > + } } \encoding "latin1" @@ -85,7 +85,7 @@ spaceTest = \markup { "two space chars" } piece = "Piece" %% Override automatic book title - %% bookTitle = \markup { \fill-line < \huge\bold \title > > } + %% bookTitle = \markup { \fill-line { \huge\bold \title } } } \book { diff --git a/input/wilhelmus.ly b/input/wilhelmus.ly index 0cc4134901..b1eaadaa6a 100644 --- a/input/wilhelmus.ly +++ b/input/wilhelmus.ly @@ -1,4 +1,4 @@ -\version "2.4.0" +\version "2.5.2" \header { texidoc = "Wilhelmus van Nassouwe" @@ -142,7 +142,7 @@ text = \lyricmode { 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 { diff --git a/lily/lexer.ll b/lily/lexer.ll index 98d77c0650..b0d9d9f051 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -485,12 +485,6 @@ HYPHEN -- \" { start_quote (); } - \< { - return '<'; - } - \> { - return '>'; - } \\score { return SCORE; } @@ -530,7 +524,7 @@ HYPHEN -- [{}] { return YYText ()[0]; } - [^<>#{}"\\ \t\n\r\f]+ { + [^#{}"\\ \t\n\r\f]+ { String s (YYText ()); char c = s[s.length () - 1]; diff --git a/lily/parser.yy b/lily/parser.yy index 7743e1bdc6..43670458d2 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -444,7 +444,7 @@ or %type Generic_prefix_music_scm %type lyric_element %type Alternative_music -%type markup markup_line markup_list markup_list_body full_markup +%type 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 mode_changing_head %type mode_changing_head_with_context %type object_id_setting @@ -2463,58 +2463,85 @@ questions: | 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; } @@ -2530,28 +2557,38 @@ markup: 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 diff --git a/ly/titling-init.ly b/ly/titling-init.ly index bea90f7ebc..47f6e390a7 100644 --- a/ly/titling-init.ly +++ b/ly/titling-init.ly @@ -1,58 +1,58 @@ 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) @@ -61,8 +61,8 @@ oddFooterMarkup = \markup { 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) @@ -70,7 +70,7 @@ oddFooterMarkup = \markup { empty-stencil )) \fromproperty #'header:tagline - > - > + } + } } diff --git a/scm/new-markup.scm b/scm/new-markup.scm index d9cabccea2..5397514793 100644 --- a/scm/new-markup.scm +++ b/scm/new-markup.scm @@ -331,6 +331,24 @@ Also set markup-signature and markup-keyword object properties." (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 diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index 27704d492a..2e973151e6 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -2280,7 +2280,18 @@ conversions.append (((2, 5, 1), 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