#!/usr/bin/env python # -*- coding: ISO-8859-1 -*- #inspired from http://qwiki.stanford.edu/images/d/df/Latex2qwiki.txt import sys, re, os ISSM_DIR=os.getenv('ISSM_DIR'); if(not ISSM_DIR): raise NameError('ISSM_DIR undefined') infile = open('temp','r') outfile = open('temp.html','w') file_text = infile.readlines() #write header outfile.write('
'+i+' | '; column+=1 else: mystr += ''+i+' | ' mystr += 'Total | \n\n' elif(count==2): total = 0 column = 1 if(toggle): mystr = '|
---|---|---|---|
' else: mystr = ' | |||
' for i in line.split(): if(not i.isdigit()): mystr += ' '+i+' ' else: if(column==1): mystr += ' | ' if(column>=2): total += int(i) if(toggle): mystr += ''+i+' | ' else: mystr += ''+i+' | ' column += 1 if(toggle): mystr += ''+str(total)+' | \n'+str(total)+' | \n\n' toggle = 1 - toggle elif(count==3): total = 0 column = 1 if(toggle): mystr = '
' else: mystr = ' | |||
' for i in line.split(): if(not i.isdigit()): mystr += ' '+i+' ' else: if(column==1): mystr += ' | ' if(column>=2): total += int(i) if(toggle): mystr += ''+i+' | ' else: mystr += ''+i+' | ' column += 1 if(toggle): mystr += ''+str(total)+' | \n'+str(total)+' | \n\n' else: continue outfile.write(mystr) #write header outfile.write('