2 # -*- coding: utf-8 -*-
4 # file prefs2prefs-lfuns.py
5 # This file is part of LyX, the document processor.
6 # Licence details can be found in the file COPYING.
10 # Full author contact details are available in file CREDITS
12 # This file houses conversion information for the preferences file.
14 # The converter functions take a line as argument and return a list:
16 # where the Bool says if we've modified anything and the NewLine is
17 # the new line, if so, which will be used to replace the old line.
20 ###########################################################
24 def simple_renaming(line, old, new):
25 if line.find(old) == -1:
27 line = line.replace(old, new)
30 no_match = (False, [])
32 ########################
33 ### Format 1 conversions
35 def remove_obsolete(line):
36 tags = ("\\use_tempdir", "\\spell_command", "\\personal_dictionary",
37 "\\plaintext_roff_command", "\\use_alt_language",
38 "\\use_escape_chars", "\\use_input_encoding",
39 "\\use_personal_dictionary", "\\use_pspell",
43 if line.startswith(tag):
47 def language_use_babel(line):
48 if not line.startswith("\language_use_babel"):
50 re_lub = re.compile(r'^\\language_use_babel\s+(true|false)')
51 m = re_lub.match(line)
56 newline = "\\language_package_selection " + newval
57 return (True, newline)
59 def language_package(line):
60 return simple_renaming(line, "\\language_package", "\\language_custom_package")
63 ########################
67 [ # this will be a long list of conversions for format 0
71 ] # end conversions for format 0