]> git.lyx.org Git - features.git/commitdiff
Conversions for notes-mutate and argument-insert, plus a little cleanup.
authorRichard Heck <rgheck@comcast.net>
Sat, 18 Sep 2010 14:27:12 +0000 (14:27 +0000)
committerRichard Heck <rgheck@comcast.net>
Sat, 18 Sep 2010 14:27:12 +0000 (14:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35431 a592a061-630c-0410-9148-cb99ea01b6c8

lib/scripts/prefs2prefs_lfuns.py

index d1ac78561bce9b0d4d926b7a84e5dc3b22e7a33c..386a167d20a51764dbc3f6b31da628e31f322b7e 100644 (file)
@@ -31,10 +31,11 @@ current_format = 1
 # where the bool indicates whether we changed anything. In 
 # that case, one normally returns: (False, []).
 
+no_match = (False, [])
 
 def simple_renaming(line, old, new):
        if line.find(old) == -1:
-               return (False, [])
+               return no_match
        line = line.replace(old, new)
        return (True, line)
 
@@ -47,6 +48,25 @@ def next_inset_toggle(line):
        return simple_renaming(line, "next-inset-toggle", "inset-toggle")
 
 
+def optional_insert(line):
+       return simple_renaming(line, "argument-insert", "optional-insert")
+
+
+re_nm = re.compile(r'^(.*)notes-mutate\s+(\w+)\s+(\w+)(.*)')
+def notes_mutate(line):
+       m = re_nm.search(line)
+       if not m:
+               return no_match
+
+       prerix = m.group(1)
+       source = m.group(2)
+       target = m.group(3)
+       suffix = m.group(4)
+       newline = prefix + "inset-forall Note:" + source + \
+               " inset-modify note Note " + target + suffix
+       return (True, newline)
+
+
 #
 #
 ###########################################################
@@ -57,7 +77,9 @@ def next_inset_toggle(line):
 conversions = [
        [ # this will be a long list of conversions for format 0
                next_inset_toggle,
-               next_inset_modify
+               next_inset_modify,
+               optional_insert,
+               notes_mutate
        ] # end conversions for format 0
 ]