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 | e59c3bf66fb13a9efc25c3a8e2396804f32ca1e5 (patch) | |
tree | 7664ec8263066d1db73d069233e2af5516966181 | |
parent | 923fbfedc8467761491d4adeba1f5f00a11239eb (diff) | |
download | pygments-e59c3bf66fb13a9efc25c3a8e2396804f32ca1e5.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
@@ -17,6 +17,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() |