3 pygments.filter |
3 pygments.filter |
4 ~~~~~~~~~~~~~~~ |
4 ~~~~~~~~~~~~~~~ |
5 |
5 |
6 Module that implements the default filter. |
6 Module that implements the default filter. |
7 |
7 |
8 :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. |
8 :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. |
9 :license: BSD, see LICENSE for details. |
9 :license: BSD, see LICENSE for details. |
10 """ |
10 """ |
11 |
11 |
12 |
12 |
13 def apply_filters(stream, filters, lexer=None): |
13 def apply_filters(stream, filters, lexer=None): |
32 def lowercase(self, lexer, stream, options): |
32 def lowercase(self, lexer, stream, options): |
33 for ttype, value in stream: |
33 for ttype, value in stream: |
34 yield ttype, value.lower() |
34 yield ttype, value.lower() |
35 """ |
35 """ |
36 return type(f.__name__, (FunctionFilter,), { |
36 return type(f.__name__, (FunctionFilter,), { |
37 'function': f, |
37 '__module__': getattr(f, '__module__'), |
38 '__module__': getattr(f, '__module__'), |
38 '__doc__': f.__doc__, |
39 '__doc__': f.__doc__ |
39 'function': f, |
40 }) |
40 }) |
41 |
41 |
42 |
42 |
43 class Filter(object): |
43 class Filter(object): |
44 """ |
44 """ |
45 Default filter. Subclass this class or use the `simplefilter` |
45 Default filter. Subclass this class or use the `simplefilter` |