9 :license: BSD, see LICENSE for details. |
9 :license: BSD, see LICENSE for details. |
10 """ |
10 """ |
11 |
11 |
12 from __future__ import unicode_literals # __IGNORE_WARNING__ |
12 from __future__ import unicode_literals # __IGNORE_WARNING__ |
13 |
13 |
|
14 try: |
|
15 basestring # __IGNORE_WARNING__ |
|
16 except NameError: |
|
17 basestring = str |
|
18 |
14 import codecs |
19 import codecs |
15 |
20 |
16 from pygments.util import get_bool_opt |
21 from pygments.util import get_bool_opt |
17 from pygments.styles import get_style_by_name |
22 from pygments.styles import get_style_by_name |
18 |
23 |
19 __all__ = ['Formatter'] |
24 __all__ = ['Formatter'] |
20 |
25 |
21 |
26 |
22 def _lookup_style(style): |
27 def _lookup_style(style): |
23 if isinstance(style, str): |
28 if isinstance(style, basestring): |
24 return get_style_by_name(style) |
29 return get_style_by_name(style) |
25 return style |
30 return style |
26 |
31 |
27 |
32 |
28 class Formatter(object): |
33 class Formatter(object): |