commit 73a63822c2104a3479169d42a009e9ceb1945362
Author: Thibaut Cuvelier <[email protected]>
Date:   Wed Sep 29 02:26:29 2021 +0200

    DocBook: update links to LilyPond bugs.
    
    Also updates the test so that it matches the next version of LilyPond.
---
 autotests/export/docbook/LilyPond_Book.xml |   14 +++++++++-----
 lib/scripts/docbook_copy.py                |   16 +++++++---------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/autotests/export/docbook/LilyPond_Book.xml 
b/autotests/export/docbook/LilyPond_Book.xml
index 43df8e1..17ea6e5 100644
--- a/autotests/export/docbook/LilyPond_Book.xml
+++ b/autotests/export/docbook/LilyPond_Book.xml
@@ -3,13 +3,17 @@
   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">
+<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>
+</imageobject>
+<textobject>
+  <programlisting language="lilypond" role="processed">
+\relative c'' {  g a b c}
+</programlisting>
+</textobject>
+</mediaobject>
 </article>
\ No newline at end of file
diff --git a/lib/scripts/docbook_copy.py b/lib/scripts/docbook_copy.py
index d2e4fe0..5b5a3f4 100644
--- a/lib/scripts/docbook_copy.py
+++ b/lib/scripts/docbook_copy.py
@@ -61,8 +61,9 @@ class DocBookCopier:
     def preprocess_input_for_lilypond(self):
         # LilyPond requires that its input file has the .lyxml extension. Due 
to a bug in LilyPond,
         # use " instead of ' to encode XML attributes.
-        # https://lists.gnu.org/archive/html/bug-lilypond/2021-09/msg00039.html
+        # Bug report: https://gitlab.com/lilypond/lilypond/-/issues/6185
         # Typical transformation:
+        # Fixed by 2.23.4.
         #     FROM:  language='lilypond' role='fragment verbatim staffsize=16 
ragged-right relative=2'
         #     TO:    language="lilypond" role="fragment verbatim staffsize=16 
ragged-right relative=2"
         with open(self.in_file, 'r', encoding='utf-8') as f, 
open(self.in_lily_file, 'w', encoding='utf-8') as f_lily:
@@ -77,15 +78,12 @@ class DocBookCopier:
         os.unlink(self.in_file)
 
     def postprocess_output_for_lilypond(self):
+        # Major problem: LilyPond used to output the LilyPond code outside the 
image, which is then always displayed
+        # before the image (instead of only the generated image).
+        # Bug report: https://gitlab.com/lilypond/lilypond/-/issues/6186
+        # No more necessary with the new version of LilyPond (2.23.4). No 
efficient way to decide how to post-process
+        # for previous versions of LilyPond. Basically, it does not make sense 
to post-process.
         pass
-        # # Erase the <programlisting> that LilyPond left behind in the XML.
-        # in_file_before = self.in_file + '.tmp'
-        # shutil.move(self.in_file, in_file_before)
-        # with open(in_file_before, 'r', encoding='utf-8') as f_before, 
open(self.in_file, 'w', encoding='utf-8') as f_after:
-        #     looking_for_end_programlisting = False
-        #     for line in f_before:
-        #         # TODO: find an efficient way to distinguish those 
left-overs.
-        # https://lists.gnu.org/archive/html/bug-lilypond/2021-09/msg00040.html
 
     def call_lilypond(self):
         # LilyPond requires that its input file has the .lyxml extension (plus 
bugs in LilyPond).
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to