format = get_format(lines)
while format < current_format:
- for c in conversions[format]:
+ target_format, convert = conversions[format]
+ old_format = format
+
+ # make sure the conversion list is sequential
+ if int(old_format) + 1 != target_format:
+ sys.stderr.write("Something is wrong with the conversion chain.\n")
+ sys.exit(1)
+
+ for c in convert:
for i in range(len(lines)):
(update, newline) = c(lines[i])
if update:
lines[i] = newline
update_format(lines)
+ format = get_format(lines)
# sanity check
- old_format = format
- format = get_format(lines)
if int(old_format) + 1 != int(format):
sys.stderr.write("Failed to convert to new format!\n")
sys.exit(1)
# Conversion chain
conversions = [
- [ # this will be a long list of conversions for format 0
+ [ 1, [ # this will be a long list of conversions to format 1
next_inset_toggle,
next_inset_modify,
optional_insert,
paragraph_spacing,
tabular_feature,
Bar2bar
- ] # end conversions for format 0
+ ]],
]
conversions = [
- [ # this will be a long list of conversions for format 0
+ [ 1, [ # this will be a long list of conversions to format 1
export_menu,
latex_flavor,
remove_obsolete,
language_use_babel,
language_package
- ] # end conversions for format 0
+ ]],
]