[tev4lhc] / tev4lhc / authors.py Repository:
ViewVC logotype

View of /tev4lhc/authors.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (download) (as text) (annotate)
Fri Sep 29 21:50:16 2006 UTC (3 years, 1 month ago) by workshop
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +1 -1 lines
updates
import os,sys

def myrule(a,b):
    ap=a.split()
    bp=b.split()
    return cmp(ap[1].lower(),bp[1].lower())


if len(sys.argv)<3:
    print "Need to specify"
    print "<input file> <output file>"
    sys.exit()

if len(sys.argv)<4:
    print "You did not specify a working group"
    print "<input file> <output file> quote(working group)"

f=open(sys.argv[1],'r')
g=open(sys.argv[2],'w')

x=f.readlines()
f.close()
g.write('\\author{\n')
if len(sys.argv)>3:
   g.write(sys.argv[3]+'\n')

x.sort(myrule)

ilenx = len(x)-1

institutedict={}
i=0
for line in x:
    lp=line.split()
    i3=line.index(lp[2])
    author=lp[0]+" "+lp[1]
    institution=line[i3:].strip()
    isplit=[]
    if institution.find('+')>-1:
        isplit=institution.split('+')
    else:
        isplit.append(institution)


    ilist=[]
    for icheck in isplit:
        ichecka=icheck.strip()
        jint=institutedict.get(ichecka)
        if jint:
            institute=jint
        else:
            i=i+1
            institutedict[ichecka]=i
        ilist.append(institutedict[ichecka])


    if x.index(line)==ilenx:
        comma=""
    else:
        comma=","

    if len(ilist)==1:
        g.write('\mbox{'+author+comma+"$^{"+str(ilist[0])+"}$}\n")
    else:
        g.write('\mbox{'+author+comma+"$^{"+str(ilist[0])+","+str(ilist[1])+"}$}\n")        

g.write('}\n')
g.write('\institute{\n')

u=institutedict.keys()
t=institutedict.values()


i=1
while i<len(t)+1:

    if i==len(t):
        comma=""
    else:
        comma=","
    
    for j in range(0,len(t)):
        if t[j]==i:
            g.write('\mbox{$^{'+str(i)+'}$ '+u[j].strip()+'}'+comma+'\n')
            break
    i=i+1


g.write('}\n')
g.close()





No admin address has been configured

Powered by ViewVC 1.0-dev

ViewVC Help