Author: rgheck
Date: Fri Nov  5 16:18:47 2010
New Revision: 36117
URL: http://www.lyx.org/trac/changeset/36117

Log:
Rename and restructure get_containing_inset.

Modified:
   lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py
   lyx-devel/trunk/lib/lyx2lyx/parser_tools.py

Modified: lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py
==============================================================================
--- lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py      Fri Nov  5 16:13:42 2010        
(r36116)
+++ lyx-devel/trunk/lib/lyx2lyx/lyx_2_0.py      Fri Nov  5 16:18:47 2010        
(r36117)
@@ -25,7 +25,7 @@
 
 from parser_tools import find_token, find_end_of, find_tokens, \
   find_end_of_inset, find_end_of_layout, find_token_backwards, \
-  get_containing_inset, get_value, get_quoted_value
+  is_in_inset, get_value, get_quoted_value
   
 from lyx2lyx_tools import add_to_preamble, insert_to_preamble, \
   put_cmd_in_ert, lyx2latex, latex_length, revert_flex_inset, \
@@ -1619,10 +1619,11 @@
       i += 1
       # Make sure it is actually in an inset!
       # A normal line could begin with "LatexCommand nameref"!
-      stins, endins = get_containing_inset(document.body, cmdloc, \
+      val = is_in_inset(document.body, cmdloc, \
           "\\begin_inset CommandInset ref")
-      if stins == -1:
-        continue
+      if not val:
+          continue
+      stins, endins = val
 
       # ok, so it is in an InsetRef
       refline = find_token(document.body, "reference", stins, endins)
@@ -1655,9 +1656,9 @@
     i += 1
     
     # Make sure it is actually in an inset!
-    stins, endins = get_containing_inset(document.body, \
-        cmdloc, "\\begin_inset CommandInset ref")
-    if stins == -1:
+    val = is_in_inset(document.body, cmdloc, \
+        "\\begin_inset CommandInset ref")
+    if not val:
       continue
     document.body[cmdloc] = "LatexCommand nameref"
 

Modified: lyx-devel/trunk/lib/lyx2lyx/parser_tools.py
==============================================================================
--- lyx-devel/trunk/lib/lyx2lyx/parser_tools.py Fri Nov  5 16:13:42 2010        
(r36116)
+++ lyx-devel/trunk/lib/lyx2lyx/parser_tools.py Fri Nov  5 16:18:47 2010        
(r36117)
@@ -245,11 +245,11 @@
 
 # checks if line i is in the given inset
 # if so, returns starting and ending lines
-# otherwise, returns (-1, -1)
+# otherwise, returns False
 # Example:
-#  get_containing_inset(document.body, i, "\\begin_inset Tabular")
-# returns (-1, -1) unless i is within a table.
-def get_containing_inset(lines, i, inset):
+#  is_in_inset(document.body, i, "\\begin_inset Tabular")
+# returns False unless i is within a table.
+def is_in_inset(lines, i, inset):
     defval = (-1, -1)
     stins = find_token_backwards(lines, inset, i)
     if stins == -1:

Reply via email to