From b9cf7f67d869eead647e237d963ba2db2fdfbc4f Mon Sep 17 00:00:00 2001 From: Joel Holdbrooks Date: Tue, 3 Jul 2012 18:17:56 -0700 Subject: [PATCH 1/3] add "id" token kind --- lib/coderay/token_kinds.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/coderay/token_kinds.rb b/lib/coderay/token_kinds.rb index 3b8d07e4..41a89e4f 100755 --- a/lib/coderay/token_kinds.rb +++ b/lib/coderay/token_kinds.rb @@ -39,6 +39,7 @@ module CodeRay :function => 'function', :global_variable => 'global-variable', :hex => 'hex', + :id => 'id', :imaginary => 'imaginary', :important => 'important', :include => 'include', From e796a247e5bf2395ec72b0ae98d68bcb648f5368 Mon Sep 17 00:00:00 2001 From: Joel Holdbrooks Date: Tue, 3 Jul 2012 18:19:05 -0700 Subject: [PATCH 2/3] use "id" instead of "constant" for css ids --- etc/todo/scanners/css.rb | 2 +- lib/coderay/scanners/css.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/todo/scanners/css.rb b/etc/todo/scanners/css.rb index f1072f13..e9281c7a 100644 --- a/etc/todo/scanners/css.rb +++ b/etc/todo/scanners/css.rb @@ -114,7 +114,7 @@ def scan_tokens tokens, options kind = :class elsif scan RE::Id - kind = :constant + kind = :id elsif scan RE::Ident kind = :label diff --git a/lib/coderay/scanners/css.rb b/lib/coderay/scanners/css.rb index 7b731efc..c4735749 100644 --- a/lib/coderay/scanners/css.rb +++ b/lib/coderay/scanners/css.rb @@ -8,7 +8,7 @@ class CSS < Scanner KINDS_NOT_LOC = [ :comment, :class, :pseudo_class, :type, - :constant, :directive, + :id, :directive, :key, :value, :operator, :color, :float, :string, :error, :important, ] # :nodoc: @@ -73,7 +73,7 @@ def scan_tokens encoder, options 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 From 4eb4324c6fb20b9b5e7f73f17bc21e4a17fd3073 Mon Sep 17 00:00:00 2001 From: Joel Holdbrooks Date: Tue, 24 Jul 2012 10:59:50 -0700 Subject: [PATCH 3/3] use :tag instead of :type for identifiers --- lib/coderay/scanners/css.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/coderay/scanners/css.rb b/lib/coderay/scanners/css.rb index c4735749..503e14ec 100644 --- a/lib/coderay/scanners/css.rb +++ b/lib/coderay/scanners/css.rb @@ -7,7 +7,7 @@ class CSS < Scanner KINDS_NOT_LOC = [ :comment, - :class, :pseudo_class, :type, + :class, :pseudo_class, :tag, :id, :directive, :key, :value, :operator, :color, :float, :string, :error, :important, @@ -67,7 +67,7 @@ def scan_tokens encoder, options elsif case states.last when :initial, :media if match = scan(/(?>#{RE::Ident})(?!\()|\*/ox) - encoder.text_token match, :type + encoder.text_token match, :tag next elsif match = scan(RE::Class) encoder.text_token match, :class @@ -102,7 +102,7 @@ def scan_tokens encoder, options when :media_before_name if match = scan(RE::Ident) - encoder.text_token match, :type + encoder.text_token match, :tag states[-1] = :media_after_name next end