-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
128 lines (77 loc) · 2.74 KB
/
build.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
print('this is the build')
def main():
top = ('templates/top.html')
bottom = ('templates/bottom.html')
blog = ('content/blog.html')
testimonials = ('content/testimonials.html')
index = ('content/index.html')
#combine top.html with bottom.htm ito base.html with {{content}}
# top_template = open(top).read()
# bottom_template = open(bottom).read()
# base_template = top_template + "{{content}}" + bottom_template
#base_template = open('templates/base.html').read()
# open('templates/base.html', 'w+').write(base_template)
if __name__ == "__main__":
main()
#template = open('templates/base.html').read()
def listdic():
pages = [ {
"filename": "content/index.html",
"output": "docs/index.html",
"title": "Allsprout",
},
{
"filename": "content/testimonials.html",
"output": "docs/testimonials.html",
"title": "Testimonials",
},
{
"filename": "content/blog.html",
"output": "docs/blog.html",
"title": "Allsprout Blog",
}
]
for page in pages:
template = open('templates/base.html').read()
filename = open(page['filename']).read()
combined_file = template.replace("{{content}}",filename)
open(page['output'],'w+').write(combined_file)
# title1 = open(page['title']).read()
# title = template.replace("{{title}}",title1)
# open(page['output'],'w+').write(filename)
listdic()
def apply_template():
#TODO: Read in template, do string replacing, and return the result
# #create and combine index html
# template = open("templates/base.html").read()
# index_content = open("content/index.html").read()
# finished_index_page = template.replace("{{content}}", index_content)
# open("docs/index.html", 'w+').write(finished_index_page)
#create and combine index html
template = open("templates/base.html").read()
index_content = open("content/index.html").read()
finished_index_page = template.replace("{{content}}", index_content)
open("docs/index.html", 'w+').write(finished_index_page)
return
apply_template()
#---------------------------------
#testimonial
# content = open('content/testimonials.html').read()
# testimonials = top_template + content + bottom_template
# open('docs/testimonials.html', 'w+').write(testimonials)
#blog
# content = open('content/blog.html').read()
# testimonials = top_template + content + bottom
# #blog
# page = open('content/blog.html').read()
# blog = top_template + page + bottom_template
# open('docs/blog.html', 'w+').write(blog)
# #blog
# page = open('content/blog.html').read()
# blog = top_template + page + bottom_template
# open('docs/blog.html', 'w+').write(blog)
# #blog
# #testimonial
# page = open('content/blog.html').read()
# blog = top_template + page + bottom_template
# open('docs/blog.html', 'w+').write(blog)