]> git.lyx.org Git - lyx.git/blobdiff - lib/lyx2lyx/lyx2lyx_tools.py
Reminders.
[lyx.git] / lib / lyx2lyx / lyx2lyx_tools.py
index 42ed89da9852f7c14a464837da57560196e39954..8f25f955576515f46433ad83cbcdfd171ff64c75 100644 (file)
@@ -28,6 +28,7 @@ def add_to_preamble(document, text):
     Only the first line is checked!"""
 
     if not type(text) is list:
+      document.warning("You should pass a list to add_to_preamble!")
       # split on \n just in case
       # it'll give us the one element list we want
       # if there's no \n, too
@@ -45,6 +46,7 @@ def insert_to_preamble(index, document, text):
     """ Insert text to the preamble at a given line"""
     
     if not type(text) is list:
+      document.warning("You should pass a list to insert_to_preamble!")
       # split on \n just in case
       # it'll give us the one element list we want
       # if there's no \n, too
@@ -352,6 +354,7 @@ def revert_layout_command(document, name, LaTeXname, position):
 
 
 def hex2ratio(s):
+  " Converts an RRGGBB-type hexadecimal string to a float in [0.0,1.0] "
   try:
     val = int(s, 16)
   except:
@@ -360,3 +363,8 @@ def hex2ratio(s):
     val += 1
   return str(val / 256.0)
 
+
+def str2bool(s):
+  "'true' goes to True, case-insensitively, and we strip whitespace."
+  s = s.strip().lower()
+  return s == "true"