Project

General

Profile

Patch #1651 » scm_patch_pygmentize.diff

patch #2 - Youssef Abou-Kewik, 2008-07-25 22:17

View differences:

app/helpers/application_helper.rb (working copy)
122 122
    l(:actionview_datehelper_select_month_names).split(',')[month-1]
123 123
  end
124 124

  
125
  def escape_shell_arg(str)
126
    "'%s'" % str.to_s.gsub("'","'\\\\''")
127
  end
128

  
125 129
  def syntax_highlight(name, content)
126
    type = CodeRay::FileType[name]
127
    type ? CodeRay.scan(content, type).html : h(content)
130
    basename = `basename #{escape_shell_arg(name)}`
131
    `echo #{escape_shell_arg(content)} > /tmp/#{basename}`
132
    code = `pygmentize -f html -O encoding=utf8 /tmp/#{basename} 2>&1`
133
    `rm /tmp/#{basename}`
134
    "%s" % code
128 135
  end
129 136
  
130 137
  def to_path_param(path)
public/stylesheets/scm.css (working copy)
150 150
.CodeRay .ty { color:#339; font-weight:bold }
151 151
.CodeRay .v  { color:#036 }
152 152
.CodeRay .xt { color:#444 }
153

  
154
.c { color: #408080; font-style: italic } /* Comment */
155
.err { border: 1px solid #FF0000 } /* Error */
156
.k { color: #008000; font-weight: bold } /* Keyword */
157
.o { color: #666666 } /* Operator */
158
.cm { color: #408080; font-style: italic } /* Comment.Multiline */
159
.cp { color: #BC7A00 } /* Comment.Preproc */
160
.c1 { color: #408080; font-style: italic } /* Comment.Single */
161
.cs { color: #408080; font-style: italic } /* Comment.Special */
162
.gd { color: #A00000 } /* Generic.Deleted */
163
.ge { font-style: italic } /* Generic.Emph */
164
.gr { color: #FF0000 } /* Generic.Error */
165
.gh { color: #000080; font-weight: bold } /* Generic.Heading */
166
.gi { color: #00A000 } /* Generic.Inserted */
167
.go { color: #808080 } /* Generic.Output */
168
.gp { color: #000080; font-weight: bold } /* Generic.Prompt */
169
.gs { font-weight: bold } /* Generic.Strong */
170
.gu { color: #800080; font-weight: bold } /* Generic.Subheading */
171
.gt { color: #0040D0 } /* Generic.Traceback */
172
.kc { color: #008000; font-weight: bold } /* Keyword.Constant */
173
.kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
174
.kp { color: #008000 } /* Keyword.Pseudo */
175
.kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
176
.kt { color: #B00040 } /* Keyword.Type */
177
.m { color: #666666 } /* Literal.Number */
178
.s { color: #BA2121 } /* Literal.String */
179
.na { color: #7D9029 } /* Name.Attribute */
180
.nb { color: #008000 } /* Name.Builtin */
181
.nc { color: #0000FF; font-weight: bold } /* Name.Class */
182
.no { color: #880000 } /* Name.Constant */
183
.nd { color: #AA22FF } /* Name.Decorator */
184
.ni { color: #999999; font-weight: bold } /* Name.Entity */
185
.ne { color: #D2413A; font-weight: bold } /* Name.Exception */
186
.nf { color: #0000FF } /* Name.Function */
187
.nl { color: #A0A000 } /* Name.Label */
188
.nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
189
.nt { color: #008000; font-weight: bold } /* Name.Tag */
190
.nv { color: #19177C } /* Name.Variable */
191
.ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
192
.w { color: #bbbbbb } /* Text.Whitespace */
193
.mf { color: #666666 } /* Literal.Number.Float */
194
.mh { color: #666666 } /* Literal.Number.Hex */
195
.mi { color: #666666 } /* Literal.Number.Integer */
196
.mo { color: #666666 } /* Literal.Number.Oct */
197
.sb { color: #BA2121 } /* Literal.String.Backtick */
198
.sc { color: #BA2121 } /* Literal.String.Char */
199
.sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
200
.s2 { color: #BA2121 } /* Literal.String.Double */
201
.se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
202
.sh { color: #BA2121 } /* Literal.String.Heredoc */
203
.si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
204
.sx { color: #008000 } /* Literal.String.Other */
205
.sr { color: #BB6688 } /* Literal.String.Regex */
206
.s1 { color: #BA2121 } /* Literal.String.Single */
207
.ss { color: #19177C } /* Literal.String.Symbol */
208
.bp { color: #008000 } /* Name.Builtin.Pseudo */
209
.vc { color: #19177C } /* Name.Variable.Class */
210
.vg { color: #19177C } /* Name.Variable.Global */
211
.vi { color: #19177C } /* Name.Variable.Instance */
212
.il { color: #666666 } /* Literal.Number.Integer.Long */
(2-2/6)