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`)
|