]> git.lyx.org Git - lyx.git/commitdiff
* layout2layout.py : Don't choke on empty input file.
authorJulien Rioux <jrioux@lyx.org>
Mon, 12 Sep 2011 20:42:22 +0000 (20:42 +0000)
committerJulien Rioux <jrioux@lyx.org>
Mon, 12 Sep 2011 20:42:22 +0000 (20:42 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39665 a592a061-630c-0410-9148-cb99ea01b6c8

lib/scripts/layout2layout.py

index a59dfcfae2afbd3425278d44a4f8ee17edf69e90..66caa57ece0bd931603309ad71b062d4325e01f8 100644 (file)
@@ -152,7 +152,7 @@ def trim_bom(line):
 
 def read(source):
     " Read input file and strip lineendings."
-    lines = source.read().splitlines()
+    lines = source.read().splitlines() or ['']
     lines[0] = trim_bom(lines[0])
     return lines
 
@@ -753,6 +753,8 @@ def convert(lines):
 
         i += 1
 
+    if only_comment:
+        lines.insert(i, "Format 2")
     if usemodules:
         i = formatline + 1
         for mod in usemodules: