diff options
author | murphy <murphy@rubychan.de> | 2010-04-14 23:07:17 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2010-04-14 23:07:17 +0000 |
commit | b9ce754961ea97dda8368f0a53d2113840b8f168 (patch) | |
tree | e10a931045d9df4f852c4e0105770079be851e7e /lib/coderay/scanners/css.rb | |
parent | fbfcd8d3dab8ee3310f8653113a0bbaae16e76f2 (diff) | |
download | coderay-b9ce754961ea97dda8368f0a53d2113840b8f168.tar.gz |
CSS Scanner: Adding support for CSS 3 functions and colors, changing highlighting of attrbiute selectors (closes #224).
Diffstat (limited to 'lib/coderay/scanners/css.rb')
-rw-r--r-- | lib/coderay/scanners/css.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/coderay/scanners/css.rb b/lib/coderay/scanners/css.rb index 1806d24..75cd056 100644 --- a/lib/coderay/scanners/css.rb +++ b/lib/coderay/scanners/css.rb @@ -41,7 +41,7 @@ module Scanners Dimension = /#{Num}#{Unit}/ Comment = %r! /\* (?: .*? \*/ | .* ) !mx - Function = /(?:url|alpha)\((?:[^)\n\r\f]|\\\))*\)?/ + Function = /(?:url|alpha|attr|counters?)\((?:[^)\n\r\f]|\\\))*\)?/ Id = /##{Name}/ Class = /\.#{Name}/ @@ -76,11 +76,9 @@ module Scanners kind = :pseudo_class elsif match = scan(RE::AttributeSelector) # TODO: Improve highlighting inside of attribute selectors. - tokens << [:open, :string] - tokens << [match[0,1], :delimiter] - tokens << [match[1..-2], :content] if match.size > 2 - tokens << [match[-1,1], :delimiter] if match[-1] == ?] - tokens << [:close, :string] + tokens << [match[0,1], :operator] + tokens << [match[1..-2], :attribute_name] if match.size > 2 + tokens << [match[-1,1], :operator] if match[-1] == ?] next elsif match = scan(/@media/) kind = :directive @@ -171,7 +169,7 @@ module Scanners elsif scan(/! *important/) kind = :important - elsif scan(/rgb\([^()\n]*\)?/) + elsif scan(/(?:rgb|hsl)a?\([^()\n]*\)?/) kind = :color elsif scan(/#{RE::AtKeyword}/o) |