DocBook files: tag attributes must use "

2021-09-26 Thread Thibaut Cuvelier
Dear list,

While working on supporting LilyPond from within LyX' DocBook support, I
stumbled upon a poorly defined behaviour: if the attributes are set using '
instead of ", then LilyPond ignores them.

Example (*file.lyxml*):



http://docbook.org/ns/docbook";
xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:m="
http://www.w3.org/1998/Math/MathML"; xmlns:xi="
http://www.w3.org/2001/XInclude"; version="5.2">
LilyPond-book and LyX



\relative c'' {  g a b c}





To test, run *lilypond-book --format=docbook file.lyxml*.

If the attributes of programlisting are encoded with ", running *lilypond-book
--format=docbook file.lyxml* works as expected. Otherwise, LilyPond doesn't
do anything.

This is surely due to the way the DocBook parsing is done, as it only uses
regular expressions instead of real XML parsing (XPath is available in
ElementTree, lxml, and libxml2 modules in Python). A quick fix would be to
add the possibility to have " or ' in
https://github.com/lilypond/lilypond/blob/master/python/book_docbook.py#L40.

Thibaut Cuvelier
___
bug-lilypond mailing list
bug-lilypond@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond


DocBook files: LilyPond code remains in XML after processing

2021-09-26 Thread Thibaut Cuvelier
Dear list,

For now, lilypond-book leaves the raw LilyPond book in the XML file after
its processing. If this is the DocBook input



http://docbook.org/ns/docbook";
xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:m="
http://www.w3.org/1998/Math/MathML"; xmlns:xi="
http://www.w3.org/2001/XInclude"; version="5.2">
LilyPond-book and LyX



\relative c'' {  g a b c}





Then the output looks like



http://docbook.org/ns/docbook";
xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:m="
http://www.w3.org/1998/Math/MathML"; xmlns:xi="
http://www.w3.org/2001/XInclude"; version="5.2">
LilyPond-book and LyX


\relative c'' {  g a b c}

  


  



The problem is that the  tag is now outside the
 and has no particular markup to eliminate it afterwards.
Also, its attributes have been removed in the process.

It would be best if lilypond-book could only add its images within the
 tag, leaving the  where it is. It would fit
the semantics of  very well: all its direct children are
supposed to be alternatives one of the other (and the raw code is
definitely the same as an image, as far as semantics are concerned).

More precisely, this should be the output:



http://docbook.org/ns/docbook";
xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:m="
http://www.w3.org/1998/Math/MathML"; xmlns:xi="
http://www.w3.org/2001/XInclude"; version="5.2">
LilyPond-book and LyX


  


  


\relative c'' {  g a b c}




The images *must* come before the  in the XML file, because
DocBook processors are supposed to first display the first image if
possible, the others are only fallbacks.
___
bug-lilypond mailing list
bug-lilypond@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond


DocBook processor: unexpected reliance on working directory

2021-09-26 Thread Thibaut Cuvelier
Dear list,

Again, in the context of LyX' DocBook support for LilyPond, I'm running a
Python script to bridge the gap between LyX and LilyPond.

This script is run from within LyX and inherits, in particular, its
environment variables and working directory. The file lilypond-book should
transform are in a temporary directory. However, lilypond-book seems to be
sometimes using the working directory when calling lilypond to perform the
actual conversion of a snippet into an image.

The symptom is an error message like:

guile: uncaught throw to system-error:  (("open-fdes" "~A" ("No such file
or directory") (2)))

It refers to transforming a .ly file in …lyxbin…/ff/, whereas lilypond-book
was started on a file …lyxtmp…/lyx_tmpbuf0/ff/.

I am not able to reproduce this bug consistently, though.

Thibaut Cuvelier
___
bug-lilypond mailing list
bug-lilypond@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond