lib/rouge/lexers/css.rb in rouge-0.0.5 vs lib/rouge/lexers/css.rb in rouge-0.0.6
- old
+ new
@@ -62,11 +62,11 @@
table-row-group text text-bottom text-top thick thin
transparent ultra-condensed ultra-expanded underline
upper-alpha upper-latin upper-roman uppercase url
visible w-resize wait wider x-fast x-high x-large x-loud
x-low x-small x-soft xx-large xx-small yes
- ).join('|')
+ )
builtins = %w(
indigo gold firebrick indianred yellow darkolivegreen
darkseagreen mediumvioletred mediumorchid chartreuse
mediumslateblue black springgreen crimson lightsalmon brown
@@ -90,11 +90,11 @@
dimgray powderblue seagreen snow mediumblue midnightblue
paleturquoise palegoldenrod whitesmoke darkorchid salmon
lightslategray lawngreen lightgreen tomato hotpink
lightyellow lavenderblush linen mediumaquamarine green
blueviolet peachpuff
- ).join('|')
+ )
state :root do
mixin :basics
rule /{/, 'Punctuation', :stanza
rule /:#{identifier}/, 'Name.Decorator'
@@ -146,12 +146,20 @@
end
state :stanza do
mixin :basics
rule /}/, 'Punctuation', :pop!
- rule /(?:#{keywords})\s*:/m, 'Keyword', :stanza_value
- rule /(?:#{builtins})\s*:/m, 'Name.Builtin', :stanza_value
- rule /#{identifier}\s*:/m, 'Name', :stanza_value
+ rule /(#{identifier}\s*):/m do |m|
+ if keywords.include? m[1]
+ token 'Keyword'
+ elsif builtins.include? m[1]
+ token 'Name.Builtin'
+ else
+ token 'Name'
+ end
+
+ push :stanza_value
+ end
end
state :stanza_value do
rule /;/, 'Punctuation', :pop!
rule(/(?=})/) { pop! }