commit 4d7b16f9fc326ab48f73195aa20c39072fc4eaee
Author: Juergen Spitzmueller <[email protected]>
Date:   Fri Jul 11 14:40:33 2025 +0200

    Fix lyx2lyx with empty notefontcolor or boxbgcolor bparam
---
 lib/lyx2lyx/lyx_2_5.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/lyx2lyx/lyx_2_5.py b/lib/lyx2lyx/lyx_2_5.py
index f5cef6f325..b111371d9d 100644
--- a/lib/lyx2lyx/lyx_2_5.py
+++ b/lib/lyx2lyx/lyx_2_5.py
@@ -1757,7 +1757,7 @@ def convert_doc_colors(document):
 
 
 # helper function for revert_doc_colors
-def revert_doc_col(document, color, default_value, xcolor, x11, svg, dvips):
+def revert_doc_col(document, color, default_value, xcolor, x11, svg, dvips, 
nonedefault):
     "Reverts a given document color"
 
     i = find_token(document.header, color, 0)
@@ -1765,7 +1765,7 @@ def revert_doc_col(document, color, default_value, 
xcolor, x11, svg, dvips):
         document.warning("Can't find %s header!" % color)
     else:
         value = get_value(document.header, color, i)
-        if value == default_value:
+        if value == default_value or (nonedefault and value == "none"):
             # default; nothing more to do
             del document.header[i]
             return
@@ -1806,10 +1806,10 @@ def revert_doc_colors(document):
     x11 = False
     svg = False
     dvips = False
-    revert_doc_col(document, "\\fontcolor", "none", xcolor, x11, svg, dvips)
-    revert_doc_col(document, "\\backgroundcolor", "none", xcolor, x11, svg, 
dvips)
-    revert_doc_col(document, "\\notefontcolor", "lightgray", xcolor, x11, svg, 
dvips)
-    revert_doc_col(document, "\\boxbgcolor", "red", xcolor, x11, svg, dvips)
+    revert_doc_col(document, "\\fontcolor", "none", xcolor, x11, svg, dvips, 
False)
+    revert_doc_col(document, "\\backgroundcolor", "none", xcolor, x11, svg, 
dvips, False)
+    revert_doc_col(document, "\\notefontcolor", "lightgray", xcolor, x11, svg, 
dvips, True)
+    revert_doc_col(document, "\\boxbgcolor", "red", xcolor, x11, svg, dvips, 
True)
     
     # Preamble stuff if needed
     if xcolor == True:
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to