Re: search and replace on all included files on compile

2024-03-06 Thread Michael Winter via LilyPond user discussion
perfect thanks!

Mar 6, 2024, 14:35 by lilyp...@hillvisions.com:

> On 2024-03-06 10:56 am, Michael Winter via LilyPond user discussion wrote:
>
>> I have a programmatically generated score and am now realizing that I want 
>> to make a small tweak to text markups that are throughout the score in 
>> multiple files that are included at multiple levels. 
>>
>> " 1↑"  replace with " 1" (e.g. remove the up arrow when it is preceded by a 
>> 1)
>>
>> Is it possible to do this with a global search and replace on compile such 
>> that I do not need to edit each individual file (of which there are 
>> hundreds) manually?
>>
>
> LilyPond does support basic replacements for text markup:
>
> 
> \paper {
>  #(add-text-replacements! '(("1↑" . "1")))
> }
> 
>
>
> -- Aaron Hill
>



Re: search and replace on all included files on compile

2024-03-06 Thread Michael Winter via LilyPond user discussion
double thanks

Mar 6, 2024, 14:36 by j...@abou-samra.fr:

>
> Try
>
> \version "2.24.2"\paper {  #(add-text-replacements!'(("1↑" . "1")))}{ 
> c'^\markup "1↑" }
>
> Best,
>
>
> Jean
>
>

Re: search and replace on all included files on compile

2024-03-06 Thread Jean Abou Samra
Try

```
\version "2.24.2"

\paper {
  #(add-text-replacements!
'(("1↑" . "1")))
}

{ c'^\markup "1↑" }
```

Best,
 
Jean


signature.asc
Description: This is a digitally signed message part


Re: search and replace on all included files on compile

2024-03-06 Thread Aaron Hill
On 2024-03-06 10:56 am, Michael Winter via LilyPond user discussion 
wrote:
I have a programmatically generated score and am now realizing that I 
want to make a small tweak to text markups that are throughout the 
score in multiple files that are included at multiple levels. 


" 1↑"  replace with " 1" (e.g. remove the up arrow when it is preceded 
by a 1)


Is it possible to do this with a global search and replace on compile 
such that I do not need to edit each individual file (of which there 
are hundreds) manually?


LilyPond does support basic replacements for text markup:


\paper {
  #(add-text-replacements! '(("1↑" . "1")))
}



-- Aaron Hill



Re: search and replace on all included files on compile

2024-03-06 Thread Michael Winter via LilyPond user discussion
Thanks Curt,

Unfortunately, I have already manually edited to the extent that tweaking the 
generating program would result in a lot of lost work. Typically I try not to 
edit post generation, but that was not possible in this particular case.

I am on arch linux. And yes, I am sure it would be possible to do it through 
the terminal, but I am trying to avoid destructively editing the files (simply 
out of fear even though I could always roll back). I would be replacing only a 
few unicode characters, but many, many occurrences.

Best,

Michael

Mar 6, 2024, 14:22 by pla...@fishlet.com:

> Michael,
>
> You mentioned that the score is programmatically generated. If so, can
> you modify the generating program and regenerate the score?
>
> Otherwise, a more complete example would be nice. Are you trying to do a
> simple string replacement of a few (unicode) characters, or are you
> trying to replace larger chunks of LilyPond code?
>
> It would also help to know what operating system environment you are
> using. The answer may be to make a copy of the whole tree and run a
> search/replace utility recursively on all the files.
>
> Regards,
> Curt
>
> On 3/6/2024 10:56 AM, Michael Winter via LilyPond user discussion wrote:
>
>> I have a programmatically generated score and am now realizing that I
>> want to make a small tweak to text markups that are throughout the
>> score in multiple files that are included at multiple levels.
>>
>> " 1↑"  replace with " 1" (e.g. remove the up arrow when it is preceded
>> by a 1)
>>
>> Is it possible to do this with a global search and replace on compile
>> such that I do not need to edit each individual file (of which there
>> are hundreds) manually?
>>
>> I could do this through the terminal, but I would rather not
>> destructively edit the files.
>>
>> Thanks in advance!
>>
>> Best,
>>
>> Michael
>>



Re: search and replace on all included files on compile

2024-03-06 Thread Curt McDowell

Michael,

You mentioned that the score is programmatically generated. If so, can
you modify the generating program and regenerate the score?

Otherwise, a more complete example would be nice. Are you trying to do a
simple string replacement of a few (unicode) characters, or are you
trying to replace larger chunks of LilyPond code?

It would also help to know what operating system environment you are
using. The answer may be to make a copy of the whole tree and run a
search/replace utility recursively on all the files.

Regards,
Curt

On 3/6/2024 10:56 AM, Michael Winter via LilyPond user discussion wrote:

I have a programmatically generated score and am now realizing that I
want to make a small tweak to text markups that are throughout the
score in multiple files that are included at multiple levels.

" 1↑"  replace with " 1" (e.g. remove the up arrow when it is preceded
by a 1)

Is it possible to do this with a global search and replace on compile
such that I do not need to edit each individual file (of which there
are hundreds) manually?

I could do this through the terminal, but I would rather not
destructively edit the files.

Thanks in advance!

Best,

Michael




search and replace on all included files on compile

2024-03-06 Thread Michael Winter via LilyPond user discussion
I have a programmatically generated score and am now realizing that I want to 
make a small tweak to text markups that are throughout the score in multiple 
files that are included at multiple levels. 

" 1↑"  replace with " 1" (e.g. remove the up arrow when it is preceded by a 1)

Is it possible to do this with a global search and replace on compile such that 
I do not need to edit each individual file (of which there are hundreds) 
manually?

I could do this through the terminal, but I would rather not destructively edit 
the files.

Thanks in advance!

Best,

Michael