]> git.lyx.org Git - features.git/blob - lib/lyx2lyx/lyxrevert_223.py
support backward saving for 1.3.x format.
[features.git] / lib / lyx2lyx / lyxrevert_223.py
1 # This file is part of lyx2lyx
2 # Copyright (C) 2003 Jos\81é Matos <jamatos@fep.up.pt>
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17
18 import string
19 from parser_tools import find_token
20
21 def rm_end_header(lines):
22     i = find_token(lines, "\\end_header", 0)
23     if i == -1:
24         return
25     del lines[i]
26
27 def convert_spaces(lines):
28     for i in range(len(lines)):
29         lines[i] = string.replace(lines[i],"\\InsetSpace ~", "\\SpecialChar ~")
30
31 def convert_bibtex(lines):
32     for i in range(len(lines)):
33         lines[i] = string.replace(lines[i], "\\begin_inset LatexCommand \\bibtex",
34                                   "\\begin_inset LatexCommand \\BibTeX")
35
36 def rm_tracking_changes(lines):
37     i = find_token(lines, "\\tracking_changes", 0)
38     if i == -1:
39         return
40     del lines[i]
41
42 #FIXME
43 def rm_body_changes(lines):
44     pass
45
46 def convert(header, body):
47     rm_end_header(header)
48     convert_spaces(body)
49     convert_bibtex(body)
50     rm_tracking_changes(header)
51     rm_body_changes(body)
52
53 if __name__ == "__main__":
54     pass