]> git.lyx.org Git - lyx.git/commitdiff
DocBook: update links to LilyPond bugs.
authorThibaut Cuvelier <tcuvelier@lyx.org>
Wed, 29 Sep 2021 00:26:29 +0000 (02:26 +0200)
committerThibaut Cuvelier <tcuvelier@lyx.org>
Wed, 13 Oct 2021 00:36:39 +0000 (02:36 +0200)
Also updates the test so that it matches the next version of LilyPond.

autotests/export/docbook/LilyPond_Book.xml
lib/scripts/docbook_copy.py

index 43df8e100fef64535076d46c251b3c19445e30d2..17ea6e5374f3a410a48fe79c4d5d31f3305547a2 100644 (file)
@@ -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
index d2e4fe005857f05986564268d19cee83b8aed3ba..5b5a3f400e0e8862af10423bbf14e17680612b60 100644 (file)
@@ -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).