[LyX/master] lyx2lyx: Improve on revert_matters

Juergen Spitzmueller <[email protected]> Mon, 03 Aug 2026 14:29:22 +0000
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 39295e51255b83da42a91f5133770b729af275fa
Author: Juergen Spitzmueller <[email protected]>
Date:   Mon Aug 3 16:28:44 2026 +0200

    lyx2lyx: Improve on revert_matters
    
    Thanks to Pavel and Claude
---
 lib/lyx2lyx/lyx_2_6.py | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/lib/lyx2lyx/lyx_2_6.py b/lib/lyx2lyx/lyx_2_6.py
index c123d1fb64..5f16e30857 100644
--- a/lib/lyx2lyx/lyx_2_6.py
+++ b/lib/lyx2lyx/lyx_2_6.py
@@ -1617,17 +1617,12 @@ def revert_matters(document):
                 document.warning("Matter has no layout!")
                 i += 1
                 continue
-            beglay = lay[1]
-            endlay = find_end_of_layout(document.body, beglay)
-            if endlay == False:
-                document.warning("Matter has no endlayout!")
-                i += 1
-                continue
             
-            layb = document.body[beglay]
-            laye = document.body[endlay]
-            document.body[i : i + 1] = put_cmd_in_ert(["\\" + matter + "matter"]) + ["", laye, "", layb]
-            i += 1
+            beglay = lay[1]
+            del document.body[i] 
+            ert = put_cmd_in_ert(["\\" + matter + "matter"], as_paragraph=True)
+            document.body[beglay : beglay] = ert
+            i = beglay + len(ert)
 
 ##
 # Conversion hub
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs