Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit78fac88

Browse files
neumondgsnedders
authored andcommitted
Scripting parameter for parse.py (#1)
1 parente0247f3 commit78fac88

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

‎parse.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@ def parse():
6565
ifopts.profile:
6666
importcProfile
6767
importpstats
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
elifopts.time:
8081
importtime
8182
t0=time.time()
82-
document=run(parseMethod,f,encoding)
83+
document=run(parseMethod,f,encoding,opts.scripting)
8384
t1=time.time()
8485
ifdocument:
8586
printOutput(p,document,opts)
@@ -88,13 +89,13 @@ def parse():
8889
else:
8990
sys.stderr.write("\n\nRun took: %fs"%(t1-t0))
9091
else:
91-
document=run(parseMethod,f,encoding)
92+
document=run(parseMethod,f,encoding,opts.scripting)
9293
ifdocument:
9394
printOutput(p,document,opts)
9495

95-
defrun(parseMethod,f,encoding):
96+
defrun(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

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp