@@ -65,11 +65,12 @@ def parse():
6565 if opts .profile :
6666 import cProfile
6767 import pstats
68- cProfile .runctx ("run(parseMethod, f, encoding)" , None ,
68+ cProfile .runctx ("run(parseMethod, f, encoding, scripting )" , None ,
6969 {"run" : run ,
7070 "parseMethod" : parseMethod ,
7171 "f" : f ,
72- "encoding" : encoding },
72+ "encoding" : encoding ,
73+ "scripting" : opts .scripting },
7374 "stats.prof" )
7475 # XXX - We should use a temp file here
7576 stats = pstats .Stats ('stats.prof' )
@@ -79,7 +80,7 @@ def parse():
7980 elif opts .time :
8081 import time
8182 t0 = time .time ()
82- document = run (parseMethod , f , encoding )
83+ document = run (parseMethod , f , encoding , opts . scripting )
8384 t1 = time .time ()
8485 if document :
8586 printOutput (p , document , opts )
@@ -88,13 +89,13 @@ def parse():
8889 else :
8990 sys .stderr .write ("\n \n Run took: %fs" % (t1 - t0 ))
9091 else :
91- document = run (parseMethod , f , encoding )
92+ document = run (parseMethod , f , encoding , opts . scripting )
9293 if document :
9394 printOutput (p , document , opts )
9495
95- def run (parseMethod , f , encoding ):
96+ def run (parseMethod , f , encoding , scripting ):
9697 try :
97- document = parseMethod (f , encoding = encoding )
98+ document = parseMethod (f , encoding = encoding , scripting = scripting )
9899 except :
99100 document = None
100101 traceback .print_exc ()
@@ -168,6 +169,9 @@ def getOptParser():
168169 parser .add_option ("-f" , "--fragment" , action = "store_true" , default = False ,
169170 dest = "fragment" , help = "Parse as a fragment" )
170171
172+ parser .add_option ("-s" , "--scripting" , action = "store_true" , default = False ,
173+ dest = "scripting" , help = "Handle noscript tags as if scripting was enabled" )
174+
171175 parser .add_option ("" , "--tree" , action = "store_true" , default = False ,
172176 dest = "tree" , help = "Output as debug tree" )
173177
0 commit comments