@@ -6,8 +6,6 @@ Goal: a set of classes to render html pages.
66
77sample_html.html
88
9-
10-
119Step 1:
1210
1311 Create an "Element" class for rendering an html element (xml element).
@@ -24,7 +22,7 @@ Step 1:
2422 It should have a render(file_out, ind = "") method that renders the tag
2523 and the strings in the content.
2624
27- file_out could be an file-like object (i.e have a write() method ).
25+ file_out could be any file-like object (i.e have a write() method ).
2826
2927 "ind" is a string with the indentation level in it -- i.e the amount that
3028 the tag should be indented (for pretty printing). (maybe 4 spaces per level).
@@ -37,7 +35,7 @@ you should now be able to render an html tag with text in it as contents.
3735
3836Step 2:
3937 Create a couple subclasses of Element, for a <body> tag and <p> tag. All you
40- should have to do is override the "tag" attribute.
38+ should have to do is override the "tag" class attribute.
4139
4240 Now you can render a few different types of element.
4341
@@ -57,7 +55,7 @@ Step 3:
5755 Create a <head> element -- simple subclass.
5856
5957 Create a OneLineTag subclass of Element:
60- It should override the render method, to render eveything on one line --
58+ It should override the render method, to render everything on one line --
6159 for the simple tags, like:
6260
6361 <title> PythonClass - Class 6 example </title>
@@ -73,11 +71,13 @@ Step 4:
7371
7472 Element("some text content", id="TheList", style="line-height:200%")
7573
74+ ( remember **kwargs ? )
75+
7676 The render method will need to be extended to render the attributes properly.
7777
7878 You can now render some <p> tags (and others) with attributes
7979
80- Step 4 :
80+ Step 5 :
8181 Create a "SelfClosingTag" subclass of Element, to render tags like:
8282
8383 <meta charset="UTF-8" />
@@ -90,7 +90,7 @@ Step 4:
9090
9191 You can now render an html page with a proper <head> (<meta /> and <title> elements)
9292
93- Step 5 :
93+ Step 6 :
9494 Create a A class for an anchor (link) element. Its constructor shoudl look like:
9595 A(self, link, content) -- where link is the link, and cointent is what you see. It can be called like so:
9696
@@ -100,7 +100,7 @@ Step 5:
100100
101101 You can now add a link to your web page.
102102
103- Step 6 :
103+ Step 7 :
104104 Create Ul class for an unordered list (really simple subclass of Element)
105105
106106 Create Li class for an element in a list (also really simple)
@@ -115,7 +115,7 @@ Step 6:
115115 It can subclass from OneLineTag -- overriding the __init__, then calling
116116 the superclass __init__
117117
118- Step 6 :
118+ Step 8 :
119119 Update the Html element class to render the "<!DOCTYPE html>" tag at the
120120 head of the page, before the html element.
121121
0 commit comments