]> git.lyx.org Git - lyx.git/blobdiff - lib/lyx2lyx/LyX.py
clean up french language handling
[lyx.git] / lib / lyx2lyx / LyX.py
index 4b5dadcf0d5a96817f81fb495ff41e67e8108565..7647dc830448578e7f6bbaa286d18dd0ad508536 100644 (file)
@@ -46,7 +46,7 @@ format_relation = [("0_10",  [210], ["0.10.7","0.10"]),
                    ("1_1_6fix3", [218], ["1.1.6fix3","1.1.6fix4","1.1"]),
                    ("1_2", [220], ["1.2.0","1.2.1","1.2.3","1.2.4","1.2"]),
                    ("1_3", [221], ["1.3.0","1.3.1","1.3.2","1.3.3","1.3.4","1.3.5","1.3"]),
-                   ("1_4", range(223,242), ["1.4.0cvs","1.4"])]
+                   ("1_4", range(223,243), ["1.4.0cvs","1.4"])]
 
 
 def formats_list():
@@ -112,19 +112,23 @@ class LyX_Base:
         self.textclass = "article"
         self.header = []
         self.body = []
+        self.status = 0
 
 
     def warning(self, message, debug_level= default_debug_level):
         " Emits warning to self.error, if the debug_level is less than the self.debug."
         if debug_level <= self.debug:
-            self.err.write(message + "\n")
+            self.err.write("Warning: " + message + "\n")
 
 
     def error(self, message):
-        " Emits a warning and exist incondicionally."
+        " Emits a warning and exits if not in try_hard mode."
         self.warning(message)
-        self.warning("Quiting.")
-        sys.exit(1)
+        if not self.try_hard:
+            self.warning("Quiting.")
+            sys.exit(1)
+
+        self.status = 2
 
 
     def read(self):
@@ -149,8 +153,13 @@ class LyX_Base:
             if not preamble:
                 line = string.strip(line)
 
-            if not line and not preamble:
-                break
+            if not preamble:
+                if not line:
+                    continue
+
+                if string.split(line)[0] in ("\\layout", "\\begin_layout", "\\begin_body"):
+                    self.body.append(line)
+                    break
 
             self.header.append(line)
 
@@ -290,6 +299,7 @@ class LyX_Base:
                                      default_debug_level)
                         if not self.try_hard:
                             raise
+                        self.status = 2
                     else:
                         self.warning("%lf: Elapsed time on %s"  % (time.time() - init_t, str(conv)),
                                      default_debug_level + 1)