@@ -204,8 +204,8 @@ def mainLoop(self):
204
204
elif type == DoctypeToken :
205
205
new_token = phase .processDoctype (new_token )
206
206
207
- if (type == StartTagToken and token ["selfClosing" ]
208
- and not token ["selfClosingAcknowledged" ]):
207
+ if (type == StartTagToken and token ["selfClosing" ] and
208
+ not token ["selfClosingAcknowledged" ]):
209
209
self .parseError ("non-void-element-with-trailing-solidus" ,
210
210
{"name" : token ["name" ]})
211
211
@@ -517,77 +517,76 @@ def processDoctype(self, token):
517
517
if publicId != "" :
518
518
publicId = publicId .translate (asciiUpper2Lower )
519
519
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" ):
586
585
self .parser .compatMode = "quirks"
587
586
elif (publicId .startswith (
588
587
("-//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 (
591
590
("-//w3c//dtd html 4.01 frameset//" ,
592
591
"-//w3c//dtd html 4.01 transitional//" )) and
593
592
systemId is not None ):
@@ -988,8 +987,8 @@ def processSpaceCharactersDropNewline(self, token):
988
987
data = token ["data" ]
989
988
self .processSpaceCharacters = self .processSpaceCharactersNonPre
990
989
if (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 ()):
993
992
data = data [1 :]
994
993
if data :
995
994
self .tree .reconstructActiveFormattingElements ()
@@ -1016,8 +1015,8 @@ def startTagProcessInHead(self, token):
1016
1015
1017
1016
def startTagBody (self , token ):
1018
1017
self .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" ):
1021
1020
assert self .parser .innerHTML
1022
1021
else :
1023
1022
self .parser .framesetOK = False
0 commit comments