-
Notifications
You must be signed in to change notification settings - Fork 4
/
htmltagutils.py
executable file
·100 lines (72 loc) · 2.55 KB
/
htmltagutils.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
#!/opt/local/bin/python
#
# $Author: frederic $
# $Date: 2011/03/22 20:03:38 $
# $Id: htmltagutils.py,v 1.5 2011/03/22 20:03:38 frederic Exp $
#
#
# HTML formatting
#
def breaktag(thestring):
return("\n<br />"+thestring)
def paratag(thestring):
return("<p>"+thestring+"</p>\n")
def centertag(thestring):
return("<center>"+thestring+"</center>\n")
def imagetag(imagename, imagewidth):
return("<p><a href=\""+imagename+"\"><IMG BORDER=0 SRC="+imagename+" width=\""+str(imagewidth)+"\"></a></p>\n")
def tablepropsstarttag(tablewidth,align):
tablestring = "<table rules=\"none\" style=\"margin-center: 20px; text-align: "+align+"\"border=\"0\" width=\""+str(tablewidth)+"\" cellpadding=\"2\">\n"
return(tablestring)
def tablepropsendtag():
tablestring = "</table>\n"
return(tablestring)
def tablepropstag(thestring,tablewidth,align):
tablestring = tablepropsstarttag(tablewidth,align)+thestring+tablepropsendtag()
return(tablestring)
def tablerowstarttag():
return("<tr>")
def tablerowendtag():
return("</tr>\n")
def tablerowtag(thestring):
return(tablerowstarttag()+thestring+tablerowendtag())
def bigtableentrytag(thestring):
return("<td \"style=font-size:20px\">"+thestring+"</td>")
def tableentrytag(thestring):
return("<td>"+thestring+"</td>")
def valignopt(thealign):
return("valign=\""+thealign+"\" ")
def widthopt(thewidth):
return("width=\""+str(thewidth)+"%\" ")
def tableentryopttag(thestring,theopts):
return("<td "+theopts+">"+thestring+"</td>")
def tableentrywidthtag(thestring,thewidth):
return("<td width=\"+str(thewidth)%\"+>"+thestring+"</td>")
def hruletag():
return("<hr>")
def headertag(thestring):
return("<h3>"+thestring+"</h3>")
def bigheadertag(thestring):
return("<h2>"+thestring+"</h3>")
def smallheadertag(thestring):
return("<h4>"+thestring+"</h4>")
def bigtag(thestring):
return("<big>"+thestring+"</big>")
def smalltag(thestring):
return("<small>"+thestring+"</small>")
def boldtag(thestring):
return("<b>"+thestring+"</b>")
def whitetag(thestring):
return("<FONT COLOR=\"ffffff\">"+thestring+"</FONT>")
def greentag(thestring):
return("<FONT COLOR=\"00ff00\">"+thestring+"</FONT>")
def redtag(thestring):
return("<FONT COLOR=\"ff0000\">"+thestring+"</FONT>")
def yellowtag(thestring):
return("<FONT COLOR=\"ffff00\">"+thestring+"</FONT>")
def qualitytag(thestring,thequality):
if(thequality == 0):
return(greentag(thestring))
if(thequality == 1):
return(yellowtag(thestring))
return(redtag(thestring))