bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DocBook files: LilyPond code remains in XML after processing


From: Thibaut Cuvelier
Subject: DocBook files: LilyPond code remains in XML after processing
Date: Mon, 27 Sep 2021 01:22:00 +0200

Dear list,

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

<?xml version="1.0" encoding="UTF-8"?>
<!-- This DocBook file was created by LyX 2.4.0dev
  See https://www.lyx.org/ for more information -->
<article xml:lang="en_US" xmlns="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">
<title>LilyPond-book and LyX</title>
<mediaobject>
<textobject>
<programlisting language="lilypond" role="fragment verbatim staffsize=16
ragged-right relative=2">
\relative c'' {  g a b c}
</programlisting>
</textobject>
</mediaobject>
</article>

Then the output looks like

<?xml version="1.0" encoding="UTF-8"?>
<!-- This DocBook file was created by LyX 2.4.0dev
  See https://www.lyx.org/ for more information -->
<article xml:lang="en_US" xmlns="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">
<title>LilyPond-book and LyX</title>
<programlisting>

\relative c'' {  g a b c}
</programlisting><mediaobject><imageobject role="latex">
  <imagedata fileref="ff\lily-3ed27d76.pdf" format="PDF"/>
</imageobject>
<imageobject role="html">
  <imagedata fileref="ff\lily-3ed27d76.png" format="PNG"/>
</imageobject></mediaobject>
</article>

The problem is that the <programlisting> tag is now outside the
<mediaobject> 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
<mediaobject> tag, leaving the <programlisting> where it is. It would fit
the semantics of <mediaobject> 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:

<?xml version="1.0" encoding="UTF-8"?>
<!-- This DocBook file was created by LyX 2.4.0dev
  See https://www.lyx.org/ for more information -->
<article xml:lang="en_US" xmlns="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">
<title>LilyPond-book and LyX</title>
<mediaobject>
<imageobject role="latex">
  <imagedata fileref="ff\lily-3ed27d76.pdf" format="PDF"/>
</imageobject>
<imageobject role="html">
  <imagedata fileref="ff\lily-3ed27d76.png" format="PNG"/>
</imageobject>
<programlisting language="lilypond" role="fragment verbatim staffsize=16
ragged-right relative=2">
\relative c'' {  g a b c}
</programlisting>
</mediaobject>
</article>

The images *must* come before the <programlisting> in the XML file, because
DocBook processors are supposed to first display the first image if
possible, the others are only fallbacks.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]