]> git.lyx.org Git - lyx.git/blobdiff - lib/scripts/prefs2prefs_lfuns.py
sweave.lyx: generate both pdf files and eps files
[lyx.git] / lib / scripts / prefs2prefs_lfuns.py
index 0606736dfde18767360bfe6fb64d6024677c626a..0461cc26b529a8970488d118120f9385c61db387 100644 (file)
 
 import sys, re
 
-current_format = 1
-
 ###########################################################
 #
 # Actual converter functions
 #
 # These accept a line as argument and should return a list:
 #  (bool, newline)
-# where the bool indicates whether we changed anything. I
-# that case, one normally returns: (False, []).
+# where the bool indicates whether we changed anything. If not,
+# one normally returns: (False, []).
 
 no_match = (False, [])
 
@@ -49,7 +47,7 @@ def next_inset_toggle(line):
 
 
 def optional_insert(line):
-       return simple_renaming(line, "argument-insert", "optional-insert")
+       return simple_renaming(line, "optional-insert", "argument-insert")
 
 
 re_nm = re.compile(r'^(.*)notes-mutate\s+(\w+)\s+(\w+)(.*)$')
@@ -136,6 +134,26 @@ def paragraph_spacing(line):
 def tabular_feature(line):
        return simple_renaming(line, "tabular-feature", "inset-modify tabular")
 
+re_Bar2bar = re.compile(r'^(\\(?:bind|unbind))\s+"([^"]*)Bar"(\s+"[^"]+")')
+def Bar2bar(line):
+       m = re_Bar2bar.search(line)
+       if not m:
+               return no_match
+
+       btype = m.group(1)
+       mod = m.group(2)
+       rest = m.group(3)
+       newline = btype + " \"" + mod + "bar\"" + rest
+       return (True, newline)
+
+def paragraph_break(line):
+       return simple_renaming(line, "break-paragraph", "paragraph-break")
+
+def tab_group_close(line):
+       return simple_renaming(line, "close-tab-group", "tab-group-close")
+
+def view_split(line):
+       return simple_renaming(line, "split-view", "view-split")
 
 #
 #
@@ -145,7 +163,7 @@ def tabular_feature(line):
 # 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, LyX 2.0
                next_inset_toggle,
                next_inset_modify,
                optional_insert,
@@ -154,7 +172,13 @@ conversions = [
                line_insert,
                toc_insert,
                paragraph_spacing,
-               tabular_feature
-       ] # end conversions for format 0
+               tabular_feature,
+               Bar2bar
+       ]],
+       [  2, [ # list of conversions to format 2, LyX 2.1
+               paragraph_break,
+               tab_group_close,
+               view_split
+       ]],
 ]