]> git.lyx.org Git - features.git/commitdiff
Conversion for all-insets-toggle.
authorRichard Heck <rgheck@comcast.net>
Sat, 18 Sep 2010 14:42:38 +0000 (14:42 +0000)
committerRichard Heck <rgheck@comcast.net>
Sat, 18 Sep 2010 14:42:38 +0000 (14:42 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35432 a592a061-630c-0410-9148-cb99ea01b6c8

lib/scripts/prefs2prefs_lfuns.py

index 386a167d20a51764dbc3f6b31da628e31f322b7e..3a0b0e25035141e4949ec7d5e9b53292f3e68988 100644 (file)
@@ -52,13 +52,13 @@ def optional_insert(line):
        return simple_renaming(line, "argument-insert", "optional-insert")
 
 
-re_nm = re.compile(r'^(.*)notes-mutate\s+(\w+)\s+(\w+)(.*)')
+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)
+       prefix = m.group(1)
        source = m.group(2)
        target = m.group(3)
        suffix = m.group(4)
@@ -67,6 +67,37 @@ def notes_mutate(line):
        return (True, newline)
 
 
+re_ait = re.compile(r'^(.*)all-insets-toggle\s+(\w+)(?:\s+(\w+))?(.*)$')
+def all_insets_toggle(line):
+       m = re_ait.search(line)
+       if not m:
+               return no_match
+
+       prefix = m.group(1)
+       action = m.group(2)
+       target = m.group(3) 
+       suffix = m.group(4)
+
+       # we need to transform the target to match the inset layout names
+       # this will not be perfect
+       if target == "ert":
+               target = "ERT"
+       elif target == None:
+               target = "*"
+       elif target == "tabular":
+               # There does not seem to be an InsetLayout for tables, so
+               # I do not know what to do here. If anyone does, then please
+               # fix this. For now, we just have to remove this line.
+               return (True, "")
+       else:
+               target = target.capitalize()
+       
+       newline = prefix + "inset-forall " + target + " inset-toggle " + \
+               action + suffix
+       return (True, newline)
+
+
+
 #
 #
 ###########################################################
@@ -79,7 +110,8 @@ conversions = [
                next_inset_toggle,
                next_inset_modify,
                optional_insert,
-               notes_mutate
+               notes_mutate,
+               all_insets_toggle
        ] # end conversions for format 0
 ]