On Sunday 18 April 2004 13:48, Georg Baum wrote: > > lyx2lyx -t 221 still does not work, because it calls lyx_1_3.py. I > think the following fixes it, but I am not sure wether it works in > all cases: > > diff -u -p -r1.20 parser_tools.py > --- lib/lyx2lyx/parser_tools.py 2004/04/14 08:45:46 1.20 > +++ lib/lyx2lyx/parser_tools.py 2004/04/18 12:17:52 > @@ -343,9 +343,7 @@ def chain(opt, initial_version): > mode = "revert" > for step in format_relation: > if final_step <= step[0] <= initial_step: > - steps.insert(0, step[0]) > - > - if step[1][-1:] == opt.end: > - del steps[0] > + if step[1][0] != opt.end: > + steps.insert(0, step[0]) > > return mode, steps
This is my answer: :-) And now it works. :-) --- parser_tools.py 14 Apr 2004 08:45:46 -0000 1.20 +++ parser_tools.py 19 Apr 2004 14:13:51 -0000 @@ -341,11 +341,16 @@ def chain(opt, initial_version): steps.append(step[0]) else: mode = "revert" - for step in format_relation: + relation_format = format_relation + relation_format.reverse() + last_step = None + + for step in relation_format: if final_step <= step[0] <= initial_step: - steps.insert(0, step[0]) + steps.append(step[0]) + last_step = step - if step[1][-1:] == opt.end: - del steps[0] + if last_step[1][-1] == opt.end: + steps.pop() return mode, steps > There are two problems with the original code: > > 1. opt.end is a scalar, while step[1][-1:] is an array with one > element. So the comparison fails > 2. After the for loop, step is the last entry in format_relation. > Therefore, step[1][-1:] is [232]. That was a mistake the original intent was step[1][-1] as it is now. > Georg -- José Abílio LyX and docbook, a perfect match. :-)