Skip to content
Browse files

switch to coderay for highlighting

  • Loading branch information...
1 parent 38c0105 commit 2e3a3c6126dab4dc87a04159fac5760ed3fba82c @defunkt defunkt committed Mar 19, 2011
Showing with 11 additions and 2 deletions.
  1. +1 −0 Gemfile
  2. +2 −0 Gemfile.lock
  3. +2 −1 app/helpers/sinatra.rb
  4. +1 −0 app/libraries.rb
  5. +5 −1 public/css/pygment_trac.css
View
1 Gemfile
@@ -5,6 +5,7 @@ gem 'albino', '~>1.0'
gem 'yajl-ruby', '~>0.7.8'
gem 'mustache', '~>0.11.2'
gem 'curb', '~>0.7.8'
+gem 'coderay', '~>0.8.357'
gem 'sinatra_auth_github'
View
2 Gemfile.lock
@@ -3,6 +3,7 @@ GEM
specs:
addressable (2.2.2)
albino (1.0)
+ coderay (0.8.357)
curb (0.7.8)
faraday (0.4.6)
addressable (>= 2.1.1)
@@ -40,6 +41,7 @@ PLATFORMS
DEPENDENCIES
albino (~> 1.0)
+ coderay (~> 0.8.357)
curb (~> 0.7.8)
mustache (~> 0.11.2)
shotgun
View
3 app/helpers/sinatra.rb
@@ -11,7 +11,8 @@ def json(hash = {})
# colorize :js => '{ "blah": true }'
def colorize(hash = {})
- Albino.colorize(hash.values.first, hash.keys.first)
+ tokens = CodeRay.scan(hash.values.first, hash.keys.first)
+ tokens.html.div.sub('CodeRay', 'highlight')
end
# shell "cat", :stdin => "file.rb"
View
1 app/libraries.rb
@@ -16,6 +16,7 @@
require 'mustache/sinatra'
require 'sinatra/auth/github'
require 'albino'
+require 'coderay'
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__))
View
6 public/css/pygment_trac.css
@@ -1,10 +1,11 @@
/* .highlight { background: #ffffff; } */
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
-.highlight .k { font-weight: bold } /* Keyword */
+.highlight .kw { font-weight: bold } /* Keyword */
.highlight .o { font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
+.highlight .pp { color: #999999; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
@@ -35,17 +36,20 @@
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #000080 } /* Name.Tag */
+.highlight .ta { color: #000080 } /* Name.Tag */
.highlight .nv { color: #008080 } /* Name.Variable */
.highlight .ow { font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
+.highlight .i { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
.highlight .sc { color: #d14 } /* Literal.String.Char */
.highlight .sd { color: #d14 } /* Literal.String.Doc */
.highlight .s2 { color: #d14 } /* Literal.String.Double */
+.highlight .k { color: #d14 } /* Literal.String.Double */
.highlight .se { color: #d14 } /* Literal.String.Escape */
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
.highlight .si { color: #d14 } /* Literal.String.Interpol */

0 comments on commit 2e3a3c6

Please sign in to comment.
Something went wrong with that request. Please try again.