diff options
author | Georg Brandl <georg@python.org> | 2016-02-02 22:17:15 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2016-02-02 22:17:15 +0100 |
commit | fb564416e672bfa554638293f93d86283da97d26 (patch) | |
tree | 3e01539a263358b7ba3f9068309ac29e2027ee96 | |
parent | 754f32c6ded2d4b4e84674aa012d6ba78ffd5d50 (diff) | |
download | pygments-fb564416e672bfa554638293f93d86283da97d26.tar.gz |
Fixed statefulness of HttpLexer between get_tokens calls
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | pygments/lexers/textfmts.py | 5 |
2 files changed, 6 insertions, 0 deletions
@@ -29,6 +29,7 @@ Version 2.1.1 - Fixed image formatter font searching on Macs (#1188) - Fixed deepcopy-ing of Token instances (#1168) - Fixed Julia string interpolation (#1170) +- Fixed statefulness of HttpLexer between get_tokens calls - Many smaller fixes to various lexers diff --git a/pygments/lexers/textfmts.py b/pygments/lexers/textfmts.py index 43b16f8c..cab9add5 100644 --- a/pygments/lexers/textfmts.py +++ b/pygments/lexers/textfmts.py @@ -122,6 +122,11 @@ class HttpLexer(RegexLexer): flags = re.DOTALL + def get_tokens_unprocessed(self, text, stack=('root',)): + """Reset the content-type state.""" + self.content_type = None + return RegexLexer.get_tokens_unprocessed(self, text, stack) + def header_callback(self, match): if match.group(1).lower() == 'content-type': content_type = match.group(5).strip() |