Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: tools/json_schema_compiler/previewserver.py

Issue 10833024: Fix syntax highlighting in JSON Schema Compiler's preview server: don't crash (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/json_schema_compiler/highlighters/pygments_highlighter.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 """Server for viewing the compiled C++ code from tools/json_schema_compiler. 6 """Server for viewing the compiled C++ code from tools/json_schema_compiler.
7 """ 7 """
8 8
9 import cc_generator 9 import cc_generator
10 import code 10 import code
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 help='port to run the server on') 314 help='port to run the server on')
315 315
316 (opts, argv) = parser.parse_args() 316 (opts, argv) = parser.parse_args()
317 317
318 try: 318 try:
319 print('Starting previewserver on port %d' % opts.port) 319 print('Starting previewserver on port %d' % opts.port)
320 print('The extension documentation can be found at:') 320 print('The extension documentation can be found at:')
321 print('') 321 print('')
322 print(' http://localhost:%d/chrome/common/extensions/api' % opts.port) 322 print(' http://localhost:%d/chrome/common/extensions/api' % opts.port)
323 print('') 323 print('')
324 server = PreviewHTTPServer(('', int(opts.port)), CompilerHandler, 324
325 { 325 highlighters = {
326 'pygments': pygments_highlighter.PygmentsHighlighter(), 326 'hilite': hilite_me_highlighter.HiliteMeHighlighter(),
327 'hilite': hilite_me_highlighter.HiliteMeHighlighter(), 327 'none': none_highlighter.NoneHighlighter()
328 'none': none_highlighter.NoneHighlighter(), 328 }
329 }) 329 try:
330 highlighters['pygments'] = pygments_highlighter.PygmentsHighlighter()
331 except ImportError as e:
332 pass
333
334 server = PreviewHTTPServer(('', int(opts.port)),
335 CompilerHandler,
336 highlighters)
330 server.serve_forever() 337 server.serve_forever()
331 except KeyboardInterrupt: 338 except KeyboardInterrupt:
332 server.socket.close() 339 server.socket.close()
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/highlighters/pygments_highlighter.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698