]> git.lyx.org Git - lyx.git/blobdiff - lib/lyx2lyx/lyx_1_3.py
AEA.lyx: update to address latest AEA version
[lyx.git] / lib / lyx2lyx / lyx_1_3.py
index 9a9a9d6bba5c79fee6307a17b5e8f953b47d409b..195f0dcbac15bef29f71dd3c2fd1277d8ef908f5 100644 (file)
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 """ Convert files to the file format generated by lyx 1.3"""
 
-import string
 import re
 from parser_tools import find_token, find_end_of, get_value,\
-                         find_token_exact, del_token
+                         find_token_exact
 
 ####################################################################
 # Private helper functions
@@ -31,6 +30,22 @@ def find_end_of_inset(lines, i):
     "Finds the matching \end_inset"
     return find_end_of(lines, i, "\\begin_inset", "\\end_inset")
 
+
+def del_token(lines, token, start, end):
+    """ del_token(lines, token, start, end) -> int
+
+    Find the lower line in lines where token is the first element and
+    delete that line.
+
+    Returns the number of lines remaining."""
+
+    k = find_token_exact(lines, token, start, end)
+    if k == -1:
+        return end
+    else:
+        del lines[k]
+        return end - 1
+
 # End of helper functions
 ####################################################################
 
@@ -63,7 +78,7 @@ def change_insetgraphics(document):
         if k == -1:
             k = find_token_exact(lines, "size_kind", i, j)
         if k != -1:
-            size_type = string.split(lines[k])[1]
+            size_type = lines[k].split()[1]
             del lines[k]
             j = j-1
             if size_type in ["0", "original"]:
@@ -82,7 +97,7 @@ def change_insetgraphics(document):
         if k == -1:
             k = find_token_exact(lines, "lyxsize_kind", i, j)
         if k != -1:
-            lyxsize_type = string.split(lines[k])[1]
+            lyxsize_type = lines[k].split()[1]
             del lines[k]
             j = j-1
             j = del_token(lines, "lyxwidth", i, j)