From: Fred L. D. <fd...@us...> - 2002-03-27 03:59:51
|
Update of /cvsroot/ht2html/ht2html In directory usw-pr-cvs1:/tmp/cvs-serv23490 Modified Files: Banner.py PDOGenerator.py SelfGenerator.py Sidebar.py Skeleton.py Log Message: Use lower-case for tag and attribute names. Eventually, XHTML will be interesting. Index: Banner.py =================================================================== RCS file: /cvsroot/ht2html/ht2html/Banner.py,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -d -r2.2 -r2.3 *** Banner.py 26 Mar 2002 05:04:11 -0000 2.2 --- Banner.py 27 Mar 2002 03:59:48 -0000 2.3 *************** *** 40,52 **** def __start_table(self): print '<!-- start of site links table -->' ! print '<TABLE WIDTH="100%" BORDER="0"' print self.get_banner_attributes() ! print ' BGCOLOR="%s">' % ( self.get_bgcolor()) ! print '<TR>' def __end_table(self): ! print '</TR>' ! print '</TABLE><!-- end of site links table -->' def __do_table(self): --- 40,52 ---- def __start_table(self): print '<!-- start of site links table -->' ! print '<table width="100%" border="0"' print self.get_banner_attributes() ! print ' bgcolor="%s">' % ( self.get_bgcolor()) ! print '<tr>' def __end_table(self): ! print '</tr>' ! print '</table><!-- end of site links table -->' def __do_table(self): *************** *** 64,77 **** if col >= self.__cols: # break the row ! print '</TR><TR>' col = 0 ! print ' <TD BGCOLOR="%s">' % self.get_lightshade() print s ! print ' </TD>' col = col + 1 # fill rest of row with non-breaking spaces. while col and col < self.__cols: ! print ' <TD BGCOLOR="%s">' % self.get_lightshade() ! print ' </TD>' col = col + 1 --- 64,77 ---- if col >= self.__cols: # break the row ! print '</tr><tr>' col = 0 ! print ' <td bgcolor="%s">' % self.get_lightshade() print s ! print ' </td>' col = col + 1 # fill rest of row with non-breaking spaces. while col and col < self.__cols: ! print ' <td bgcolor="%s">' % self.get_lightshade() ! print ' </td>' col = col + 1 Index: PDOGenerator.py =================================================================== RCS file: /cvsroot/ht2html/ht2html/PDOGenerator.py,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -d -r2.3 -r2.4 *** PDOGenerator.py 27 Mar 2002 03:46:00 -0000 2.3 --- PDOGenerator.py 27 Mar 2002 03:59:48 -0000 2.4 *************** *** 78,82 **** def get_banner_attributes(self): ! return 'CELLSPACING="0" CELLPADDING="0"' def get_corner(self): --- 78,82 ---- def get_banner_attributes(self): ! return 'cellspacing="0" cellpadding="0"' def get_corner(self): Index: SelfGenerator.py =================================================================== RCS file: /cvsroot/ht2html/ht2html/SelfGenerator.py,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -d -r2.2 -r2.3 *** SelfGenerator.py 26 Mar 2002 04:25:36 -0000 2.2 --- SelfGenerator.py 27 Mar 2002 03:59:48 -0000 2.3 *************** *** 77,81 **** def get_banner_attributes(self): ! return 'CELLSPACING="0" CELLPADDING="0"' def get_corner(self): --- 77,81 ---- def get_banner_attributes(self): ! return 'cellspacing="0" cellpadding="0"' def get_corner(self): Index: Sidebar.py =================================================================== RCS file: /cvsroot/ht2html/ht2html/Sidebar.py,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -d -r2.3 -r2.4 *** Sidebar.py 26 Mar 2002 04:25:36 -0000 2.3 --- Sidebar.py 27 Mar 2002 03:59:48 -0000 2.4 *************** *** 41,59 **** def get_validated(self): ! return """<tr><td BGCOLOR="%s"> <center> <a href="http://validator.w3.org/check/referer"><img border="0" src="http://www.w3.org/Icons/valid-html401" ! alt="Valid HTML 4.01!" height="31" width="88"></a></center> </td></tr> ! """ % self.get_lightshade() def __start_table(self): print '<!-- start of sidebar table -->' ! print '<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="3"' ! print ' BGCOLOR="%s">' % self.get_bgcolor() def __finish(self): ! print '</TABLE><!-- end of sidebar table -->' def __do_link(self): --- 41,59 ---- def get_validated(self): ! return """<tr><td bgcolor="%s"> <center> <a href="http://validator.w3.org/check/referer"><img border="0" src="http://www.w3.org/Icons/valid-html401" ! alt="Valid HTML 4.01!" height="31" width="88"%s</a></center> </td></tr> ! """ % (self.get_lightshade(), self.empty_tag_end) def __start_table(self): print '<!-- start of sidebar table -->' ! print '<table width="100%" border="0" cellspacing="0" cellpadding="3"' ! print ' bgcolor="%s">' % self.get_bgcolor() def __finish(self): ! print '</table><!-- end of sidebar table -->' def __do_link(self): *************** *** 64,75 **** if done_one: # get some separation between header and last item ! print '<TR><TD BGCOLOR="%s"> ' % ( self.get_lightshade()) else: done_one = 1 ! print '<TR><TD BGCOLOR="%s"><B><FONT COLOR="%s">' % ( self.get_darkshade(), self.get_bgcolor()) print item ! print '</FONT></B></TD></TR>' else: if len(item) == 3: --- 64,75 ---- if done_one: # get some separation between header and last item ! print '<tr><td bgcolor="%s"> ' % ( self.get_lightshade()) else: done_one = 1 ! print '<tr><td bgcolor="%s"><b><font color="%s">' % ( self.get_darkshade(), self.get_bgcolor()) print item ! print '</font></b></td></tr>' else: if len(item) == 3: *************** *** 81,88 **** s = text else: ! s = '<A HREF="%s">%s</A>' % (url, text) ! print '<TR><TD BGCOLOR="%s">' % self.get_lightshade() print '%s%s' % (s, extra) ! print '</TD></TR>' --- 81,88 ---- s = text else: ! s = '<a href="%s">%s</a>' % (url, text) ! print '<tr><td bgcolor="%s">' % self.get_lightshade() print '%s%s' % (s, extra) ! print '</td></tr>' Index: Skeleton.py =================================================================== RCS file: /cvsroot/ht2html/ht2html/Skeleton.py,v retrieving revision 2.5 retrieving revision 2.6 diff -C2 -d -r2.5 -r2.6 *** Skeleton.py 26 Mar 2002 11:48:32 -0000 2.5 --- Skeleton.py 27 Mar 2002 03:59:48 -0000 2.6 *************** *** 126,134 **** # These are not supported in HTML, but are needed for # Netscape 4 ! return 'MARGINWIDTH="0" MARGINHEIGHT="0"' def get_banner_attributes(self): """Return extra attributes for the TABLE in the banner.""" ! return 'CELLSPACING="0" CELLPADDING="2"' def get_charset(self): --- 126,134 ---- # These are not supported in HTML, but are needed for # Netscape 4 ! return 'marginwidth="0" marginheight="0"' def get_banner_attributes(self): """Return extra attributes for the TABLE in the banner.""" ! return 'cellspacing="0" cellpadding="2"' def get_charset(self): *************** *** 171,187 **** self.__start_body() print '<!-- start of page table -->' ! print ('<TABLE WIDTH="100%" BORDER="0"' ! ' CELLSPACING="0" CELLPADDING="0">') if banner is not None: print '<!-- start of banner row -->' ! print '<TR>' if corner is not None: self.__do_corner(corner) print '<!-- start of banner -->' ! print '<TD WIDTH="%s%%" BGCOLOR="%s">' % ( self.get_banner_width(), self.get_lightshade()) print banner ! print '</TD><!-- end of banner -->' ! print '</TR><!-- end of banner row -->' # if there is a body but no sidebar, then we'll just close the # table right here and put the body (and any cont) in the full --- 171,187 ---- self.__start_body() print '<!-- start of page table -->' ! print ('<table width="100%" border="0"' ! ' cellspacing="0" cellpadding="0">') if banner is not None: print '<!-- start of banner row -->' ! print '<tr>' if corner is not None: self.__do_corner(corner) print '<!-- start of banner -->' ! print '<td width="%s%%" bgcolor="%s">' % ( self.get_banner_width(), self.get_lightshade()) print banner ! print '</td><!-- end of banner -->' ! print '</tr><!-- end of banner row -->' # if there is a body but no sidebar, then we'll just close the # table right here and put the body (and any cont) in the full *************** *** 191,198 **** # table twice if sidebar is None: ! print '</TABLE><!-- end of page table -->' closed = 1 else: ! print '<TR><!-- start of sidebar/body row -->' self.__do_sidebar(sidebar) if body is not None: --- 191,198 ---- # table twice if sidebar is None: ! print '</table><!-- end of page table -->' closed = 1 else: ! print '<tr><!-- start of sidebar/body row -->' self.__do_sidebar(sidebar) if body is not None: *************** *** 202,207 **** self.__do_body(body) if not closed: ! print '</TR><!-- end of sidebar/body row -->' ! print '</TABLE><!-- end of page table -->' if cont is not None: self.__do_cont(cont) --- 202,207 ---- self.__do_body(body) if not closed: ! print '</tr><!-- end of sidebar/body row -->' ! print '</table><!-- end of page table -->' if cont is not None: self.__do_cont(cont) *************** *** 213,217 **** def __do_corner(self, corner): print '<!-- start of corner cells -->' ! print '<TD WIDTH="150" VALIGN="MIDDLE" BGCOLOR="%s">' % ( self.get_corner_bgcolor()) # it is important not to have a newline between the corner text and --- 213,217 ---- def __do_corner(self, corner): print '<!-- start of corner cells -->' ! print '<td width="150" valign="middle" bgcolor="%s">' % ( self.get_corner_bgcolor()) # it is important not to have a newline between the corner text and *************** *** 221,226 **** else: print corner, ! print '</TD>' ! print '<TD WIDTH="15" BGCOLOR="%s"> </TD><!--spacer-->' % ( self.get_lightshade()) print '<!-- end of corner cells -->' --- 221,226 ---- else: print corner, ! print '</td>' ! print '<td width="15" bgcolor="%s"> </td><!--spacer-->' % ( self.get_lightshade()) print '<!-- end of corner cells -->' *************** *** 228,244 **** def __do_sidebar(self, sidebar): print '<!-- start of sidebar cells -->' ! print '<TD WIDTH="150" VALIGN="TOP" BGCOLOR="%s">' % ( self.get_lightshade()) print sidebar ! print '</TD>' ! print '<TD WIDTH="15"> </TD><!--spacer-->' print '<!-- end of sidebar cell -->' def __do_body(self, body): print '<!-- start of body cell -->' ! print '<TD VALIGN="TOP" WIDTH="%s%%"><BR>' % ( self.get_banner_width()) print body ! print '</TD><!-- end of body cell -->' def __do_cont(self, cont): --- 228,244 ---- def __do_sidebar(self, sidebar): print '<!-- start of sidebar cells -->' ! print '<td width="150" valign="top" bgcolor="%s">' % ( self.get_lightshade()) print sidebar ! print '</td>' ! print '<td width="15"> </td><!--spacer-->' print '<!-- end of sidebar cell -->' def __do_body(self, body): print '<!-- start of body cell -->' ! print '<td valign="top" width="%s%%"><br>' % ( self.get_banner_width()) print body ! print '</td><!-- end of body cell -->' def __do_cont(self, cont): *************** *** 250,255 **** """Return the HTML <head> stuff.""" print '''\ ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> ! <HTML> <!-- THIS PAGE IS AUTOMATICALLY GENERATED. DO NOT EDIT. --> <!-- %(time)s --> --- 250,255 ---- """Return the HTML <head> stuff.""" print '''\ ! <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> ! <html> <!-- THIS PAGE IS AUTOMATICALLY GENERATED. DO NOT EDIT. --> <!-- %(time)s --> *************** *** 261,270 **** --> ! <HEAD> ! <TITLE>%(title)s</TITLE> ! <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=%(charset)s"> %(meta)s %(style)s ! </HEAD>''' % {'title' : self.get_title(), 'headers': self.get_headers(), 'meta' : self.get_meta(), --- 261,270 ---- --> ! <head> ! <title>%(title)s</title> ! <meta http-equiv="Content-Type" content="text/html; charset=%(charset)s"> %(meta)s %(style)s ! </head>''' % {'title' : self.get_title(), 'headers': self.get_headers(), 'meta' : self.get_meta(), *************** *** 290,294 **** else: raise ValueError("unknown stylesheet language") ! s = '<LINK REL="STYLESHEET" HREF="%s" TYPE="%s">' \ % (stylesheet, type) if localstyle and localstyle.strip(): --- 290,294 ---- else: raise ValueError("unknown stylesheet language") ! s = '<link rel="STYLESHEET" href="%s" type="%s">' \ % (stylesheet, type) if localstyle and localstyle.strip(): *************** *** 296,302 **** if not localstyle.startswith("<!--"): # XXX should check the HTML version we're trying to produce ! fmt = '<STYLE TYPE="text/css">\n<!--\n%s\n-->\n</STYLE>' else: ! fmt = '<STYLE TYPE="text/css">\n%s\n</STYLE>' localstyle = fmt % localstyle if stylesheet: --- 296,302 ---- if not localstyle.startswith("<!--"): # XXX should check the HTML version we're trying to produce ! fmt = '<style type="text/css">\n<!--\n%s\n-->\n</style>' else: ! fmt = '<style type="text/css">\n%s\n</style>' localstyle = fmt % localstyle if stylesheet: *************** *** 308,315 **** def __start_body(self): print '''\ ! <BODY BGCOLOR="%(bgcolor)s" TEXT="%(fgcolor)s" %(extraattrs)s ! LINK="%(linkcolor)s" VLINK="%(vlinkcolor)s" ! ALINK="%(alinkcolor)s">''' % { 'bgcolor' : self.get_bgcolor(), 'fgcolor' : self.get_fgcolor(), --- 308,315 ---- def __start_body(self): print '''\ ! <body bgcolor="%(bgcolor)s" text="%(fgcolor)s" %(extraattrs)s ! link="%(linkcolor)s" vlink="%(vlinkcolor)s" ! alink="%(alinkcolor)s">''' % { 'bgcolor' : self.get_bgcolor(), 'fgcolor' : self.get_fgcolor(), *************** *** 321,325 **** def __finish_all(self): ! print '</BODY></HTML>' --- 321,325 ---- def __finish_all(self): ! print '</body></html>' |
From: <ba...@zo...> - 2002-03-27 04:15:02
|
Fred> Log Message: Use lower-case for tag and attribute names. Fred> Eventually, XHTML will be interesting. +1 on this change, but out of curiosity, does XHTML really care about tag case? -Barry |
From: Fred L. D. Jr. <fd...@ac...> - 2002-03-27 04:20:25
|
Barry A. Warsaw writes: > +1 on this change, but out of curiosity, does XHTML really care about > tag case? Yes. XHTML is specifically defined to be legal XML, and is case sensitive. The chosen direction was to use lower case rather than upper. There are two ways to provide XHTML: as text/xml, at which point it can be validated as XML, or as text/html, as which it cannot be valid HTML, but more browsers will be able to deal with it in practice. It cannot be valid HTML because it uses the XML-style empty tags (with a required space between the tag name or attributes and the "/>", as a browser compatibility hack). "<hr />" is perfectly legal XML, but will never be valid HTML since the '/' character is illegal at that position. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Zope Corporation |
From: <ba...@zo...> - 2002-03-27 04:23:08
|
>>>>> "Fred" == Fred L Drake, Jr <fd...@ac...> writes: Fred> Barry A. Warsaw writes: >> +1 on this change, but out of curiosity, does XHTML really care >> about tag case? Fred> Yes. XHTML is specifically defined to be legal XML, and is Fred> case sensitive. The chosen direction was to use lower case Fred> rather than upper. Fred> There are two ways to provide XHTML: as text/xml, at which Fred> point it can be validated as XML, or as text/html, as which Fred> it cannot be valid HTML, but more browsers will be able to Fred> deal with it in practice. It cannot be valid HTML because Fred> it uses the XML-style empty tags (with a required space Fred> between the tag name or attributes and the "/>", as a Fred> browser compatibility hack). "<hr />" is perfectly legal Fred> XML, but will never be valid HTML since the '/' character is Fred> illegal at that position. it-ain't-your-older-twin-brother's-web-anymore-ly y'rs, -Barry |