summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2013-07-20 11:17:30 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2013-07-20 11:20:37 +0200
commit59ca07b0d1a1710ab729636ea00de4b638f56110 (patch)
treefd43e8f195deea3172cd767a9bb57010cf8e2075
parent7493dcbfded42686169027a158c18c5312a3af24 (diff)
downloadcoderay-59ca07b0d1a1710ab729636ea00de4b638f56110.tar.gz
add Ruby 2 syntax: %i(…) and %I(…)
-rw-r--r--Changes.textile3
-rw-r--r--lib/coderay/scanners/ruby/patterns.rb5
-rw-r--r--lib/coderay/styles/alpha.rb2
3 files changed, 7 insertions, 3 deletions
diff --git a/Changes.textile b/Changes.textile
index 58427aa..f57faf5 100644
--- a/Changes.textile
+++ b/Changes.textile
@@ -10,6 +10,7 @@ h2. Changes in 1.1
* New scanner: Taskpaper [#39, thanks to shimomura]
* Diff scanner: Highlight inline changes in multi-line changes [#99]
* JavaScript scanner: Highlight multi-line comments in diff correctly
+* Ruby scanner: Accept %i and %I symbol lists (Ruby 2.0) [thanks to Nathan Youngman]
* Ruby scanner: Accept keywords as Ruby 1.9 hash keys [#126]
* HTML scanner displays style tags and attributes now [#145]
* Remove double-click toggle handler from HTML table output
@@ -22,7 +23,7 @@ h2. Changes in 1.1
* @CodeRay::TokenKinds@ should not be frozen [#130, thanks to Gavin Kistner]
* New token type @:id@ for CSS/Sass [#27]
* New token type @:done@ for Taskpaper [#39]
-* New token type @:map@ for Lua, introducing a nice nested-shades trick [#22, thanks to Quintus and nathany]
+* New token type @:map@ for Lua, introducing a nice nested-shades trick [#22, thanks to Quintus and Nathan Youngman]
* Display line numbers in HTML @:table@ mode even for single-line code (remove special case) [#41, thanks to Ariejan de Vroom]
* Override Bootstrap's @pre { word-break: break-all }@ styling for line numbers [#102, thanks to lightswitch05]
* Fixed @:docstring@ token type style
diff --git a/lib/coderay/scanners/ruby/patterns.rb b/lib/coderay/scanners/ruby/patterns.rb
index ed071d2..0b36e13 100644
--- a/lib/coderay/scanners/ruby/patterns.rb
+++ b/lib/coderay/scanners/ruby/patterns.rb
@@ -157,13 +157,16 @@ module Scanners
yield
])
- FANCY_STRING_START = / % ( [QqrsWwx] | (?![a-zA-Z0-9]) ) ([^a-zA-Z0-9]) /x
+ FANCY_STRING_START = / % ( [iIqQrswWx] | (?![a-zA-Z0-9]) ) ([^a-zA-Z0-9]) /x
FANCY_STRING_KIND = Hash.new(:string).merge({
+ 'i' => :symbol,
+ 'I' => :symbol,
'r' => :regexp,
's' => :symbol,
'x' => :shell,
})
FANCY_STRING_INTERPRETED = Hash.new(true).merge({
+ 'i' => false,
'q' => false,
's' => false,
'w' => false,
diff --git a/lib/coderay/styles/alpha.rb b/lib/coderay/styles/alpha.rb
index f4e9d7d..d304dc4 100644
--- a/lib/coderay/styles/alpha.rb
+++ b/lib/coderay/styles/alpha.rb
@@ -125,7 +125,7 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; }
.string .modifier { color: #E40 }
.symbol { color:#A60 }
.symbol .content { color:#A60 }
-.symbol .delimiter { color:#630 }
+.symbol .delimiter { color:#740 }
.tag { color:#070; font-weight:bold }
.type { color:#339; font-weight:bold }
.value { color: #088 }