]> git.lyx.org Git - features.git/commitdiff
Fix wrong lyx2lyx routines for r30756.
authorVincent van Ravesteijn <vfr@lyx.org>
Fri, 24 Jul 2009 20:48:49 +0000 (20:48 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Fri, 24 Jul 2009 20:48:49 +0000 (20:48 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30764 a592a061-630c-0410-9148-cb99ea01b6c8

lib/lyx2lyx/lyx_2_0.py

index 96e681204cafb345d2510ed931d1456922c1621d..c648509becaaba1f549a2ff55c1f96fa806b6dfd 100644 (file)
@@ -956,14 +956,15 @@ def convert_author_id(document):
         if i == -1:
             break
         
-        author = document.header[i].split(' ')
-        name = '\"\"'
-        if len(author) >= 2:
-            name = author[1]\r
-        email = ''\r
-        if len(author) == 3:\r
-            email = author[2]              \r
-        document.header[i] = "\\author %i %s %s" % (j, name, email)\r
+        r = re.compile(r'(\\author) (\".*\")\s?(.*)$')
+        m = r.match(document.header[i])
+        if m != None:
+            name = m.group(2)\r
+            \r
+            email = ''\r
+            if m.lastindex == 3:\r
+                email = m.group(3)\r
+            document.header[i] = "\\author %i %s %s" % (j, name, email)\r
         j = j + 1
         i = i + 1\r
         \r
@@ -990,16 +991,18 @@ def revert_author_id(document):
         i = find_token(document.header, "\\author", i)
         if i == -1:
             break
-        author = document.header[i].split(' ')
-        name = '\"\"'
-        if len(author) >= 3:
-            author_id = int(author[1])
+        
+        r = re.compile(r'(\\author) (\d+) (\".*\")\s?(.*)$')
+        m = r.match(document.header[i])
+        if m != None:
+            author_id = int(m.group(2))
             idmap[author_id] = j
-            name = author[2]
-        email = ''
-        if len(author) == 4:
-            email = author[3]
-        document.header[i] = "\\author %s %s" % (name, email)
+            name = m.group(3)\r
+            \r
+            email = ''\r
+            if m.lastindex == 4:\r
+                email = m.group(4)\r
+            document.header[i] = "\\author %s %s" % (name, email)
         i = i + 1
         j = j + 1