230 if opts.pop('-h', None) is not None: |
230 if opts.pop('-h', None) is not None: |
231 print(usage) |
231 print(usage) |
232 return 0 |
232 return 0 |
233 |
233 |
234 if opts.pop('-V', None) is not None: |
234 if opts.pop('-V', None) is not None: |
235 print('Pygments version %s, (c) 2006-2019 by Georg Brandl.' % __version__) |
235 print('Pygments version %s, (c) 2006-2020 by Georg Brandl.' % __version__) |
236 return 0 |
236 return 0 |
237 |
237 |
238 # handle ``pygmentize -L`` |
238 # handle ``pygmentize -L`` |
239 L_opt = opts.pop('-L', None) |
239 L_opt = opts.pop('-L', None) |
240 if L_opt is not None: |
240 if L_opt is not None: |
513 lexer = LatexEmbeddedLexer(left, right, lexer) |
513 lexer = LatexEmbeddedLexer(left, right, lexer) |
514 |
514 |
515 # ... and do it! |
515 # ... and do it! |
516 if '-s' not in opts: |
516 if '-s' not in opts: |
517 # process whole input as per normal... |
517 # process whole input as per normal... |
518 highlight(code, lexer, fmter, outfile) |
518 try: |
|
519 highlight(code, lexer, fmter, outfile) |
|
520 finally: |
|
521 if outfn: |
|
522 outfile.close() |
519 return 0 |
523 return 0 |
520 else: |
524 else: |
521 # line by line processing of stdin (eg: for 'tail -f')... |
525 # line by line processing of stdin (eg: for 'tail -f')... |
522 try: |
526 try: |
523 while 1: |
527 while 1: |