Skip to content

Commit

Permalink
switch to coderay for highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Mar 20, 2011
1 parent 38c0105 commit 2e3a3c6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -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'

Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Expand Up @@ -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)
Expand Down Expand Up @@ -40,6 +41,7 @@ PLATFORMS

DEPENDENCIES
albino (~> 1.0)
coderay (~> 0.8.357)
curb (~> 0.7.8)
mustache (~> 0.11.2)
shotgun
Expand Down
3 changes: 2 additions & 1 deletion app/helpers/sinatra.rb
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions app/libraries.rb
Expand Up @@ -16,6 +16,7 @@
require 'mustache/sinatra'
require 'sinatra/auth/github'
require 'albino'
require 'coderay'

$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__))

Expand Down
6 changes: 5 additions & 1 deletion 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 */
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 2e3a3c6

Please sign in to comment.