[LyX/master] Remove *matter styles from sv classes

Juergen Spitzmueller <[email protected]> Tue, 04 Aug 2026 15:35:11 +0000
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 1270baeff3650d90fa29652fed24067cc17ea85f
Author: Juergen Spitzmueller <[email protected]>
Date:   Tue Aug 4 17:33:35 2026 +0200

    Remove *matter styles from sv classes
    
    These are obsolete classes, but still ...
    
    We convert documents to use the new switches. Conversion produces
    empty pars, not ideal but only cosmetic, and I am too lazy to
    improve on this niche case.
---
 lib/layouts/svcommon.inc     | 42 ------------------------------------------
 lib/layouts/svglobal.layout  |  3 ---
 lib/layouts/svglobal3.layout |  3 ---
 lib/layouts/svjog.layout     |  3 ---
 lib/layouts/svprobth.layout  |  3 ---
 lib/lyx2lyx/lyx_2_6.py       | 26 +++++++++++++++++++++++++-
 6 files changed, 25 insertions(+), 55 deletions(-)

diff --git a/lib/layouts/svcommon.inc b/lib/layouts/svcommon.inc
index ab66aa2b5b..b8c64e8a3b 100644
--- a/lib/layouts/svcommon.inc
+++ b/lib/layouts/svcommon.inc
@@ -67,48 +67,6 @@ Style Title
 	DocBookInInfo         maybe
 End
 
-
-
-Style Front_Matter
-	Category	Structure
-	LatexType	Command
-	LatexName	frontmatter
-	KeepEmpty	1
-	ResetArgs       1
-	Margin		First_Dynamic
-	NextNoIndent	1
-	ParSkip		0
-	TopSep		2.5
-	BottomSep	0.5
-	ParSep		0
-	Align		Center
-	LabelType	Static
-	LabelBottomSep	0
-	LeftMargin	M
-	LabelString	"--- Front Matter ---"
-
-	Font
-	  Family	Sans
-	  Series	Bold
-	  Size		Largest
-	  Color		textlabel1
-	EndFont
-End
-
-Style Main_Matter
-	CopyStyle	Front_Matter
-	Category	Structure
-	LatexName	mainmatter
-	LabelString	"--- Main Matter ---"
-End
-
-Style Back_Matter
-	CopyStyle	Front_Matter
-	Category	Structure
-	LatexName	backmatter
-	LabelString	"--- Back Matter ---"
-End
-
 Style Part
 	Margin		Static
 	Align		Right
diff --git a/lib/layouts/svglobal.layout b/lib/layouts/svglobal.layout
index b290aa4b35..916ee3fb68 100644
--- a/lib/layouts/svglobal.layout
+++ b/lib/layouts/svglobal.layout
@@ -24,9 +24,6 @@ Format 120
 
 Input svcommon.inc
 
-NoStyle Front_Matter
-NoStyle Main_Matter
-NoStyle Back_Matter
 NoStyle Part
 NoStyle PartBacktext
 NoCounter part
diff --git a/lib/layouts/svglobal3.layout b/lib/layouts/svglobal3.layout
index 6bd5988bc9..1eb82f5f68 100644
--- a/lib/layouts/svglobal3.layout
+++ b/lib/layouts/svglobal3.layout
@@ -19,9 +19,6 @@ Format 120
 
 Input svcommon.inc
 
-NoStyle Front_Matter
-NoStyle Main_Matter
-NoStyle Back_Matter
 NoStyle Part
 NoStyle PartBacktext
 NoCounter part
diff --git a/lib/layouts/svjog.layout b/lib/layouts/svjog.layout
index 682f6fb528..afa0e1d7cb 100644
--- a/lib/layouts/svjog.layout
+++ b/lib/layouts/svjog.layout
@@ -28,9 +28,6 @@ Format 120
 
 Input svcommon.inc
 
-NoStyle Front_Matter
-NoStyle Main_Matter
-NoStyle Back_Matter
 NoStyle Part
 NoStyle PartBacktext
 NoCounter part
diff --git a/lib/layouts/svprobth.layout b/lib/layouts/svprobth.layout
index d6d63c6fdc..602511089b 100644
--- a/lib/layouts/svprobth.layout
+++ b/lib/layouts/svprobth.layout
@@ -34,9 +34,6 @@
 Format 120
 Input svcommon.inc
 
-NoStyle Front_Matter
-NoStyle Main_Matter
-NoStyle Back_Matter
 NoStyle Part
 NoStyle PartBacktext
 NoCounter part
diff --git a/lib/lyx2lyx/lyx_2_6.py b/lib/lyx2lyx/lyx_2_6.py
index a335fa5204..fc9184c15f 100644
--- a/lib/lyx2lyx/lyx_2_6.py
+++ b/lib/lyx2lyx/lyx_2_6.py
@@ -1667,6 +1667,30 @@ def revert_matters(document):
         document.body[beglay : beglay] = ert
         i = beglay + len(ert)
 
+
+def convert_svmatters(document):
+    """Convert \\frontmatter, \\mainmatter and \\backmatter style of SV class"""
+
+    if not document.textclass in [
+        "svmono",
+        "svmult"
+    ]:
+        return
+
+    for matter in ["Front Matter", "Main Matter", "Back Matter"]:
+        i = 0
+        while True:
+            i = find_token(document.body, "\\begin_layout %s" % matter, i)
+            if i == -1:
+                break
+            if matter == "Front Matter":
+                document.body[i : i + 1] = ["\\begin_layout Standard", "\\start_of_matter frontmatter"]
+            elif matter == "Main Matter":
+                document.body[i : i + 1] = ["\\begin_layout Standard", "\\start_of_matter mainmatter"]
+            elif matter == "Back Matter":
+                document.body[i : i + 1] = ["\\begin_layout Standard", "\\start_of_matter backmatter"]
+        
+
 ##
 # Conversion hub
 #
@@ -1686,7 +1710,7 @@ convert = [
     [654, []],
     [655, []],
     [656, []],
-    [657, []]
+    [657, [convert_svmatters]]
 ]
 
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs