+2005-02-17 Georg Baum <Georg.Baum@post.rwth-aachen.de>
+
+ * lyx_1_4.py (convert_table_valignment_middle,
+ revert_valignment_middle): use regex to recognize
+ '\\begin_inset Tabular' and '\\begin_inset Tabular'
+ * lyx_1_2.py (update_tabular, update_longtables): ditto
+ * lyx_1_1_6fix3.py (update_tabular): ditto
+
2005-02-15 José Matos <jamatos@lyx.org>
* lyx_1_2.py (remove_pextra): fix bug 1816.
2005-02-15 José Matos <jamatos@lyx.org>
* lyx_1_2.py (remove_pextra): fix bug 1816.
-from parser_tools import find_token
+from parser_tools import find_token, find_re
def bool_table(item):
if item == "0":
def bool_table(item):
if item == "0":
table_meta_re = re.compile(r'<LyXTabular version="?1"? rows="?(\d*)"? columns="?(\d*)"?>')
def update_tabular(file):
table_meta_re = re.compile(r'<LyXTabular version="?1"? rows="?(\d*)"? columns="?(\d*)"?>')
def update_tabular(file):
+ regexp = re.compile(r'^\\begin_inset\s+Tabular')
lines = file.body
i=0
while 1:
lines = file.body
i=0
while 1:
- i = find_token(lines, '\\begin_inset Tabular', i)
+ i = find_re(lines, regexp, i)
line_re = re.compile(r'<(features|column|row|cell)')
def update_tabular(file):
line_re = re.compile(r'<(features|column|row|cell)')
def update_tabular(file):
+ regexp = re.compile(r'^\\begin_inset\s+Tabular')
lines = file.body
i = 0
while 1:
lines = file.body
i = 0
while 1:
- i = find_token(lines, '\\begin_inset Tabular', i)
+ i = find_re(lines, regexp, i)
ltvalues_re = re.compile(r'endhead="(-?\d*)" endfirsthead="(-?\d*)" endfoot="(-?\d*)" endlastfoot="(-?\d*)"')
lt_features_re = re.compile(r'(endhead="-?\d*" endfirsthead="-?\d*" endfoot="-?\d*" endlastfoot="-?\d*")')
def update_longtables(file):
ltvalues_re = re.compile(r'endhead="(-?\d*)" endfirsthead="(-?\d*)" endfoot="(-?\d*)" endlastfoot="(-?\d*)"')
lt_features_re = re.compile(r'(endhead="-?\d*" endfirsthead="-?\d*" endfoot="-?\d*" endlastfoot="-?\d*")')
def update_longtables(file):
+ regexp = re.compile(r'^\\begin_inset\s+Tabular')
body = file.body
i = 0
while 1:
body = file.body
i = 0
while 1:
- i = find_token(body, '\\begin_inset Tabular', i)
+ i = find_re(body, regexp, i)
if i == -1:
break
i = i + 1
if i == -1:
break
i = i + 1
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2002 Dekel Tsur <dekel@lyx.org>
# Copyright (C) 2002-2004 José Matos <jamatos@lyx.org>
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2002 Dekel Tsur <dekel@lyx.org>
# Copyright (C) 2002-2004 José Matos <jamatos@lyx.org>
-# Copyright (C) 2004-2005 Georg Baum <Georg.Baum@post.rwth-aachen.de>
+# Copyright (C) 2004-2005 Georg Baum <Georg.Baum@post.rwth-aachen.de>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
import os.path
from parser_tools import find_token, find_end_of_inset, get_next_paragraph, \
get_paragraph, get_value, del_token, is_nonempty_line,\
import os.path
from parser_tools import find_token, find_end_of_inset, get_next_paragraph, \
get_paragraph, get_value, del_token, is_nonempty_line,\
- find_tokens, find_end_of, find_token2
+ find_tokens, find_end_of, find_token2, find_re
from sys import stdin
from string import replace, split, find, strip, join
from sys import stdin
from string import replace, split, find, strip, join
def convert_table_valignment_middle(file):
def convert_table_valignment_middle(file):
+ regexp = re.compile(r'^\\begin_inset\s+Tabular')
- i = find_token(file.body, '\\begin_inset Tabular', i)
+ i = find_re(file.body, regexp, i)
if i == -1:
return
j = find_end_of_inset(file.body, i + 1)
if i == -1:
return
j = find_end_of_inset(file.body, i + 1)
def revert_valignment_middle(file):
def revert_valignment_middle(file):
+ regexp = re.compile(r'^\\begin_inset\s+Tabular')
- i = find_token(file.body, '\\begin_inset Tabular', i)
+ i = find_re(file.body, regexp, i)
if i == -1:
return
j = find_end_of_inset(file.body, i + 1)
if i == -1:
return
j = find_end_of_inset(file.body, i + 1)