-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_site.py
executable file
·30 lines (30 loc) · 1.3 KB
/
build_site.py
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
#!/usr/bin/python
pages = ['home','about-me','contact', 'contact/thanks', 'donate','portfolio', 'resume'];
titles = ['Home','About Me','Contact Me', 'Thanks for the Message', 'Donation Page','Portfolio', 'Résumé'];
for page, title in zip(pages,titles):
path = "./pages/full/"+page+"/index.html"
f = open(path, 'w')
print("Building " + page + " (title: \"" + title + "\") ...")
f.write("<!DOCTYPE HTML>\n<head>\n")
f.write("\t<title>Dylan Taylor's Personal Homepage - " + title + "</title>\n")
with open('interface/head.html','r') as i: head = i.readlines()
for line in head:
f.write('\t' + line)
f.write("</head>\n")
f.write("<body>\n")
#with open('interface/header.html','r') as i: header = i.read()
#f.write("\t<div class=\"header\">\n\t\t" + header + "\t</div>\n")
with open('interface/navigation.html','r') as i: navigation = i.readlines()
f.write("\t<div class=\"left\">\n")
for line in navigation:
f.write('\t\t' + line)
f.write("\t</div>\n")
fname = "./pages/full/"+page+"/content.html"
with open(fname,'r') as i: content = i.readlines()
f.write("\t<div class=\"pagecontent\" id=\"pagecontent\">\n")
for line in content:
f.write('\t\t' + line)
f.write("\t</div>\n")
with open('./interface/end.html','r') as i: ending = i.readlines()
for line in ending:
f.write(line)