forked from jlopezvi/Flowgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakehtml.py
More file actions
executable file
·51 lines (37 loc) · 1.38 KB
/
makehtml.py
File metadata and controls
executable file
·51 lines (37 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
import sys
import os
import glob
import csv
#### main program
infile_str=os.path.splitext(os.path.basename(sys.argv[1]))[0]
print (infile_str)
htmloffline_str=''
htmloffline_str+="""<html><head><title>docs</title></head>"""+'\n'+"""<body><hr>"""
reader = csv.reader(open('flowdoc/aux_files/'+infile_str+'.flowdb', "rt", encoding="utf8"), delimiter='\t')
for row in reader:
usr_key=''.join(e for e in row[0] if e.isalnum())
for i in range(int(row[1])+1):
print(range(1))
zoomID=''
zoom_str=''
if i==1:
zoomID='1'
zoom_str=' -- zoom 1'
htmloffline_str+="<p>"+row[2]+zoom_str+"</p>"+"""<a name="#"""+usr_key+zoomID+""""></a>"""
if os.path.exists('flowdoc/aux_files/'+usr_key+zoomID+'.cmapx'):
htmloffline_str+= """<img src="aux_files/"""+usr_key+zoomID+""".png" """
map_str=open('flowdoc/aux_files/'+usr_key+zoomID+'.cmapx').read()
htmloffline_str+=""" USEMAP="#"""+usr_key+zoomID+'_map'
htmloffline_str+=""""/> """
htmloffline_str+=map_str+"""<hr>
"""
else:
htmloffline_str+= """<img src="aux_files/"""+usr_key+zoomID+'.png'
htmloffline_str+=""" ">
<hr>"""
htmloffline_str+="<hr><hr>"
htmloffline_str+="""</body></html>"""
writefunc = open('flowdoc/'+infile_str+'.html',"w")
writefunc.write(htmloffline_str)
writefunc.close()