@@ -204,8 +204,8 @@ def mainLoop(self):
204204elif type == DoctypeToken :
205205new_token = phase .processDoctype (new_token )
206206
207- if (type == StartTagToken and token ["selfClosing" ]
208- and not token ["selfClosingAcknowledged" ]):
207+ if (type == StartTagToken and token ["selfClosing" ]and
208+ not token ["selfClosingAcknowledged" ]):
209209self .parseError ("non-void-element-with-trailing-solidus" ,
210210 {"name" :token ["name" ]})
211211
@@ -517,77 +517,76 @@ def processDoctype(self, token):
517517if publicId != "" :
518518publicId = publicId .translate (asciiUpper2Lower )
519519
520- if (not correct or token ["name" ]!= "html"
521- or publicId .startswith (
522- ("+//silmaril//dtd html pro v0r11 19970101//" ,
523- "-//advasoft ltd//dtd html 3.0 aswedit + extensions//" ,
524- "-//as//dtd html 3.0 aswedit + extensions//" ,
525- "-//ietf//dtd html 2.0 level 1//" ,
526- "-//ietf//dtd html 2.0 level 2//" ,
527- "-//ietf//dtd html 2.0 strict level 1//" ,
528- "-//ietf//dtd html 2.0 strict level 2//" ,
529- "-//ietf//dtd html 2.0 strict//" ,
530- "-//ietf//dtd html 2.0//" ,
531- "-//ietf//dtd html 2.1e//" ,
532- "-//ietf//dtd html 3.0//" ,
533- "-//ietf//dtd html 3.2 final//" ,
534- "-//ietf//dtd html 3.2//" ,
535- "-//ietf//dtd html 3//" ,
536- "-//ietf//dtd html level 0//" ,
537- "-//ietf//dtd html level 1//" ,
538- "-//ietf//dtd html level 2//" ,
539- "-//ietf//dtd html level 3//" ,
540- "-//ietf//dtd html strict level 0//" ,
541- "-//ietf//dtd html strict level 1//" ,
542- "-//ietf//dtd html strict level 2//" ,
543- "-//ietf//dtd html strict level 3//" ,
544- "-//ietf//dtd html strict//" ,
545- "-//ietf//dtd html//" ,
546- "-//metrius//dtd metrius presentational//" ,
547- "-//microsoft//dtd internet explorer 2.0 html strict//" ,
548- "-//microsoft//dtd internet explorer 2.0 html//" ,
549- "-//microsoft//dtd internet explorer 2.0 tables//" ,
550- "-//microsoft//dtd internet explorer 3.0 html strict//" ,
551- "-//microsoft//dtd internet explorer 3.0 html//" ,
552- "-//microsoft//dtd internet explorer 3.0 tables//" ,
553- "-//netscape comm. corp.//dtd html//" ,
554- "-//netscape comm. corp.//dtd strict html//" ,
555- "-//o'reilly and associates//dtd html 2.0//" ,
556- "-//o'reilly and associates//dtd html extended 1.0//" ,
557- "-//o'reilly and associates//dtd html extended relaxed 1.0//" ,
558- "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//" ,
559- "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//" ,
560- "-//spyglass//dtd html 2.0 extended//" ,
561- "-//sq//dtd html 2.0 hotmetal + extensions//" ,
562- "-//sun microsystems corp.//dtd hotjava html//" ,
563- "-//sun microsystems corp.//dtd hotjava strict html//" ,
564- "-//w3c//dtd html 3 1995-03-24//" ,
565- "-//w3c//dtd html 3.2 draft//" ,
566- "-//w3c//dtd html 3.2 final//" ,
567- "-//w3c//dtd html 3.2//" ,
568- "-//w3c//dtd html 3.2s draft//" ,
569- "-//w3c//dtd html 4.0 frameset//" ,
570- "-//w3c//dtd html 4.0 transitional//" ,
571- "-//w3c//dtd html experimental 19960712//" ,
572- "-//w3c//dtd html experimental 970421//" ,
573- "-//w3c//dtd w3 html//" ,
574- "-//w3o//dtd w3 html 3.0//" ,
575- "-//webtechs//dtd mozilla html 2.0//" ,
576- "-//webtechs//dtd mozilla html//" ))
577- or publicId in
578- ("-//w3o//dtd w3 html strict 3.0//en//" ,
579- "-/w3c/dtd html 4.0 transitional/en" ,
580- "html" )
581- or publicId .startswith (
582- ("-//w3c//dtd html 4.01 frameset//" ,
583- "-//w3c//dtd html 4.01 transitional//" ))and
584- systemId is None
585- or systemId and systemId .lower ()== "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" ):
520+ if (not correct or token ["name" ]!= "html" or
521+ publicId .startswith (
522+ ("+//silmaril//dtd html pro v0r11 19970101//" ,
523+ "-//advasoft ltd//dtd html 3.0 aswedit + extensions//" ,
524+ "-//as//dtd html 3.0 aswedit + extensions//" ,
525+ "-//ietf//dtd html 2.0 level 1//" ,
526+ "-//ietf//dtd html 2.0 level 2//" ,
527+ "-//ietf//dtd html 2.0 strict level 1//" ,
528+ "-//ietf//dtd html 2.0 strict level 2//" ,
529+ "-//ietf//dtd html 2.0 strict//" ,
530+ "-//ietf//dtd html 2.0//" ,
531+ "-//ietf//dtd html 2.1e//" ,
532+ "-//ietf//dtd html 3.0//" ,
533+ "-//ietf//dtd html 3.2 final//" ,
534+ "-//ietf//dtd html 3.2//" ,
535+ "-//ietf//dtd html 3//" ,
536+ "-//ietf//dtd html level 0//" ,
537+ "-//ietf//dtd html level 1//" ,
538+ "-//ietf//dtd html level 2//" ,
539+ "-//ietf//dtd html level 3//" ,
540+ "-//ietf//dtd html strict level 0//" ,
541+ "-//ietf//dtd html strict level 1//" ,
542+ "-//ietf//dtd html strict level 2//" ,
543+ "-//ietf//dtd html strict level 3//" ,
544+ "-//ietf//dtd html strict//" ,
545+ "-//ietf//dtd html//" ,
546+ "-//metrius//dtd metrius presentational//" ,
547+ "-//microsoft//dtd internet explorer 2.0 html strict//" ,
548+ "-//microsoft//dtd internet explorer 2.0 html//" ,
549+ "-//microsoft//dtd internet explorer 2.0 tables//" ,
550+ "-//microsoft//dtd internet explorer 3.0 html strict//" ,
551+ "-//microsoft//dtd internet explorer 3.0 html//" ,
552+ "-//microsoft//dtd internet explorer 3.0 tables//" ,
553+ "-//netscape comm. corp.//dtd html//" ,
554+ "-//netscape comm. corp.//dtd strict html//" ,
555+ "-//o'reilly and associates//dtd html 2.0//" ,
556+ "-//o'reilly and associates//dtd html extended 1.0//" ,
557+ "-//o'reilly and associates//dtd html extended relaxed 1.0//" ,
558+ "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//" ,
559+ "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//" ,
560+ "-//spyglass//dtd html 2.0 extended//" ,
561+ "-//sq//dtd html 2.0 hotmetal + extensions//" ,
562+ "-//sun microsystems corp.//dtd hotjava html//" ,
563+ "-//sun microsystems corp.//dtd hotjava strict html//" ,
564+ "-//w3c//dtd html 3 1995-03-24//" ,
565+ "-//w3c//dtd html 3.2 draft//" ,
566+ "-//w3c//dtd html 3.2 final//" ,
567+ "-//w3c//dtd html 3.2//" ,
568+ "-//w3c//dtd html 3.2s draft//" ,
569+ "-//w3c//dtd html 4.0 frameset//" ,
570+ "-//w3c//dtd html 4.0 transitional//" ,
571+ "-//w3c//dtd html experimental 19960712//" ,
572+ "-//w3c//dtd html experimental 970421//" ,
573+ "-//w3c//dtd w3 html//" ,
574+ "-//w3o//dtd w3 html 3.0//" ,
575+ "-//webtechs//dtd mozilla html 2.0//" ,
576+ "-//webtechs//dtd mozilla html//" ))or
577+ publicId in ("-//w3o//dtd w3 html strict 3.0//en//" ,
578+ "-/w3c/dtd html 4.0 transitional/en" ,
579+ "html" )or
580+ publicId .startswith (
581+ ("-//w3c//dtd html 4.01 frameset//" ,
582+ "-//w3c//dtd html 4.01 transitional//" ))and
583+ systemId is None or
584+ systemId and systemId .lower ()== "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" ):
586585self .parser .compatMode = "quirks"
587586elif (publicId .startswith (
588587 ("-//w3c//dtd xhtml 1.0 frameset//" ,
589- "-//w3c//dtd xhtml 1.0 transitional//" ))
590- or publicId .startswith (
588+ "-//w3c//dtd xhtml 1.0 transitional//" ))or
589+ publicId .startswith (
591590 ("-//w3c//dtd html 4.01 frameset//" ,
592591"-//w3c//dtd html 4.01 transitional//" ))and
593592systemId is not None ):
@@ -988,8 +987,8 @@ def processSpaceCharactersDropNewline(self, token):
988987data = token ["data" ]
989988self .processSpaceCharacters = self .processSpaceCharactersNonPre
990989if (data .startswith ("\n " )and
991- self .tree .openElements [- 1 ].name in ("pre" ,"listing" ,"textarea" )
992- and not self .tree .openElements [- 1 ].hasContent ()):
990+ self .tree .openElements [- 1 ].name in ("pre" ,"listing" ,"textarea" )and
991+ not self .tree .openElements [- 1 ].hasContent ()):
993992data = data [1 :]
994993if data :
995994self .tree .reconstructActiveFormattingElements ()
@@ -1016,8 +1015,8 @@ def startTagProcessInHead(self, token):
10161015
10171016def startTagBody (self ,token ):
10181017self .parser .parseError ("unexpected-start-tag" , {"name" :"body" })
1019- if (len (self .tree .openElements )== 1
1020- or self .tree .openElements [1 ].name != "body" ):
1018+ if (len (self .tree .openElements )== 1 or
1019+ self .tree .openElements [1 ].name != "body" ):
10211020assert self .parser .innerHTML
10221021else :
10231022self .parser .framesetOK = False