OLD | NEW |
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 Loading... |
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() |
OLD | NEW |