pygments.filter
Module that implements the default filter.
copyright: | Copyright 2006-2013 by the Pygments team, see AUTHORS. |
license: | BSD, see LICENSE for details. |
-
class pygments.filter.Filter(**options)[source]
Default filter. Subclass this class or use the simplefilter
decorator to create own filters.
-
class pygments.filter.FunctionFilter(**options)[source]
Abstract class used by simplefilter to create simple
function filters on the fly. The simplefilter decorator
automatically creates subclasses of this class for
functions passed to it.
-
pygments.filter.apply_filters(stream, filters, lexer=None)[source]
Use this method to apply an iterable of filters to
a stream. If lexer is given it’s forwarded to the
filter, otherwise the filter receives None.
-
pygments.filter.simplefilter(f)[source]
Decorator that converts a function into a filter:
- def lowercase(lexer, stream, options):
- for ttype, value in stream:
- yield ttype, value.lower()