-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpages.py
109 lines (90 loc) · 2.58 KB
/
pages.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
from flask import Flask, Blueprint, request, jsonify, render_template, url_for, redirect
import examples1
import examples2
import examples3
import examples4
import examples5
import examples6
import examples7
pages = Blueprint('pages', 'pages')
capturing = False # set to True to create pages for the static website
@pages.route('/')
def home():
html = render_template('home')
if capturing:
capture('index', html.replace('">•', '.html">•'))
return html
@pages.route('/examples1' )
def exset1():
svgset = examples1.run_all()
html = render_template('examples1', svgset=svgset)
if capturing:
capture('examples1', html.replace('examples1_static', 'examples1_static.html'))
return html
@pages.route('/examples1_static' )
def exset1_static():
html = render_template('examples1_static')
if capturing:
capture('examples1_static', html)
return html
@pages.route('/examples2' )
def exset2():
svgset = examples2.run_all()
html = render_template('examples2', svgset=svgset)
if capturing:
capture('examples2', html)
return html
@pages.route('/examples3' )
def exset3():
svgset = examples3.run_all()
html = render_template('examples3', svgset=svgset)
if capturing:
capture('examples3', html)
return html
@pages.route('/examples4' )
def exset4():
svgset = examples4.run_all()
html = render_template('examples4', svgset=svgset)
if capturing:
capture('examples4', html.replace('examples6', 'examples6.html'))
return html
@pages.route('/examples5' )
def exset5():
svgset = examples5.run_all()
html = render_template('examples5', svgset=svgset)
if capturing:
capture('examples5', html)
return html
@pages.route('/examples6' )
def exset6():
svgset = examples6.run_all()
html = render_template('examples6', svgset=svgset)
if capturing:
capture('examples6', html)
return html
@pages.route('/examples7' )
def exset7():
svgset = examples7.run_all()
html = render_template('examples7', svgset=svgset)
if capturing:
capture('examples7', html)
return html
@pages.route('/examples8' )
def exset8():
html = render_template('examples8')
if capturing:
capture('examples8', html)
return html
@pages.route('/docs' )
def docs():
if capturing:
capture('docs', html)
return render_template('docs')
@pages.route('/docs_old' )
def docs_old():
return render_template('docs_old')
def capture(tfile, html):
fp = open(f'site/{tfile}.html', 'w')
print(html, file=fp)
fp.close()
return