forked from starsmall123/STAR-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstar.py
More file actions
48 lines (43 loc) · 1.21 KB
/
Copy pathstar.py
File metadata and controls
48 lines (43 loc) · 1.21 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
class AHtml:
def __init__(self):
self.HTML = '''<!DOCTYPE html>
<html lang="zh">
'''
self.body = ''' <body>
'''
def init_head(self,title,cssflies=None):
self.HTML += '''<head>
<meta charset="UTF-8">
<title>%s</title>
</head>
'''%title
def body_over(self):
self.body += ''' </body>'''
def render(self,name):
with open(name,'w') as f:
f.write(self.HTML+self.body+'''
</html>''')
def make_a_h1_text(self,text):
self.body += ''' <h1>%s</h1>
'''%text
def make_a_h2_text(self,text):
self.body += ''' <h2>%s</h2>
'''%text
def make_a_h3_text(self,text):
self.body += ''' <h3>%s</h3>
'''%text
def make_a_h4_text(self,text):
self.body += ''' <h4>%s</h4>
'''%text
def make_a_h5_text(self,text):
self.body += ''' <h5>%s</h5>
'''%text
def make_a_h6_text(self,text):
self.body += ''' <h6>%s</h6>
'''%text
def make_a_normal_text(self,text):
self.body += ''' <p>%s</p>
'''%text
def make_a_img(self,img):
self.body +=''' <img src=%s>
'''%img