CVS: ht2html htwf.py,1.1,1.2

"Fred L. Drake" <[email protected]> Tue, 29 Jul 2003 13:29:43 -0700
Newsgroups gmane.comp.web.ht2html.devel
Message-ID <[email protected]>
Update of /cvsroot/ht2html/ht2html
In directory sc8-pr-cvs1:/tmp/cvs-serv487

Modified Files:
	htwf.py 
Log Message:
add an XHTML-specific sanity check: tag and attribute names should be
lower case


Index: htwf.py
===================================================================
RCS file: /cvsroot/ht2html/ht2html/htwf.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** htwf.py	25 Jul 2003 05:22:39 -0000	1.1
--- htwf.py	29 Jul 2003 20:29:41 -0000	1.2
***************
*** 60,67 ****
--- 60,78 ----
          newtext = g.makepage()
          p = expat.ParserCreate()
+         p.StartElementHandler = self.startElement
          try:
              p.Parse(newtext, 1)
          except expat.ExpatError, e:
              print e
+         except RuntimeError, e:
+             print e
+ 
+     def startElement(self, name, attrs):
+         if not name.islower():
+             raise RuntimeError("found non-lowercase tag name: " + `name`)
+         for attrname in attrs.keys():
+             if not attrname.islower():
+                 raise RuntimeError("found non-lowercase attribute name: "
+                                    + `attrname`)
  
  



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01