@@ -55,7 +55,7 @@ def parse():
55
55
56
56
tokenizer = HTMLTokenizer
57
57
58
- p = html5parser .HTMLParser (tree = treebuilder , tokenizer = tokenizer , debug = opts .log )
58
+ p = html5parser .HTMLParser (tree = treebuilder , debug = opts .log )
59
59
60
60
if opts .fragment :
61
61
parseMethod = p .parseFragment
@@ -96,7 +96,7 @@ def parse():
96
96
97
97
def run (parseMethod , f , encoding , scripting ):
98
98
try :
99
- document = parseMethod (f , encoding = encoding , scripting = scripting )
99
+ document = parseMethod (f , override_encoding = encoding , scripting = scripting )
100
100
except :
101
101
document = None
102
102
traceback .print_exc ()
@@ -117,16 +117,14 @@ def printOutput(parser, document, opts):
117
117
document .writexml (sys .stdout , encoding = "utf-8" )
118
118
elif tb == "lxml" :
119
119
import lxml .etree
120
- sys .stdout .write (lxml .etree .tostring (document ))
120
+ sys .stdout .write (lxml .etree .tostring (document , encoding = "unicode" ))
121
121
elif tb == "etree" :
122
- sys .stdout .write (utils .default_etree .tostring (document ))
122
+ sys .stdout .write (utils .default_etree .tostring (document , encoding = "unicode" ))
123
123
elif opts .tree :
124
124
if not hasattr (document , '__getitem__' ):
125
125
document = [document ]
126
126
for fragment in document :
127
127
print (parser .tree .testSerializer (fragment ))
128
- elif opts .hilite :
129
- sys .stdout .write (document .hilite ("utf-8" ))
130
128
elif opts .html :
131
129
kwargs = {}
132
130
for opt in serializer .HTMLSerializer .options :
@@ -188,9 +186,6 @@ def getOptParser():
188
186
parser .add_option ("" , "--no-html" , action = "store_false" , default = True ,
189
187
dest = "html" , help = "Don't output html" )
190
188
191
- parser .add_option ("" , "--hilite" , action = "store_true" , default = False ,
192
- dest = "hilite" , help = "Output as formatted highlighted code." )
193
-
194
189
parser .add_option ("-c" , "--encoding" , action = "store_true" , default = False ,
195
190
dest = "encoding" , help = "Print character encoding used" )
196
191
0 commit comments