]> git.lyx.org Git - lyx.git/blobdiff - development/tools/generate_symbols_list.py
Do not kill the undo stack when doing a Save As...
[lyx.git] / development / tools / generate_symbols_list.py
index ee9b3abbf027431b84994650761dcbd790f70f0b..a18dd690c93be628e191c9ca3bbb153749f72c51 100644 (file)
@@ -1,9 +1,6 @@
 #!/usr/bin/python
 import sys,string,re,os
 
-def is_prefix(a, b):
-    return a[:len(b)] == b
-
 def get_code(code, font):
     if code < 10:
        return code+161
@@ -31,7 +28,7 @@ def process(file):
        if i+1 < n:
            next_line = lines[i+1]
 
-       # some entries are spread over two lines so we join the next line 
+       # some entries are spread over two lines so we join the next line
        # to the current one, (if current line contains a comment, we remove it)
        line = string.split(line,'%')[0]+next_line
 
@@ -52,10 +49,10 @@ def process(file):
                type = "mathord"
                font = mo.group(2)
                code = mo.group(3)
-           
+
        if mo != None and symbol not in ignore_list:
            mo2 = re.match(r'\s*\\def\\(.*?)\{', next_line)
-           if mo2 != None and is_prefix(symbol,mo2.group(1)):
+           if mo2 != None and symbol == mo2.group(1)+"op":
                sys.stderr.write("%s -> %s\n" % (symbol, mo2.group(1)))
                symbol = mo2.group(1)
 
@@ -96,10 +93,10 @@ for file in sys.argv[1:]:
     print
 
 exceptions = [
-    ("neq", "none", 0, 185, "mathrel"),
-    ("textdegree", "none", 0, 176, "mathord"),
-    ("cong", "none", 0, 64, "mathrel"),
-    ("surd", "note", 0, 214, "mathord")
+    ("neq", "x", 0, 185, "mathrel"),
+    ("textdegree", "x", 0, 176, "mathord"),
+    ("cong", "x", 0, 64, "mathrel"),
+    ("surd", "x", 0, 214, "mathord")
 ]
 
 if xsymbols.has_key("leq"):
@@ -110,5 +107,13 @@ for x in exceptions:
     if xsymbols.has_key(x[0]):
        del xsymbols[x[0]]
 
+print """
+lyxbar             cmsy 161   0 mathord
+lyxeq              cmr   61   0 mathord
+lyxdabar           msa   57   0 mathord
+lyxright           msa   75   0 mathord
+lyxleft            msa   76   0 mathord
+"""
+
 for symbol in xsymbols.keys():
     sys.stderr.write(symbol+"\n")