#! /usr/bin/env python # ----------------------------------------------------------------------------- # # Name : genhtml_onestop.py # # Purpose : # # Usage : # # Options : # # Arguements : # # Created : 26-OCT-2005 hobbs # Modified : 17-APR-2007 rickv # # ----------------------------------------------------------------------------- import glob import os def genhtml_onestop(): # Get the file information files = glob.glob("thumbnails/*.jpeg") files.sort() base = [] types = [] for name in files: basename = os.path.basename(name) base.append(os.path.splitext(basename)[0]) types.append(0) if os.path.exists(base[-1]+".eps"): types[-1] |= 1 if os.path.exists(base[-1]+".ps"): types[-1] |= 2 if os.path.exists(base[-1]+".gif"): types[-1] |= 4 if os.path.exists(base[-1]+".jpeg"): types[-1] |= 8 if os.path.exists(base[-1]+".png"): types[-1] |= 16 if os.path.exists(base[-1]+"_col.eps"): types[-1] |=32 if os.path.exists(base[-1]+"_col.jpeg"): types[-1] |=64 if os.path.exists(base[-1]+".caption"): types[-1] |= 128 print name," --> ",basename," --> ",base[-1]," has ",types[-1] # Get the pdf conference note name assuming the standard structure. cwd = os.getcwd() fbase = os.path.basename(cwd) note = fbase+".pdf" # Get the information from driver text file driver = fbase+".txt" f=open(driver,'r') print f title=f.readline() print title lumi=f.readline() print lumi fnalp=f.readline() print fnalp prepr=f.readline() print prepr jstat=f.readline() print jstat pub=jstat.count('Published') if pub > 0: vol=f.readline() pag=f.readline() year=f.readline() print "Volume ",vol," page ",pag, " year ",year # See if there's a plain english summary in the standard convention pes = "" if os.path.exists(fbase+".html"): pes = fbase+".html" elif os.path.exists(fbase+".htm"): pes = fbase+".htm" # Write some simple HTML, including the pdf for the note html = open("index.html","w") html.write("\n\n\n") html.write("

%s

\n"%title) html.write("

Luminosity: %s

\n"%lumi) html.write("

Paper

\n"%note) html.write("

%s

\n"%fnalp) if len(pes) > 0: html.write("

Plain English Summary

\n"%pes) # Check whether new or old format for hep-ex preprints index=prepr.count('.') if index > 0: html.write("

arXiv:/%s [hep-ex]

\n"%(prepr,prepr)) else: html.write("

arXiv:hep-ex/%s

\n"%(prepr,prepr)) if pub > 0: if jstat.count('PRL') > 0: html.write("

Published in Phys. Rev. Lett. %s, %s (%s)

\n"%(vol,pag,vol,pag,year)) if jstat.count('PRD') > 0: html.write("

Published in Phys. Rev. D %s, %s (%s)

\n"%(vol,pag,vol,pag,year)) if jstat.count('PLB') > 0: plb = fbase+"_PLB.pdf" html.write("

Published in Phys. Lett. B %s, %s (%s)

\n"%(plb,vol,pag,year)) else: html.write("

%s

\n"%jstat) html.write("\n") html.write(" \n") for i in range(0,len(files)): if ~((types[i] & 32) | (types[i] & 64)) : if i%4 == 0: html.write(" \n") html.write(" \n") if (i+1)%4 == 0: html.write(" \n") html.write("

Figures


"%base[i]) if types[i] & 1: html.write("(eps) "%base[i]) if types[i] & 32: html.write("(color eps)
"%base[i]) if types[i] & 2: html.write("(ps) "%base[i]) if types[i] & 4: html.write("(gif) "%base[i]) if types[i] & 8: html.write("(jpeg) "%base[i]) if types[i] & 64: html.write("(color jpeg) "%base[i]) if types[i] & 16: html.write("(png) "%base[i]) if types[i] & 128: html.write("(caption) "%base[i]) html.write("
\n") html.write("\n\n") html.close() os.chmod("index.html",0664) if __name__ == "__main__": genhtml_onestop()