diff options
author | Georg Brandl <georg@python.org> | 2013-01-18 09:06:34 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2013-01-18 09:06:34 +0100 |
commit | 4253dd26e0d259e7df5c541231f0d8cfa614b3be (patch) | |
tree | e604d74613e5bc5c050debb8f40942d27c2e2909 | |
parent | b791a2396bb845284f93597d728758bd39fdeb6c (diff) | |
download | pygments-4253dd26e0d259e7df5c541231f0d8cfa614b3be.tar.gz |
Closes #838: fix lexers not receiving command-line options when guessing by content.
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | pygments/cmdline.py | 8 |
2 files changed, 6 insertions, 4 deletions
@@ -15,6 +15,8 @@ Version 1.6 * Dylan console (PR#149) * Logos (PR#150) +- Fix guessed lexers not receiving lexer options (#838). + Version 1.6rc1 -------------- diff --git a/pygments/cmdline.py b/pygments/cmdline.py index 3bf081d4..c25204bf 100644 --- a/pygments/cmdline.py +++ b/pygments/cmdline.py @@ -378,9 +378,9 @@ def main(args=sys.argv): except ClassNotFound, err: if '-g' in opts: try: - lexer = guess_lexer(code) + lexer = guess_lexer(code, **parsed_opts) except ClassNotFound: - lexer = TextLexer() + lexer = TextLexer(**parsed_opts) else: print >>sys.stderr, 'Error:', err return 1 @@ -392,9 +392,9 @@ def main(args=sys.argv): if '-g' in opts: code = sys.stdin.read() try: - lexer = guess_lexer(code) + lexer = guess_lexer(code, **parsed_opts) except ClassNotFound: - lexer = TextLexer() + lexer = TextLexer(**parsed_opts) elif not lexer: print >>sys.stderr, 'Error: no lexer name given and reading ' + \ 'from stdin (try using -g or -l <lexer>)' |