Abjad / abjad

Abjad is a Python API for building LilyPond files. Use Abjad to make PDFs of music notation.
https://abjad.github.io
GNU General Public License v3.0
234 stars 41 forks source link

Taught abjad.MetronomeMark to handle textual_indication literally. #1499

Closed trevorbaca closed 1 year ago

trevorbaca commented 1 year ago

Closes #1498.

Abjad 3.13 wraps abjad.MetronomeMark.textual_indication with an extra pair of double quotes when textual_indication contains whitespace:

>>> mark = abjad.MetronomeMark(textual_indication="Allegro")
>>> string = abjad.lilypond(mark)
>>> print(string)
\tempo Allegro

>>> mark = abjad.MetronomeMark(textual_indication="Allegro ma")
>>> string = abjad.lilypond(mark)
>>> print(string)
\tempo "Allegro ma"

The behavior was designed to be helpful (the second example above does make good LilyPond input), but is at odds with the literal (WYSIWYG) way of working with abjad.Markup, and almost all other objects in Abjad.

The right way to produce \tempo "Allegro ma" should be with text_indication='"Allegro ma"', but this results in a redundant pair of double quotes in Abjad 3.13:

>>> mark = abjad.MetronomeMark(textual_indication='"Allegro ma"')
>>> string = abjad.lilypond(mark)
>>> print(string)
\tempo ""Allegro ma""

Abjad 3.14 removes this behavior and outputs the contents of textual_indication exactly as entered by the user:

>>> mark = abjad.MetronomeMark(textual_indication="Allegro")                                  
>>> string = abjad.lilypond(mark)                                                             
>>> print(string)
\tempo Allegro

>>> mark = abjad.MetronomeMark(textual_indication="Allegro ma")                               
>>> string = abjad.lilypond(mark)                                                             
>>> print(string)
\tempo Allegro ma

>>> mark = abjad.MetronomeMark(textual_indication='"Allegro ma"')                             
>>> string = abjad.lilypond(mark)                                                             
>>> print(string)      
\tempo "Allegro ma"