diff options
author | Georg Brandl <georg@python.org> | 2015-01-21 07:25:35 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2015-01-21 07:25:35 +0100 |
commit | 7b9fa24091fe62a1be03c5c7889ce1ba6248c6a2 (patch) | |
tree | 71983549e3296b8ea6dd8dddaf441b6d6b205770 /doc | |
parent | 9d2fb86e755d06d68a6352fac284efc1f39ad3fe (diff) | |
download | pygments-7b9fa24091fe62a1be03c5c7889ce1ba6248c6a2.tar.gz |
Closes #1075: fix docs for @simplefilter.
The function needs a "self" argument since it is used as a method in the
automatically created class. No use fixing that in the code, as it
kills backwards compatibility.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/docs/filterdevelopment.rst | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/doc/docs/filterdevelopment.rst b/doc/docs/filterdevelopment.rst index 5f9ca8c7..fbcd0a09 100644 --- a/doc/docs/filterdevelopment.rst +++ b/doc/docs/filterdevelopment.rst @@ -58,7 +58,7 @@ You can also use the `simplefilter` decorator from the `pygments.filter` module: @simplefilter - def uncolor(lexer, stream, options): + def uncolor(self, lexer, stream, options): class_too = get_bool_opt(options, 'classtoo') for ttype, value in stream: if ttype is Name.Function or (class_too and @@ -67,4 +67,5 @@ You can also use the `simplefilter` decorator from the `pygments.filter` module: yield ttype, value The decorator automatically subclasses an internal filter class and uses the -decorated function for filtering. +decorated function as a method for filtering. (That's why there is a `self` +argument that you probably won't end up using in the method.) |