-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathHTML.py.html
More file actions
206 lines (188 loc) · 15.7 KB
/
HTML.py.html
File metadata and controls
206 lines (188 loc) · 15.7 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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module HTML</title>
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>HTML</strong></big></big> (version 0.04, 2009-07-28)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="html.py">html.py</a></font></td></tr></table>
<p><tt>HTML.py - v0.04 2009-07-28 Philippe Lagadec<br>
<br>
This module provides a few classes to easily generate HTML code such as tables<br>
and lists.<br>
<br>
Project website: <a href="http://www.decalage.info/python/html">http://www.decalage.info/python/html</a><br>
<br>
License: CeCILL (open-source GPL compatible), see source code for details.<br>
<a href="http://www.cecill.info">http://www.cecill.info</a></tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="HTML.html#List">List</a>
</font></dt><dt><font face="helvetica, arial"><a href="HTML.html#Table">Table</a>
</font></dt><dt><font face="helvetica, arial"><a href="HTML.html#TableCell">TableCell</a>
</font></dt><dt><font face="helvetica, arial"><a href="HTML.html#TableRow">TableRow</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="List">class <strong>List</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>a <a href="#List">List</a> <a href="__builtin__.html#object">object</a> is used to create an ordered or unordered list in HTML.<br>
(UL/OL tag)<br>
<br>
Attributes:<br>
- lines: list, tuple or any iterable, containing one string for each line<br>
- ordered: bool, choice between an ordered (OL) or unordered list (UL)<br>
- attribs: dict, additional attributes for the OL/UL tag<br>
<br>
Reference: <a href="http://www.w3.org/TR/html4/struct/lists.html">http://www.w3.org/TR/html4/struct/lists.html</a><br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="List-__init__"><strong>__init__</strong></a>(self, lines<font color="#909090">=None</font>, ordered<font color="#909090">=False</font>, start<font color="#909090">=None</font>, attribs<font color="#909090">=None</font>)</dt><dd><tt><a href="#List">List</a> constructor</tt></dd></dl>
<dl><dt><a name="List-__str__"><strong>__str__</strong></a>(self)</dt><dd><tt>return the HTML code for the list as a string</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Table">class <strong>Table</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>a <a href="#Table">Table</a> <a href="__builtin__.html#object">object</a> is used to create a HTML table. (TABLE tag)<br>
<br>
Attributes:<br>
- rows: list, tuple or any iterable, containing one iterable or <a href="#TableRow">TableRow</a><br>
<a href="__builtin__.html#object">object</a> for each row<br>
- header_row: list, tuple or any iterable, containing the header row (optional)<br>
- border: str or int, border width<br>
- style: str, table style in CSS syntax (thin black borders by default)<br>
- width: str, width of the table on the page<br>
- attribs: dict, additional attributes for the TABLE tag<br>
- col_width: list or tuple defining width for each column<br>
- col_align: list or tuple defining horizontal alignment for each column<br>
- col_char: list or tuple defining alignment character for each column<br>
- col_charoff: list or tuple defining charoff attribute for each column<br>
- col_valign: list or tuple defining vertical alignment for each column<br>
- col_styles: list or tuple of HTML styles for each column<br>
<br>
Reference: <a href="http://www.w3.org/TR/html4/struct/tables.html#h-11.2.1">http://www.w3.org/TR/html4/struct/tables.html#h-11.2.1</a><br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Table-__init__"><strong>__init__</strong></a>(self, rows<font color="#909090">=None</font>, border<font color="#909090">='1'</font>, style<font color="#909090">=None</font>, width<font color="#909090">=None</font>, cellspacing<font color="#909090">=None</font>, cellpadding<font color="#909090">=4</font>, attribs<font color="#909090">=None</font>, header_row<font color="#909090">=None</font>, col_width<font color="#909090">=None</font>, col_align<font color="#909090">=None</font>, col_valign<font color="#909090">=None</font>, col_char<font color="#909090">=None</font>, col_charoff<font color="#909090">=None</font>, col_styles<font color="#909090">=None</font>)</dt><dd><tt><a href="#TableCell">TableCell</a> constructor</tt></dd></dl>
<dl><dt><a name="Table-__str__"><strong>__str__</strong></a>(self)</dt><dd><tt>return the HTML code for the table as a string</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="TableCell">class <strong>TableCell</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>a <a href="#TableCell">TableCell</a> <a href="__builtin__.html#object">object</a> is used to create a cell in a HTML table. (TD or TH)<br>
<br>
Attributes:<br>
- text: text in the cell (may contain HTML tags). May be any <a href="__builtin__.html#object">object</a> which<br>
can be converted to a string using str().<br>
- header: bool, false for a normal data cell (TD), true for a header cell (TH)<br>
- bgcolor: str, background color<br>
- width: str, width<br>
- align: str, horizontal alignement (left, center, right, justify or char)<br>
- char: str, alignment character, decimal point if not specified<br>
- charoff: str, see HTML specs<br>
- valign: str, vertical alignment (top|middle|bottom|baseline)<br>
- style: str, CSS style<br>
- attribs: dict, additional attributes for the TD/TH tag<br>
<br>
Reference: <a href="http://www.w3.org/TR/html4/struct/tables.html#h-11.2.6">http://www.w3.org/TR/html4/struct/tables.html#h-11.2.6</a><br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="TableCell-__init__"><strong>__init__</strong></a>(self, text<font color="#909090">=''</font>, bgcolor<font color="#909090">=None</font>, header<font color="#909090">=False</font>, width<font color="#909090">=None</font>, align<font color="#909090">=None</font>, char<font color="#909090">=None</font>, charoff<font color="#909090">=None</font>, valign<font color="#909090">=None</font>, style<font color="#909090">=None</font>, attribs<font color="#909090">=None</font>)</dt><dd><tt><a href="#TableCell">TableCell</a> constructor</tt></dd></dl>
<dl><dt><a name="TableCell-__str__"><strong>__str__</strong></a>(self)</dt><dd><tt>return the HTML code for the table cell as a string</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="TableRow">class <strong>TableRow</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>a <a href="#TableRow">TableRow</a> <a href="__builtin__.html#object">object</a> is used to create a row in a HTML table. (TR tag)<br>
<br>
Attributes:<br>
- cells: list, tuple or any iterable, containing one string or <a href="#TableCell">TableCell</a><br>
<a href="__builtin__.html#object">object</a> for each cell<br>
- header: bool, true for a header row (TH), false for a normal data row (TD)<br>
- bgcolor: str, background color<br>
- col_align, col_valign, col_char, col_charoff, col_styles: see <a href="#Table">Table</a> class<br>
- attribs: dict, additional attributes for the TR tag<br>
<br>
Reference: <a href="http://www.w3.org/TR/html4/struct/tables.html#h-11.2.5">http://www.w3.org/TR/html4/struct/tables.html#h-11.2.5</a><br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="TableRow-__init__"><strong>__init__</strong></a>(self, cells<font color="#909090">=None</font>, bgcolor<font color="#909090">=None</font>, header<font color="#909090">=False</font>, attribs<font color="#909090">=None</font>, col_align<font color="#909090">=None</font>, col_valign<font color="#909090">=None</font>, col_char<font color="#909090">=None</font>, col_charoff<font color="#909090">=None</font>, col_styles<font color="#909090">=None</font>)</dt><dd><tt><a href="#TableCell">TableCell</a> constructor</tt></dd></dl>
<dl><dt><a name="TableRow-__str__"><strong>__str__</strong></a>(self)</dt><dd><tt>return the HTML code for the table row as a string</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-Link"><strong>Link</strong></a>(text, url)</dt><dd><tt># much simpler definition of a link as a function:</tt></dd></dl>
<dl><dt><a name="-link"><strong>link</strong></a>(text, url)</dt></dl>
<dl><dt><a name="-list"><strong>list</strong></a>(*args, **kwargs)</dt><dd><tt>return HTML code for a list as a string. See <a href="#List">List</a> class for parameters.</tt></dd></dl>
<dl><dt><a name="-table"><strong>table</strong></a>(*args, **kwargs)</dt><dd><tt>return HTML code for a table as a string. See <a href="#Table">Table</a> class for parameters.</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>TABLE_STYLE_THINBORDER</strong> = 'border: 1px solid #000000; border-collapse: collapse;'<br>
<strong>__author__</strong> = 'Philippe Lagadec'<br>
<strong>__date__</strong> = '2009-07-28'<br>
<strong>__version__</strong> = '0.04'</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
<tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td>
<td width="100%">Philippe Lagadec</td></tr></table>
</body></html>