lib/rouge/lexers/http.rb in rouge-1.1.0 vs lib/rouge/lexers/http.rb in rouge-1.2.0
- old
+ new
@@ -23,27 +23,30 @@
rule %r(
(#{HTTP.methods.join('|')})([ ]+) # method
([^ ]+)([ ]+) # path
(HTTPS?)(/)(1[.][01])(\r?\n|$) # http version
)ox do
- group Name::Function; group Text
- group Name::Namespace; group Text
- group Keyword; group Operator
- group Num; group Text
+ groups(
+ Name::Function, Text,
+ Name::Namespace, Text,
+ Keyword, Operator, Num, Text
+ )
+
push :headers
end
# response
rule %r(
(HTTPS?)(/)(1[.][01])([ ]+) # http version
(\d{3})([ ]+) # status
([^\r\n]+)(\r?\n|$) # status message
)x do
- group Keyword; group Operator
- group Num; group Text
- group Num; group Text
- group Name::Exception; group Text
+ groups(
+ Keyword, Operator, Num, Text,
+ Num, Text,
+ Name::Exception, Text
+ )
push :headers
end
end
state :headers do
@@ -52,16 +55,14 @@
value = m[5]
if key.strip.downcase == 'content-type'
@content_type = value.split(';')[0].downcase
end
- group Name::Attribute; group Text
- group Punctuation; group Text
- group Str; group Text
+ groups Name::Attribute, Text, Punctuation, Text, Str, Text
end
rule /([^\r\n]+)(\r?\n|$)/ do
- group Str; group Text
+ groups Str, Text
end
rule /\r?\n/, Text, :content
end