htmlconverter.py: allow .html + .htm file extensions, disallow all others.

Review URL: https://chromereviews.googleplex.com/3567016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@261 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
sigmund@google.com 2011-10-07 21:17:04 +00:00
parent 8af240c0cc
commit 755cd7ec8b

View file

@ -539,14 +539,17 @@ def main():
try:
filename = args[0]
extension = filename[filename.rfind('.'):]
if extension != '.html' and extension != '.htm':
print "Invalid input file extension: %s" % extension
return 1
outfile = join(options.out, filename)
if 'chromium' in options.target:
convertForChromium(
filename, options.optimize, outfile.replace('.html', '-js.html'),
options.verbose)
convertForChromium(filename, options.optimize,
outfile.replace(extension, '-js' + extension), options.verbose)
if 'dartium' in options.target:
convertForDartium(filename, outfile.replace('.html', '-dart.html'),
options.verbose)
convertForDartium(filename,
outfile.replace(extension, '-dart' + extension), options.verbose)
except Exception as e:
print "%sERROR%s: %s" % (RED_COLOR, NO_COLOR, str(e))
return 1