summaryrefslogtreecommitdiff
path: root/pygments/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'pygments/util.py')
-rw-r--r--pygments/util.py6
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))))