mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Fix indentation for 'python -tt'
This commit is contained in:
parent
25da36a978
commit
ca546a8b7e
@ -5,18 +5,18 @@ def get_code(code, font):
|
|||||||
if font != "dontknowwhichfontusesthisstrangeencoding":
|
if font != "dontknowwhichfontusesthisstrangeencoding":
|
||||||
return code
|
return code
|
||||||
if code < 10:
|
if code < 10:
|
||||||
return code+161
|
return code+161
|
||||||
elif code < 32:
|
elif code < 32:
|
||||||
return code+163
|
return code+163
|
||||||
else:
|
else:
|
||||||
return code
|
return code
|
||||||
|
|
||||||
font_names = {}
|
font_names = {}
|
||||||
symbols = {}
|
symbols = {}
|
||||||
xsymbols = {}
|
xsymbols = {}
|
||||||
|
|
||||||
ignore_list = ["not", "braceld", "bracerd", "bracelu", "braceru",
|
ignore_list = ["not", "braceld", "bracerd", "bracelu", "braceru",
|
||||||
"lmoustache", "rmoustache", "lgroup", "rgroup", "bracevert"]
|
"lmoustache", "rmoustache", "lgroup", "rgroup", "bracevert"]
|
||||||
|
|
||||||
def process(file):
|
def process(file):
|
||||||
fh = open(file)
|
fh = open(file)
|
||||||
@ -28,23 +28,23 @@ def process(file):
|
|||||||
|
|
||||||
n = len(lines)
|
n = len(lines)
|
||||||
for i in xrange(n):
|
for i in xrange(n):
|
||||||
line = lines[i]
|
line = lines[i]
|
||||||
mo = re.match(r'\s*%.*', line)
|
mo = re.match(r'\s*%.*', line)
|
||||||
if mo != None:
|
if mo != None:
|
||||||
continue
|
continue
|
||||||
next_line = ""
|
next_line = ""
|
||||||
if i+1 < n:
|
if i+1 < n:
|
||||||
next_line = lines[i+1]
|
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)
|
# to the current one, (if current line contains a comment, we remove it)
|
||||||
line = string.split(line,'%')[0]+next_line
|
line = string.split(line,'%')[0]+next_line
|
||||||
|
|
||||||
mo = re.match(r'.*\\DeclareSymbolFont\s*\{(.*?)\}\s*\{(.*?)\}\s*\{(.*?)\}.*', line)
|
mo = re.match(r'.*\\DeclareSymbolFont\s*\{(.*?)\}\s*\{(.*?)\}\s*\{(.*?)\}.*', line)
|
||||||
if mo != None:
|
if mo != None:
|
||||||
font_names[mo.group(1)] = mo.group(3)
|
font_names[mo.group(1)] = mo.group(3)
|
||||||
|
|
||||||
mo = re.match(r'.*\\DeclareMath(Symbol|Delimiter)\s*\{?\\(\w*?)\}?\s*\{?\\(.*?)\}?\s*\{(.*?)\}\s*\{([\'"]?)(.*?)\}.*', line)
|
mo = re.match(r'.*\\DeclareMath(Symbol|Delimiter)\s*\{?\\(\w*?)\}?\s*\{?\\(.*?)\}?\s*\{(.*?)\}\s*\{([\'"]?)(.*?)\}.*', line)
|
||||||
code = -1
|
code = -1
|
||||||
try:
|
try:
|
||||||
if mo != None:
|
if mo != None:
|
||||||
@ -67,34 +67,34 @@ def process(file):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
code = -1
|
code = -1
|
||||||
|
|
||||||
if mo != None and symbol not in ignore_list:
|
if mo != None and symbol not in ignore_list:
|
||||||
mo2 = re.match(r'\s*\\def\\(.*?)\{', next_line)
|
mo2 = re.match(r'\s*\\def\\(.*?)\{', next_line)
|
||||||
if mo2 != None and symbol == mo2.group(1)+"op":
|
if mo2 != None and symbol == mo2.group(1)+"op":
|
||||||
sys.stderr.write("%s -> %s\n" % (symbol, mo2.group(1)))
|
sys.stderr.write("%s -> %s\n" % (symbol, mo2.group(1)))
|
||||||
symbol = mo2.group(1)
|
symbol = mo2.group(1)
|
||||||
|
|
||||||
if font_names.has_key(font):
|
if font_names.has_key(font):
|
||||||
font = font_names[font]
|
font = font_names[font]
|
||||||
|
|
||||||
code = get_code(code, font)
|
code = get_code(code, font)
|
||||||
if code < 0:
|
if code < 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
xcode = 0
|
xcode = 0
|
||||||
if xsymbols.has_key(symbol):
|
if xsymbols.has_key(symbol):
|
||||||
xcode = xsymbols[symbol]
|
xcode = xsymbols[symbol]
|
||||||
del xsymbols[symbol]
|
del xsymbols[symbol]
|
||||||
|
|
||||||
if symbols.has_key(symbol):
|
if symbols.has_key(symbol):
|
||||||
sys.stderr.write(symbol+ " exists\n")
|
sys.stderr.write(symbol+ " exists\n")
|
||||||
if code != symbols[symbol]:
|
if code != symbols[symbol]:
|
||||||
sys.stderr.write("code is not equal!!!\n")
|
sys.stderr.write("code is not equal!!!\n")
|
||||||
else:
|
else:
|
||||||
symbols[symbol] = code
|
symbols[symbol] = code
|
||||||
if package == '':
|
if package == '':
|
||||||
print "%-18s %-4s %3d %3d %-6s" % (symbol,font,code,xcode,type)
|
print "%-18s %-4s %3d %3d %-6s" % (symbol,font,code,xcode,type)
|
||||||
else:
|
else:
|
||||||
print "%-18s %-4s %3d %3d %-9s x %s" % (symbol,font,code,xcode,type,package)
|
print "%-18s %-4s %3d %3d %-9s x %s" % (symbol,font,code,xcode,type,package)
|
||||||
|
|
||||||
|
|
||||||
path = os.path.split(sys.argv[0])[0]
|
path = os.path.split(sys.argv[0])[0]
|
||||||
@ -125,7 +125,7 @@ if xsymbols.has_key("leq"):
|
|||||||
for x in exceptions:
|
for x in exceptions:
|
||||||
print "%-18s %-4s %3d %3d %-6s" % x
|
print "%-18s %-4s %3d %3d %-6s" % x
|
||||||
if xsymbols.has_key(x[0]):
|
if xsymbols.has_key(x[0]):
|
||||||
del xsymbols[x[0]]
|
del xsymbols[x[0]]
|
||||||
|
|
||||||
print """
|
print """
|
||||||
lyxbar cmsy 161 0 mathord
|
lyxbar cmsy 161 0 mathord
|
||||||
|
Loading…
Reference in New Issue
Block a user