commit 174fa758cebae1fb6de1b8c4981da160b3dc3bd1
Author: Juergen Spitzmueller <[email protected]>
Date:   Wed Aug 26 14:50:00 2026 +0200

    lyx2lyx: fix append_local_layout
    
    If the local layout already has a Format declaration, keep this as first
    line (it must come first).
---
 lib/lyx2lyx/LyX.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py
index ce27d27f95..ab1ec58fdd 100644
--- a/lib/lyx2lyx/LyX.py
+++ b/lib/lyx2lyx/LyX.py
@@ -818,6 +818,11 @@ class LyX_base:
             self.warning("Malformed LyX document: Can't find end of local 
layout!")
             return
 
+        # If we have a Format declaration, this should come first
+        f = find_token(self.header, "Format ", i, j)
+        if f != -1:
+            i = f
+
         self.header[i + 1 : i + 1] = new_layout
 
     def del_local_layout(self, layout_def):
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to