Skip to content
Snippets Groups Projects
systems.py 1.94 KiB
Newer Older
import re
import urllib 

pads = [
mb's avatar
mb committed
'http://10.10.161.238/ether/p/polyhistor/export/txt',
'http://10.10.161.238/ether/p/etymologiae/export/txt',
'http://10.10.161.238/ether/p/cyclopaedia/export/txt',
'http://10.10.161.238/ether/p/encyclopedia/export/txt',
'http://10.10.161.238/ether/p/greatinventions/export/txt',
'http://10.10.161.238/ether/p/taric/export/txt',
'http://10.10.161.238/ether/p/amazon/export/txt'
]

# pads = [
# '../classification-systems/encyclopedia.txt',
# '../classification-systems/cyclopaedia.txt',
# '../classification-systems/greatinventions.txt',
# '../classification-systems/polyhistor.txt',
# '../classification-systems/etymologiae.txt',
mb's avatar
mb committed
# '../classification-systems/taric.txt'
mb's avatar
mb committed
# '../classification-systems/amazon.txt'
mb's avatar
mb committed
# ]
mb's avatar
mb committed
fileout = open("../../stories/system-"+padname+".html","w+")
# fileout = open("../html2print/stories/systems.html","w+")
mb's avatar
mb committed

tmp = []

fileout.write('<div id="wrapper">')

	lines = urllib.urlopen(pad).readlines()
mb's avatar
mb committed
	padname = pad.replace('../classification-systems/','')
	padname = padname.replace('.txt','')
	padname = padname.replace('http://10.10.161.238/ether/p/','')
	padname = padname.replace('/export/txt','')

mb's avatar
mb committed
	tmp.append('<div class="column">')
	tmp.append('<div class="title">'+padname+'</div>')

	for line in lines: 
		line = re.sub(r"\s{8}", "\t", line)
		m = re.search(r"^\t*", line) 
mb's avatar
mb committed
		if m:
			tab = len(m.group(0)) + 1
			strtab = str(tab)
		line = line.replace("\t","")
mb's avatar
mb committed
		if '$!' in line:
			line = line.replace('$!','<span class="annotation">')
			line = line+'</span>'
mb's avatar
mb committed
		# fontsize = 55/tab # commented out to style the fontsize in css
		# fontsize = str(fontsize) # commented out to style the fontsize in css
		# fontsize = str(12); # uncomment to set fixed fontsize 
mb's avatar
mb committed
		tmp.append('<div class="h'+strtab+'">'+line+'</div>\n')
mb's avatar
mb committed
	tmp.append("""
		</div>
		""")
mb's avatar
mb committed
	print '*output of system-'+padname+'.html is written*'
mb's avatar
mb committed
tmp = ' '.join(tmp)
fileout.write(tmp)
mb's avatar
mb committed
fileout.write('</div>')
mb's avatar
mb committed
fileout.close()