]> git.lyx.org Git - features.git/blobdiff - lib/lyx2lyx/lyx_1_5.py
Fix importing of klewer template, add fix for recent update (null update for format...
[features.git] / lib / lyx2lyx / lyx_1_5.py
index b0adef8a9c482a4c9923b24323163a69dfd5e4fd..45f7375ccfc2d5d04312093c5fc3a3369faba97a 100644 (file)
@@ -340,19 +340,24 @@ key "argument"
 
 This must be called after convert_commandparams.
 """
-    regex = re.compile(r'\S+\s*(\[[^\[\{]*\])?(\{[^}]*\})')
     i = 0
     while 1:
         i = find_token(document.body, "\\bibitem", i)
         if i == -1:
             break
-        match = re.match(regex, document.body[i])
-        option = match.group(1)
-        argument = match.group(2)
+        j = document.body[i].find('[') + 1
+        k = document.body[i].rfind(']')
+        if j == 0: # No optional argument found
+            option = None
+        else:
+            option = document.body[i][j:k]
+        j = document.body[i].rfind('{') + 1
+        k = document.body[i].rfind('}')
+        argument = document.body[i][j:k]
         lines = ['\\begin_inset LatexCommand bibitem']
         if option != None:
-            lines.append('label "%s"' % option[1:-1].replace('"', '\\"'))
-        lines.append('key "%s"' % argument[1:-1].replace('"', '\\"'))
+            lines.append('label "%s"' % option.replace('"', '\\"'))
+        lines.append('key "%s"' % argument.replace('"', '\\"'))
         lines.append('')
         lines.append('\\end_inset')
         document.body[i:i+1] = lines
@@ -1564,7 +1569,8 @@ convert = [[246, []],
            [266, []],
            [267, []],
            [268, []],
-           [269, []]]
+           [269, []],
+           [270, []]]
 
 revert =  [[269, [revert_beamer_alert, revert_beamer_structure]],
            [268, [revert_preamble_listings_params, revert_listings_inset, revert_include_listings]],