]> git.lyx.org Git - lyx.git/blobdiff - lib/lyx2lyx/lyx2lyx_tools.py
Fixed remaining glitches in tcolorbox reversion routines
[lyx.git] / lib / lyx2lyx / lyx2lyx_tools.py
index cb1996ecb58af99018351c6bdd20fb98bacfb7d5..f8d30cd4706d74c27ff6ecc3d8b7c467981de0ca 100644 (file)
@@ -86,7 +86,7 @@ remove_document_option(document, option):
 '''
 
 import re
-from parser_tools import find_token, find_end_of_inset
+from parser_tools import find_token, find_end_of_inset, get_containing_layout
 from unicode_symbols import unicode_reps
 
 # This will accept either a list of lines or a single line.
@@ -465,7 +465,7 @@ def revert_font_attrs(lines, name, LaTeXname):
   while True:
     i = find_token(lines, name + ' on', i)
     if i == -1:
-      return changed
+      break
     j = find_token(lines, name + ' default', i)
     k = find_token(lines, name + ' on', i + 1)
     # if there is no default set, the style ends with the layout
@@ -479,6 +479,16 @@ def revert_font_attrs(lines, name, LaTeXname):
     changed = True
     i += 1
 
+  # now delete all remaining lines that manipulate this attribute
+  i = 0
+  while True:
+    i = find_token(lines, name, i)
+    if i == -1:
+      break
+    del lines[i]
+
+  return changed
+
 
 def revert_layout_command(lines, name, LaTeXname):
   " Reverts a command from a layout to TeX code "