Closed rpspringuel closed 7 years ago
Thank you for your report ; I'll have a glance at it from thursday.
Based on my examination of the code, it appears that the package is trying to make use of the --include
option when invoking LilyPond. That is, it is supposed to --include
the directory of the original source file, thereby adding it to the search path for input files. If that's the case, then I don't know why it's not working.
I have two ideas for an alternate implementation, one of which I'm fairly certain is viable, the other I have more questions about (and which I've sent an inquiry to the LilyPond user list to discover the necessary answers):
My fairly certain option involves not copying the contents of source file into the file written to tmp_ly when adding the header, but using an \include
statement instead. You'd also need to add #(ly:set-option 'relative-includes #t)
to the top of the header file so that the LilyPond looks for included files relative to the file being currently read instead of the root file (which would be our dummy file in tmp_ly). In this case, since the source file is being read from its original location, all included files will be in the correct relative positions without needing to copy them into a new tree.
The less certain option is to create a project init.ly
file in tmp_ly to which the current header has been added as a footer. In this case invoking LilyPond with --init="lyluatex_init.ly"
on the original source file would produce the appropriate files. This has the advantage of each project only needing to create one new source file: lyluatex_init.ly
. This would, therefore, eliminate the need for lua to read the original file and md5 hash its contents (which is added to the filename of the file created in tmp_ly to prevent name conflicts) and thus give a performance boost (perhaps only noticeable if ly files are really big or there are a lot of them). Having never created a custom init.ly
file before, I'm less certain this will work, but I've asked on the LilyPond user list for some more information to see if this is really possible.
Excuse me, I've just begun looking at that…
But when I go to the Scores
dir, and launch lilypond OurFather.ly
, I get the error below.
I've tried replacing all bflat by bf, and I don't get errors any more, neither with lilypond
alone, nor with lualatex
.
GNU LilyPond 2.19.47
Traitement de « OurFather.ly »
Analyse...
OurFather.ly:13:196: Erreur : syntax error, unexpected STRING
a2 g4 f g g \bar "|" g2 g4 f g a a \bar "||" <f a>2 <c g'>4 <d f> <c g'> <c g'> \bar "|" <c g'>2 <f a> \bar "|" <f a>4 <f a> <c g'> <d f> \bar "|" <d f>2 <c g'> \bar "|" <c g'>4 <f a> <g
bflat>2 \bar "|" <g bflat> <c, g'>4 <f a>2 \bar "|" <f a>4 <f a> <f a> <c g'> <d f> <c g'> <c g'> <c g'> \bar "|" <c g'>2 <c g'>4 <f a> <f a> <c g'> <d f> <d f>^- \bar "|" <d f>2 <c g'>4 <f a> <g bflat> <g bflat> \bar "|" <g bflat>2 <g bflat>4^- <c, g'>^- <f a> <f a>^- \bar "|."
OurFather.ly:13:196: Erreur : chaîne non reconnue ; en dehors d'un script textuel ou de \lyricmode
a2 g4 f g g \bar "|" g2 g4 f g a a \bar "||" <f a>2 <c g'>4 <d f> <c g'> <c g'> \bar "|" <c g'>2 <f a> \bar "|" <f a>4 <f a> <c g'> <d f> \bar "|" <d f>2 <c g'> \bar "|" <c g'>4 <f a> <g
bflat>2 \bar "|" <g bflat> <c, g'>4 <f a>2 \bar "|" <f a>4 <f a> <f a> <c g'> <d f> <c g'> <c g'> <c g'> \bar "|" <c g'>2 <c g'>4 <f a> <f a> <c g'> <d f> <d f>^- \bar "|" <d f>2 <c g'>4 <f a> <g bflat> <g bflat> \bar "|" <g bflat>2 <g bflat>4^- <c, g'>^- <f a> <f a>^- \bar "|."
OurFather.ly:13:216: Erreur : syntax error, unexpected STRING
a2 g4 f g g \bar "|" g2 g4 f g a a \bar "||" <f a>2 <c g'>4 <d f> <c g'> <c g'> \bar "|" <c g'>2 <f a> \bar "|" <f a>4 <f a> <c g'> <d f> \bar "|" <d f>2 <c g'> \bar "|" <c g'>4 <f a> <g bflat>2 \bar "|" <g
bflat> <c, g'>4 <f a>2 \bar "|" <f a>4 <f a> <f a> <c g'> <d f> <c g'> <c g'> <c g'> \bar "|" <c g'>2 <c g'>4 <f a> <f a> <c g'> <d f> <d f>^- \bar "|" <d f>2 <c g'>4 <f a> <g bflat> <g bflat> \bar "|" <g bflat>2 <g bflat>4^- <c, g'>^- <f a> <f a>^- \bar "|."
OurFather.ly:13:216: Erreur : chaîne non reconnue ; en dehors d'un script textuel ou de \lyricmode
a2 g4 f g g \bar "|" g2 g4 f g a a \bar "||" <f a>2 <c g'>4 <d f> <c g'> <c g'> \bar "|" <c g'>2 <f a> \bar "|" <f a>4 <f a> <c g'> <d f> \bar "|" <d f>2 <c g'> \bar "|" <c g'>4 <f a> <g bflat>2 \bar "|" <g
bflat> <c, g'>4 <f a>2 \bar "|" <f a>4 <f a> <f a> <c g'> <d f> <c g'> <c g'> <c g'> \bar "|" <c g'>2 <c g'>4 <f a> <f a> <c g'> <d f> <d f>^- \bar "|" <d f>2 <c g'>4 <f a> <g bflat> <g bflat> \bar "|" <g bflat>2 <g bflat>4^- <c, g'>^- <f a> <f a>^- \bar "|."
OurFather.ly:13:392: Erreur : syntax error, unexpected STRING
a2 g4 f g g \bar "|" g2 g4 f g a a \bar "||" <f a>2 <c g'>4 <d f> <c g'> <c g'> \bar "|" <c g'>2 <f a> \bar "|" <f a>4 <f a> <c g'> <d f> \bar "|" <d f>2 <c g'> \bar "|" <c g'>4 <f a> <g bflat>2 \bar "|" <g bflat> <c, g'>4 <f a>2 \bar "|" <f a>4 <f a> <f a> <c g'> <d f> <c g'> <c g'> <c g'> \bar "|" <c g'>2 <c g'>4 <f a> <f a> <c g'> <d f> <d f>^- \bar "|" <d f>2 <c g'>4 <f a> <g
bflat> <g bflat> \bar "|" <g bflat>2 <g bflat>4^- <c, g'>^- <f a> <f a>^- \bar "|."
OurFather.ly:13:392: Erreur : chaîne non reconnue ; en dehors d'un script textuel ou de \lyricmode
a2 g4 f g g \bar "|" g2 g4 f g a a \bar "||" <f a>2 <c g'>4 <d f> <c g'> <c g'> \bar "|" <c g'>2 <f a> \bar "|" <f a>4 <f a> <c g'> <d f> \bar "|" <d f>2 <c g'> \bar "|" <c g'>4 <f a> <g bflat>2 \bar "|" <g bflat> <c, g'>4 <f a>2 \bar "|" <f a>4 <f a> <f a> <c g'> <d f> <c g'> <c g'> <c g'> \bar "|" <c g'>2 <c g'>4 <f a> <f a> <c g'> <d f> <d f>^- \bar "|" <d f>2 <c g'>4 <f a> <g
bflat> <g bflat> \bar "|" <g bflat>2 <g bflat>4^- <c, g'>^- <f a> <f a>^- \bar "|."
OurFather.ly:13:402: Erreur : chaîne non reconnue ; en dehors d'un script textuel ou de \lyricmode
a2 g4 f g g \bar "|" g2 g4 f g a a \bar "||" <f a>2 <c g'>4 <d f> <c g'> <c g'> \bar "|" <c g'>2 <f a> \bar "|" <f a>4 <f a> <c g'> <d f> \bar "|" <d f>2 <c g'> \bar "|" <c g'>4 <f a> <g bflat>2 \bar "|" <g bflat> <c, g'>4 <f a>2 \bar "|" <f a>4 <f a> <f a> <c g'> <d f> <c g'> <c g'> <c g'> \bar "|" <c g'>2 <c g'>4 <f a> <f a> <c g'> <d f> <d f>^- \bar "|" <d f>2 <c g'>4 <f a> <g bflat> <g
bflat> \bar "|" <g bflat>2 <g bflat>4^- <c, g'>^- <f a> <f a>^- \bar "|."
OurFather.ly:13:421: Erreur : syntax error, unexpected STRING
a2 g4 f g g \bar "|" g2 g4 f g a a \bar "||" <f a>2 <c g'>4 <d f> <c g'> <c g'> \bar "|" <c g'>2 <f a> \bar "|" <f a>4 <f a> <c g'> <d f> \bar "|" <d f>2 <c g'> \bar "|" <c g'>4 <f a> <g bflat>2 \bar "|" <g bflat> <c, g'>4 <f a>2 \bar "|" <f a>4 <f a> <f a> <c g'> <d f> <c g'> <c g'> <c g'> \bar "|" <c g'>2 <c g'>4 <f a> <f a> <c g'> <d f> <d f>^- \bar "|" <d f>2 <c g'>4 <f a> <g bflat> <g bflat> \bar "|" <g
bflat>2 <g bflat>4^- <c, g'>^- <f a> <f a>^- \bar "|."
OurFather.ly:13:421: Erreur : chaîne non reconnue ; en dehors d'un script textuel ou de \lyricmode
a2 g4 f g g \bar "|" g2 g4 f g a a \bar "||" <f a>2 <c g'>4 <d f> <c g'> <c g'> \bar "|" <c g'>2 <f a> \bar "|" <f a>4 <f a> <c g'> <d f> \bar "|" <d f>2 <c g'> \bar "|" <c g'>4 <f a> <g bflat>2 \bar "|" <g bflat> <c, g'>4 <f a>2 \bar "|" <f a>4 <f a> <f a> <c g'> <d f> <c g'> <c g'> <c g'> \bar "|" <c g'>2 <c g'>4 <f a> <f a> <c g'> <d f> <d f>^- \bar "|" <d f>2 <c g'>4 <f a> <g bflat> <g bflat> \bar "|" <g
bflat>2 <g bflat>4^- <c, g'>^- <f a> <f a>^- \bar "|."
OurFather.ly:13:432: Erreur : syntax error, unexpected STRING
a2 g4 f g g \bar "|" g2 g4 f g a a \bar "||" <f a>2 <c g'>4 <d f> <c g'> <c g'> \bar "|" <c g'>2 <f a> \bar "|" <f a>4 <f a> <c g'> <d f> \bar "|" <d f>2 <c g'> \bar "|" <c g'>4 <f a> <g bflat>2 \bar "|" <g bflat> <c, g'>4 <f a>2 \bar "|" <f a>4 <f a> <f a> <c g'> <d f> <c g'> <c g'> <c g'> \bar "|" <c g'>2 <c g'>4 <f a> <f a> <c g'> <d f> <d f>^- \bar "|" <d f>2 <c g'>4 <f a> <g bflat> <g bflat> \bar "|" <g bflat>2 <g
bflat>4^- <c, g'>^- <f a> <f a>^- \bar "|."
OurFather.ly:13:432: Erreur : chaîne non reconnue ; en dehors d'un script textuel ou de \lyricmode
a2 g4 f g g \bar "|" g2 g4 f g a a \bar "||" <f a>2 <c g'>4 <d f> <c g'> <c g'> \bar "|" <c g'>2 <f a> \bar "|" <f a>4 <f a> <c g'> <d f> \bar "|" <d f>2 <c g'> \bar "|" <c g'>4 <f a> <g bflat>2 \bar "|" <g bflat> <c, g'>4 <f a>2 \bar "|" <f a>4 <f a> <f a> <c g'> <d f> <c g'> <c g'> <c g'> \bar "|" <c g'>2 <c g'>4 <f a> <f a> <c g'> <d f> <d f>^- \bar "|" <d f>2 <c g'>4 <f a> <g bflat> <g bflat> \bar "|" <g bflat>2 <g
bflat>4^- <c, g'>^- <f a> <f a>^- \bar "|."
OurFather.ly:5:1: Erreur : suite à des erreurs répétées, l'expression musicale sera ignorée
<<
erreur fatale : erreur sur les fichiers "OurFather.ly"
There's a syntax change in the english note names some time in the 2.19 cycle. flat
and sharp
became -flat
and -sharp
(the short form of the names f
and s
remained the same). The files need to be run through convert-ly to work with 2.19.53.
Here's what I get (including log files) after bringing them up to date and trying again (note, on my system lilypond
refers to 2.18.2 while lilypond-def
is 2.19.53):
Test_Lily_include .zip
I think the problem comes from the space at the end of the name of Test_Lily_include folder : if I remove it, then clean files within it, this works.
I hadn't noticed that spurious space but after removing it, and removing the space in the enclosing folder of that one on my system, everything worked fine.
So then the real problem is that the path to the include directory is not quoted, and thus can't have any spaces in it.
Should be fixed in 549af4d.
Works for me. Thanks for the fix.
Thank you very much for your report and your help !
The sample project attached includes two lilypond scores, both of which can be compiled fine directly with lilypond. However, because they include another file (the common
Format.lyi
) errors are generated when lyluatex tries to do something with them. I believe that the included file isn't getting copied into the temporary directory correctly. It's probably necessary to iterate over the included lilypond files to look for\include
statements and grab those files as necessary.Test_Lily_include .zip