diff options
author | gbrandl <devnull@localhost> | 2008-09-07 19:50:47 +0200 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2008-09-07 19:50:47 +0200 |
commit | 4ba95409a3b64075c99d4f7f3c405857578a2670 (patch) | |
tree | f72e0bdf7eb5e0f29f4450fd596e333419d93634 /pygments/util.py | |
parent | 21cd6ca55b236413f37e5679b7b6cd03ee928fea (diff) | |
download | pygments-4ba95409a3b64075c99d4f7f3c405857578a2670.tar.gz |
* Add one formatter per image format, to avoid surprises with
pygmentize -f gif -o foo.gif foo.py
which would previously create a PNG image.
* Make image format names case-insensitive.
Diffstat (limited to 'pygments/util.py')
-rw-r--r-- | pygments/util.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pygments/util.py b/pygments/util.py index 0e8c952a..48115abd 100644 --- a/pygments/util.py +++ b/pygments/util.py @@ -5,7 +5,7 @@ Utility functions. - :copyright: 2006-2007 by Georg Brandl. + :copyright: 2006-2008 by Georg Brandl. :license: BSD, see LICENSE for more details. """ import re @@ -33,8 +33,10 @@ class OptionError(Exception): pass -def get_choice_opt(options, optname, allowed, default=None): +def get_choice_opt(options, optname, allowed, default=None, normcase=False): string = options.get(optname, default) + if normcase: + string = string.lower() if string not in allowed: raise OptionError('Value for option %s must be one of %s' % (optname, ', '.join(map(str, allowed)))) |