summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2013-01-18 09:06:34 +0100
committerGeorg Brandl <georg@python.org>2013-01-18 09:06:34 +0100
commit4253dd26e0d259e7df5c541231f0d8cfa614b3be (patch)
treee604d74613e5bc5c050debb8f40942d27c2e2909
parentb791a2396bb845284f93597d728758bd39fdeb6c (diff)
downloadpygments-4253dd26e0d259e7df5c541231f0d8cfa614b3be.tar.gz
Closes #838: fix lexers not receiving command-line options when guessing by content.
-rw-r--r--CHANGES2
-rw-r--r--pygments/cmdline.py8
2 files changed, 6 insertions, 4 deletions
diff --git a/CHANGES b/CHANGES
index 03d38198..845105ba 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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>)'