diff options
-rw-r--r-- | Changes.textile | 2 | ||||
-rw-r--r-- | lib/coderay/scanners/css.rb | 4 | ||||
-rw-r--r-- | lib/coderay/scanners/sass.rb | 6 | ||||
-rw-r--r-- | lib/coderay/styles/alpha.rb | 1 |
4 files changed, 8 insertions, 5 deletions
diff --git a/Changes.textile b/Changes.textile index 0699654..9570a03 100644 --- a/Changes.textile +++ b/Changes.textile @@ -15,6 +15,8 @@ h2. Changes in 1.1 * @CodeRay::TokenKinds@ should not be frozen [#130, thanks to Gavin Kistner] * Override Bootstrap's pre word-break setting for line numbers [#102, thanks to lightswitch05] * Accept keywords as Ruby 1.9 hash keys [#126] +* New token type @:id@ for CSS/Sass [#27] +* CSS scanner uses @:id@ and @:tag@ now [#27] h2. Changes in 1.0.9 diff --git a/lib/coderay/scanners/css.rb b/lib/coderay/scanners/css.rb index 22c6bfc..732f9c5 100644 --- a/lib/coderay/scanners/css.rb +++ b/lib/coderay/scanners/css.rb @@ -10,7 +10,7 @@ module Scanners :class, :pseudo_class, :tag, :id, :directive, :key, :value, :operator, :color, :float, :string, - :error, :important, + :error, :important, :type, ] # :nodoc: module RE # :nodoc: @@ -99,7 +99,7 @@ module Scanners when :media_before_name if match = scan(RE::Ident) - encoder.text_token match, :tag + encoder.text_token match, :type states[-1] = :media_after_name next end diff --git a/lib/coderay/scanners/sass.rb b/lib/coderay/scanners/sass.rb index 0eb2caa..218ee57 100644 --- a/lib/coderay/scanners/sass.rb +++ b/lib/coderay/scanners/sass.rb @@ -38,16 +38,16 @@ module Scanners elsif case states.last when :initial, :media, :sass_inline if match = scan(/(?>#{RE::Ident})(?!\()/ox) - encoder.text_token match, value_expected ? :value : (check(/.*:/) ? :key : :type) + encoder.text_token match, value_expected ? :value : (check(/.*:/) ? :key : :tag) next elsif !value_expected && (match = scan(/\*/)) - encoder.text_token match, :type + encoder.text_token match, :tag next elsif match = scan(RE::Class) encoder.text_token match, :class next elsif match = scan(RE::Id) - encoder.text_token match, :constant + encoder.text_token match, :id next elsif match = scan(RE::PseudoClass) encoder.text_token match, :pseudo_class diff --git a/lib/coderay/styles/alpha.rb b/lib/coderay/styles/alpha.rb index 81bbe3b..a21fbf1 100644 --- a/lib/coderay/styles/alpha.rb +++ b/lib/coderay/styles/alpha.rb @@ -84,6 +84,7 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; } .function .delimiter { color:#024; font-weight:bold } .global-variable { color:#d70 } .hex { color:#02b } +.id { color:#33D; font-weight:bold } .imaginary { color:#f00 } .include { color:#B44; font-weight:bold } .inline { background-color: hsla(0,0%,0%,0.07); color: black } |