Let wordwrap-field and justify-field take non-strings?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Let wordwrap-field and justify-field take non-strings?

Thomas Morley-2
Hi,

still musing about improving markup->string, I now stumbled across
\wordwrap/justify-field.

Both have a condition to return visible output only if the catched
input is a string (using 'wordwrap/justify-string-markup' then),
whereas \fromproperty accepts markup as well.
Is this intended?

One could go for markup? as well and use simple 'wordwrap/justify-markup
or
One could do the condition as (not (string-null? (markup->string ...))).
(Currently markup->string will not return anything else than an empty
string, as said I'm working on improvements)

Opinions?


Thanks,
  Harmt

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Let wordwrap-field and justify-field take non-strings?

David Kastrup
Thomas Morley <[hidden email]> writes:

> Hi,
>
> still musing about improving markup->string, I now stumbled across
> \wordwrap/justify-field.
>
> Both have a condition to return visible output only if the catched
> input is a string (using 'wordwrap/justify-string-markup' then),
> whereas \fromproperty accepts markup as well.
> Is this intended?
>
> One could go for markup? as well and use simple 'wordwrap/justify-markup
> or
> One could do the condition as (not (string-null? (markup->string ...))).
> (Currently markup->string will not return anything else than an empty
> string, as said I'm working on improvements)
>
> Opinions?

A string is structured by spaces and newlines, a markup list has already
separated elements.  How would you naturally deal with single markups?

--
David Kastrup

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Let wordwrap-field and justify-field take non-strings?

Thomas Morley-2
Am So., 2. Dez. 2018 um 14:50 Uhr schrieb David Kastrup <[hidden email]>:

>
> Thomas Morley <[hidden email]> writes:
>
> > Hi,
> >
> > still musing about improving markup->string, I now stumbled across
> > \wordwrap/justify-field.
> >
> > Both have a condition to return visible output only if the catched
> > input is a string (using 'wordwrap/justify-string-markup' then),
> > whereas \fromproperty accepts markup as well.
> > Is this intended?
> >
> > One could go for markup? as well and use simple 'wordwrap/justify-markup
> > or
> > One could do the condition as (not (string-null? (markup->string ...))).
> > (Currently markup->string will not return anything else than an empty
> > string, as said I'm working on improvements)
> >
> > Opinions?
>
> A string is structured by spaces and newlines, a markup list has already
> separated elements.  How would you naturally deal with single markups?

That should become the duty of markup->string
Like:
single-markup = \markup \line \italic { Lorem ipsum dolor sit amet }
#(write (markup->string single-markup))
=>
"Lorem ipsum dolor sit amet"

Cheers,
  Harm

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Let wordwrap-field and justify-field take non-strings?

David Kastrup
Thomas Morley <[hidden email]> writes:

> Am So., 2. Dez. 2018 um 14:50 Uhr schrieb David Kastrup <[hidden email]>:
>>
>> Thomas Morley <[hidden email]> writes:
>>
>> > Hi,
>> >
>> > still musing about improving markup->string, I now stumbled across
>> > \wordwrap/justify-field.
>> >
>> > Both have a condition to return visible output only if the catched
>> > input is a string (using 'wordwrap/justify-string-markup' then),
>> > whereas \fromproperty accepts markup as well.
>> > Is this intended?
>> >
>> > One could go for markup? as well and use simple 'wordwrap/justify-markup
>> > or
>> > One could do the condition as (not (string-null? (markup->string ...))).
>> > (Currently markup->string will not return anything else than an empty
>> > string, as said I'm working on improvements)
>> >
>> > Opinions?
>>
>> A string is structured by spaces and newlines, a markup list has already
>> separated elements.  How would you naturally deal with single markups?
>
> That should become the duty of markup->string
> Like:
> single-markup = \markup \line \italic { Lorem ipsum dolor sit amet }
> #(write (markup->string single-markup))
> =>
> "Lorem ipsum dolor sit amet"

But then any markup formatting of the fields would get lost without
warning?

--
David Kastrup

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Let wordwrap-field and justify-field take non-strings?

Thomas Morley-2
Am So., 2. Dez. 2018 um 15:09 Uhr schrieb David Kastrup <[hidden email]>:

>
> Thomas Morley <[hidden email]> writes:
>
> > Am So., 2. Dez. 2018 um 14:50 Uhr schrieb David Kastrup <[hidden email]>:
> >>
> >> Thomas Morley <[hidden email]> writes:
> >>
> >> > Hi,
> >> >
> >> > still musing about improving markup->string, I now stumbled across
> >> > \wordwrap/justify-field.
> >> >
> >> > Both have a condition to return visible output only if the catched
> >> > input is a string (using 'wordwrap/justify-string-markup' then),
> >> > whereas \fromproperty accepts markup as well.
> >> > Is this intended?
> >> >
> >> > One could go for markup? as well and use simple 'wordwrap/justify-markup
> >> > or
> >> > One could do the condition as (not (string-null? (markup->string ...))).
> >> > (Currently markup->string will not return anything else than an empty
> >> > string, as said I'm working on improvements)
> >> >
> >> > Opinions?
> >>
> >> A string is structured by spaces and newlines, a markup list has already
> >> separated elements.  How would you naturally deal with single markups?
> >
> > That should become the duty of markup->string
> > Like:
> > single-markup = \markup \line \italic { Lorem ipsum dolor sit amet }
> > #(write (markup->string single-markup))
> > =>
> > "Lorem ipsum dolor sit amet"
>
> But then any markup formatting of the fields would get lost without
> warning?

Well, indeed. This could be a feature or it could be undesired. Thus I
asked for opinions.
If we want to keep the formating we could probably do the same as in
fromproperty.

Cheers,
  Harm

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Let wordwrap-field and justify-field take non-strings?

Thomas Morley-2
Am So., 2. Dez. 2018 um 15:36 Uhr schrieb Thomas Morley
<[hidden email]>:

>
> Am So., 2. Dez. 2018 um 15:09 Uhr schrieb David Kastrup <[hidden email]>:
> >
> > Thomas Morley <[hidden email]> writes:
> >
> > > Am So., 2. Dez. 2018 um 14:50 Uhr schrieb David Kastrup <[hidden email]>:
> > >>
> > >> Thomas Morley <[hidden email]> writes:
> > >>
> > >> > Hi,
> > >> >
> > >> > still musing about improving markup->string, I now stumbled across
> > >> > \wordwrap/justify-field.
> > >> >
> > >> > Both have a condition to return visible output only if the catched
> > >> > input is a string (using 'wordwrap/justify-string-markup' then),
> > >> > whereas \fromproperty accepts markup as well.
> > >> > Is this intended?
> > >> >
> > >> > One could go for markup? as well and use simple 'wordwrap/justify-markup
> > >> > or
> > >> > One could do the condition as (not (string-null? (markup->string ...))).
> > >> > (Currently markup->string will not return anything else than an empty
> > >> > string, as said I'm working on improvements)
> > >> >
> > >> > Opinions?
> > >>
> > >> A string is structured by spaces and newlines, a markup list has already
> > >> separated elements.  How would you naturally deal with single markups?
> > >
> > > That should become the duty of markup->string
> > > Like:
> > > single-markup = \markup \line \italic { Lorem ipsum dolor sit amet }
> > > #(write (markup->string single-markup))
> > > =>
> > > "Lorem ipsum dolor sit amet"
> >
> > But then any markup formatting of the fields would get lost without
> > warning?
>
> Well, indeed. This could be a feature or it could be undesired. Thus I
> asked for opinions.
> If we want to keep the formating we could probably do the same as in
> fromproperty.

Currently a formated markup will be dropped entirely without any warning, see:
\markup
  \override #`((foo . "Lorem") (buzz . ,#{ \markup \italic "ipsum" #}))
  \column {
      "from-property"
    \fromproperty #'foo
    \fromproperty #'buzz
    "wordwrap-field"
    \wordwrap-field #'foo
    \wordwrap-field #'buzz
    "justify-field"
    \justify-field #'foo
    \justify-field #'buzz
  }

Cheers,
  Harm

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Let wordwrap-field and justify-field take non-strings?

Dan Eble
On Dec 2, 2018, at 09:38, Thomas Morley <[hidden email]> wrote:
>
> Currently a formated markup will be dropped entirely without any warning, see:

My two cents: at some time in the past year, I was working on a mark performer, and I wanted a way to turn the markup for the mark into a MIDI-compatible string.  I believe I chose to call markup->string at the time, as that was the closest thing I could find.  I think to be really compatible with MIDI, the markup would need to be transformed into an ASCII approximation, so maybe it warrants a separate implementation.

I think there are probably similar issues with markup used for lyrics, but these things are no longer fresh in my mind.

Dan

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel