commit 2e408d2fdccffddebcd05eb2c6ccf6e9607def61
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Tue Sep 17 15:53:18 2024 +0200

    Do not output empty statement in lyx2lyx reversion
---
 lib/lyx2lyx/lyx_2_4.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py
index e807cc4c28..d350c5607c 100644
--- a/lib/lyx2lyx/lyx_2_4.py
+++ b/lib/lyx2lyx/lyx_2_4.py
@@ -3219,24 +3219,31 @@ def revert_babelfont(document):
     # set preamble stuff
     pretext = ["%% This document must be processed with xelatex or lualatex!"]
     pretext.append("\\AtBeginDocument{%")
+    have_append = False
     if roman != "default":
         pretext.append("\\babelfont{rm}[Mapping=tex-text]{" + roman + "}")
+        have_append = True
     if sans != "default":
         sf = "\\babelfont{sf}["
         if sf_scale != 100.0:
             sf += "Scale=" + str(sf_scale / 100.0) + ","
         sf += "Mapping=tex-text]{" + sans + "}"
         pretext.append(sf)
+        have_append = True
     if typew != "default":
         tw = "\\babelfont{tt}"
         if tt_scale != 100.0:
             tw += "[Scale=" + str(tt_scale / 100.0) + "]"
         tw += "{" + typew + "}"
         pretext.append(tw)
+        have_append = True
     if osf:
         pretext.append("\\defaultfontfeatures{Numbers=OldStyle}")
-    pretext.append("}")
-    insert_to_preamble(document, pretext)
+        have_append = True
+
+    if have_append:
+        pretext.append("}")
+        insert_to_preamble(document, pretext)
 
 
 def revert_minionpro(document):
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to