3
3
from six import text_type
4
4
5
5
from . import _base
6
- from ..constants import cdataElements , rcdataElements , voidElements
6
+ from ..constants import voidElements
7
7
8
8
from ..constants import spaceCharacters
9
9
spaceCharacters = "" .join (spaceCharacters )
@@ -16,13 +16,10 @@ class LintError(Exception):
16
16
class Filter (_base .Filter ):
17
17
def __iter__ (self ):
18
18
open_elements = []
19
- contentModelFlag = "PCDATA"
20
19
for token in _base .Filter .__iter__ (self ):
21
20
type = token ["type" ]
22
21
if type in ("StartTag" , "EmptyTag" ):
23
22
name = token ["name" ]
24
- if contentModelFlag != "PCDATA" :
25
- raise LintError ("StartTag not in PCDATA content model flag: %(tag)s" % {"tag" : name })
26
23
if not isinstance (name , text_type ):
27
24
raise LintError ("Tag name is not a string: %(tag)r" % {"tag" : name })
28
25
if not name :
@@ -44,12 +41,6 @@ def __iter__(self):
44
41
raise LintError ("Empty attribute localname" )
45
42
if not isinstance (value , text_type ):
46
43
raise LintError ("Attribute value is not a string: %(value)r" % {"value" : value })
47
- if name in cdataElements :
48
- contentModelFlag = "CDATA"
49
- elif name in rcdataElements :
50
- contentModelFlag = "RCDATA"
51
- elif name == "plaintext" :
52
- contentModelFlag = "PLAINTEXT"
53
44
54
45
elif type == "EndTag" :
55
46
name = token ["name" ]
@@ -62,11 +53,9 @@ def __iter__(self):
62
53
start_name = open_elements .pop ()
63
54
if start_name != name :
64
55
raise LintError ("EndTag (%(end)s) does not match StartTag (%(start)s)" % {"end" : name , "start" : start_name })
65
- contentModelFlag = "PCDATA"
66
56
67
57
elif type == "Comment" :
68
- if contentModelFlag != "PCDATA" :
69
- raise LintError ("Comment not in PCDATA content model flag" )
58
+ pass
70
59
71
60
elif type in ("Characters" , "SpaceCharacters" ):
72
61
data = token ["data" ]
@@ -81,8 +70,6 @@ def __iter__(self):
81
70
82
71
elif type == "Doctype" :
83
72
name = token ["name" ]
84
- if contentModelFlag != "PCDATA" :
85
- raise LintError ("Doctype not in PCDATA content model flag: %(name)s" % {"name" : name })
86
73
if not isinstance (name , text_type ):
87
74
raise LintError ("Tag name is not a string: %(tag)r" % {"tag" : name })
88
75
# XXX: what to do with token["data"] ?
0 commit comments