Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f9953e4

Browse files
author
Gabriel Corona
committed
HttpLexer: recognize HTTP responses as well
1 parent 5b10273 commit f9953e4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pygments/lexers/textfmts.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,10 @@ def content_callback(self, match):
194194
}
195195

196196
def analyse_text(text):
197-
return re.search(r'^([a-zA-Z][-_a-zA-Z]+)( +)([^ ]+)( +)'
198-
r'(HTTP)(/)(1\.[01]|2(?:\.0)?|3)(\r?\n|\Z)', text) is not None
197+
return (re.search(r'^([a-zA-Z][-_a-zA-Z]+)( +)([^ ]+)( +)'
198+
r'(HTTP)(/)(1\.[01]|2(?:\.0)?|3)(\r?\n|\Z)', text) is not None) or \
199+
(re.search(r'^(HTTP)(/)(1\.[01]|2(?:\.0)?|3)( +)(\d{3})(?:( +)([^\r\n]*))?(\r?\n|\Z)',
200+
text) is not None)
199201

200202

201203
class TodotxtLexer(RegexLexer):

0 commit comments

Comments
 (0)