scm_patch_pygmentize2.diff

Anatolii Kucheruck, 2008-09-19 16:52

Download (4.28 KB)

View differences:

app/helpers/application_helper.rb (working copy)
128 128
    l(:actionview_datehelper_select_month_names).split(',')[month-1]
129 129
  end
130 130

  
131
  def escape_shell_arg(str)
132
    "'%s'" % str.to_s.gsub("'","'\\\\''")
133
  end
134

  
131 135
  def syntax_highlight(name, content)
132
    type = CodeRay::FileType[name]
133
    type ? CodeRay.scan(content, type).html : h(content)
136
    basename = `basename #{escape_shell_arg(name)}`
137
    `echo #{escape_shell_arg(content)} > /tmp/#{basename}`
138
    code = `pygmentize -f html -O encoding=utf8 /tmp/#{basename} 2>&1`
139
    if code.empty?
140
      code = `pygmentize -l text -f html -O encoding=utf8 /tmp/#{basename} 2>&1`
141
    end
142
    `rm /tmp/#{basename}`
143
    "%s" % code
134 144
  end
135 145
  
136 146
  def to_path_param(path)
public/stylesheets/scm.css (working copy)
178 178
.CodeRay .ty { color:#339; font-weight:bold }
179 179
.CodeRay .v  { color:#036 }
180 180
.CodeRay .xt { color:#444 }
181

  
182
.c { color: #408080; font-style: italic } /* Comment */
183
.err { border: 1px solid #FF0000 } /* Error */
184
.k { color: #008000; font-weight: bold } /* Keyword */
185
.o { color: #666666 } /* Operator */
186
.cm { color: #408080; font-style: italic } /* Comment.Multiline */
187
.cp { color: #BC7A00 } /* Comment.Preproc */
188
.c1 { color: #408080; font-style: italic } /* Comment.Single */
189
.cs { color: #408080; font-style: italic } /* Comment.Special */
190
.gd { color: #A00000 } /* Generic.Deleted */
191
.ge { font-style: italic } /* Generic.Emph */
192
.gr { color: #FF0000 } /* Generic.Error */
193
.gh { color: #000080; font-weight: bold } /* Generic.Heading */
194
.gi { color: #00A000 } /* Generic.Inserted */
195
.go { color: #808080 } /* Generic.Output */
196
.gp { color: #000080; font-weight: bold } /* Generic.Prompt */
197
.gs { font-weight: bold } /* Generic.Strong */
198
.gu { color: #800080; font-weight: bold } /* Generic.Subheading */
199
.gt { color: #0040D0 } /* Generic.Traceback */
200
.kc { color: #008000; font-weight: bold } /* Keyword.Constant */
201
.kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
202
.kp { color: #008000 } /* Keyword.Pseudo */
203
.kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
204
.kt { color: #B00040 } /* Keyword.Type */
205
.m { color: #666666 } /* Literal.Number */
206
.s { color: #BA2121 } /* Literal.String */
207
.na { color: #7D9029 } /* Name.Attribute */
208
.nb { color: #008000 } /* Name.Builtin */
209
.nc { color: #0000FF; font-weight: bold } /* Name.Class */
210
.no { color: #880000 } /* Name.Constant */
211
.nd { color: #AA22FF } /* Name.Decorator */
212
.ni { color: #999999; font-weight: bold } /* Name.Entity */
213
.ne { color: #D2413A; font-weight: bold } /* Name.Exception */
214
.nf { color: #0000FF } /* Name.Function */
215
.nl { color: #A0A000 } /* Name.Label */
216
.nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
217
.nt { color: #008000; font-weight: bold } /* Name.Tag */
218
.nv { color: #19177C } /* Name.Variable */
219
.ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
220
.w { color: #bbbbbb } /* Text.Whitespace */
221
.mf { color: #666666 } /* Literal.Number.Float */
222
.mh { color: #666666 } /* Literal.Number.Hex */
223
.mi { color: #666666 } /* Literal.Number.Integer */
224
.mo { color: #666666 } /* Literal.Number.Oct */
225
.sb { color: #BA2121 } /* Literal.String.Backtick */
226
.sc { color: #BA2121 } /* Literal.String.Char */
227
.sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
228
.s2 { color: #BA2121 } /* Literal.String.Double */
229
.se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
230
.sh { color: #BA2121 } /* Literal.String.Heredoc */
231
.si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
232
.sx { color: #008000 } /* Literal.String.Other */
233
.sr { color: #BB6688 } /* Literal.String.Regex */
234
.s1 { color: #BA2121 } /* Literal.String.Single */
235
.ss { color: #19177C } /* Literal.String.Symbol */
236
.bp { color: #008000 } /* Name.Builtin.Pseudo */
237
.vc { color: #19177C } /* Name.Variable.Class */
238
.vg { color: #19177C } /* Name.Variable.Global */
239
.vi { color: #19177C } /* Name.Variable.Instance */
240
.il { color: #666666 } /* Literal.Number.Integer.Long */