layout_exp = re.compile(r"\\layout (\S*)")
math_env = ["\\[","\\begin{eqnarray*}","\\begin{eqnarray}","\\begin{equation}"]
-def replace_protected_separator(lines):
+def replace_protected_separator(file):
+ lines = file.body
i=0
while 1:
i = find_token(lines, "\\protected_separator", i)
del lines[i]
-def merge_formula_inset(lines):
+def merge_formula_inset(file):
+ lines = file.body
i=0
while 1:
i = find_token(lines, "\\begin_inset Formula", i)
# Update from tabular format 4 to 5 if necessary
-def update_tabular(lines):
+def update_tabular(file):
+ lines = file.body
lyxtable_re = re.compile(r".*\\LyXTable$")
i=0
while 1:
i = i + 1
-def update_toc(lines):
+def update_toc(file):
+ lines = file.body
i = 0
while 1:
i = find_token(lines, '\\begin_inset LatexCommand \\tableofcontents', i)
i = i + 1
-def remove_cursor(lines):
+def remove_cursor(file):
+ lines = file.body
i = find_token(lines, '\\cursor', 0)
if i != -1:
del lines[i]
-def remove_vcid(lines):
+def remove_vcid(file):
+ lines = file.header
i = find_token(lines, '\\lyxvcid', 0)
if i != -1:
del lines[i]
del lines[i]
-def first_layout(lines):
+def first_layout(file):
+ lines = file.body
while (lines[0] == ""):
del lines[0]
if lines[0][:7] != "\\layout":
lines[:0] = ["\\layout Standard"]
-def remove_space_in_units(lines):
+def remove_space_in_units(file):
+ lines = file.header
margins = ["\\topmargin","\\rightmargin",
"\\leftmargin","\\bottommargin"]
i = i + 1
-def convert(header, body, opt):
- first_layout(body)
- remove_vcid(header)
- remove_cursor(body)
- update_toc(body)
- replace_protected_separator(body)
- merge_formula_inset(body)
- update_tabular(body)
- remove_space_in_units(header)
- opt.format = 216
-
-
-def revert(header, body, opt):
- opt.error("The convertion to an older format (%s) is not implemented." % opt.format)
+convert = [[216, [first_layout, remove_vcid, remove_cursor, update_toc,
+ replace_protected_separator, merge_formula_inset,
+ update_tabular, remove_space_in_units]]]
+revert = []
if __name__ == "__main__":
pass