Index: test/fixtures/diffs/subversion.diff =================================================================== --- test/fixtures/diffs/subversion.diff (revision 2601) +++ test/fixtures/diffs/subversion.diff (working copy) @@ -22,7 +22,7 @@ +<% diff.each do |table_file| -%>
<% if diff_type == 'sbs' -%> - +
@@ -62,3 +63,5 @@ Index: app/helpers/application_helper.rb =================================================================== --- app/helpers/application_helper.rb (revision 2601) +++ app/helpers/application_helper.rb (working copy) @@ -188,9 +188,19 @@ l(:actionview_datehelper_select_month_names).split(',')[month-1] end +# def syntax_highlight(name, content) +# type = CodeRay::FileType[name] +# type ? CodeRay.scan(content, type).html : h(content) +# end + def syntax_highlight(name, content) - type = CodeRay::FileType[name] - type ? CodeRay.scan(content, type).html : h(content) + f = IO.popen("pygmentize -N " + name, 'r') + lexer = f.read[0...-1] # removes trailing newline + + f = IO.popen("pygmentize -f html -l " + lexer, 'w+') + f.write(content) + f.close_write + return f.read[28...-13]# removes surrounding div and pre as well as trailing newline end def to_path_param(path) Index: app/views/repositories/diff.rhtml =================================================================== --- app/views/repositories/diff.rhtml (revision 2601) +++ app/views/repositories/diff.rhtml (working copy) @@ -15,7 +15,9 @@ <%= render :partial => 'common/diff', :locals => {:diff => @diff, :diff_type => @diff_type} %> <% end -%> -

+#

+#

+

<%= l(:label_export_to) %> <%= link_to 'Unified diff', params.merge(:format => 'diff') %>

Index: app/views/repositories/annotate.rhtml =================================================================== --- app/views/repositories/annotate.rhtml (revision 2601) +++ app/views/repositories/annotate.rhtml (working copy) @@ -5,7 +5,7 @@ <% colors = Hash.new {|k,v| k[v] = (k.size % 12) } %>
-
+
<% line_num = 1 %> <% syntax_highlight(@path, to_utf8(@annotate.content)).each_line do |line| %> Index: app/views/common/_file.rhtml =================================================================== --- app/views/common/_file.rhtml (revision 2601) +++ app/views/common/_file.rhtml (working copy) @@ -1,5 +1,5 @@
-
+
<% line_num = 1 %> <% syntax_highlight(filename, to_utf8(content)).each_line do |line| %> Index: app/views/common/_diff.rhtml =================================================================== --- app/views/common/_diff.rhtml (revision 2601) +++ app/views/common/_diff.rhtml (working copy) @@ -2,7 +2,7 @@ <% diff.each do |table_file| -%>
<% if diff_type == 'sbs' -%> -
+
@@ -29,7 +29,7 @@
<%= table_file.file_name %>
<% else -%> - +
Index: app/views/wiki/annotate.rhtml =================================================================== --- app/views/wiki/annotate.rhtml (revision 2601) +++ app/views/wiki/annotate.rhtml (working copy) @@ -12,7 +12,7 @@ <% colors = Hash.new {|k,v| k[v] = (k.size % 12) } %> -
<%= table_file.file_name %>
+
<% line_num = 1 %> <% @annotate.lines.each do |line| -%> Index: config/environment.rb =================================================================== --- config/environment.rb (revision 2601) +++ config/environment.rb (working copy) @@ -2,7 +2,7 @@ # Uncomment below to force Rails into production mode when # you don't control web/app server and can't set it the proper way -# ENV['RAILS_ENV'] ||= 'production' +ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.1.2' unless defined? RAILS_GEM_VERSION @@ -54,4 +54,6 @@ # Define your email configuration in email.yml instead. # It will automatically turn deliveries on config.action_mailer.perform_deliveries = false + + config.action_mailer.raise_delivery_errors = true end Index: lib/redmine/wiki_formatting/textile/formatter.rb =================================================================== --- lib/redmine/wiki_formatting/textile/formatter.rb (revision 2601) +++ lib/redmine/wiki_formatting/textile/formatter.rb (working copy) @@ -17,6 +17,7 @@ require 'redcloth3' require 'coderay' +require 'cgi' module Redmine module WikiFormatting @@ -30,7 +31,7 @@ super self.hard_breaks=true self.no_span_caps=true - self.filter_styles=true + self.filter_styles=false end def to_html(*rules, &block) @@ -46,16 +47,37 @@ def hard_break( text ) text.gsub!( /(.)\n(?!\n|\Z|>| *(>? *[#*=]+(\s|$)|[{|]))/, "\\1
\n" ) if hard_breaks end - + + def syntax_highlight(name, content) + #f = IO.popen("pygmentize -N " + name, 'r') + #lexer = f.read[0...-1] # removes trailing newline + #name = "text" + content.gsub!("x%x%", "&") + content = CGI.unescapeHTML(content) + #content = "nglString& rString;" + ff = File.new("/var/www/redmine/log/bleh.log", 'w+') + ff.write(content) + ff.close + f = IO.popen("pygmentize -f html -l " + name , 'w+') + f.write(content) + f.close_write + return f.read[28...-13]# removes surrounding div and pre as well as trailing newline + end + # Patch to add code highlighting support to RedCloth def smooth_offtags( text ) unless @pre_list.empty? ## replace
 content
             text.gsub!(//) do
               content = @pre_list[$1.to_i]
+              #if content.match(/\s?(.+)/m)
+              #  content = "" + 
+              #    CodeRay.scan($2, $1.downcase).html(:escape => false, :line_numbers => :inline)
+              #end
               if content.match(/\s?(.+)/m)
-                content = "" + 
-                  CodeRay.scan($2, $1.downcase).html(:escape => false, :line_numbers => :inline)
+                content = "" +
+                  syntax_highlight($1.downcase, $2)
+                #content = $2
               end
               content
             end
Index: public/stylesheets/scm.css
===================================================================
--- public/stylesheets/scm.css	(revision 2601)
+++ public/stylesheets/scm.css	(working copy)
@@ -178,3 +178,67 @@
 .CodeRay .ty { color:#339; font-weight:bold }
 .CodeRay .v  { color:#036 }
 .CodeRay .xt { color:#444 }
+.Pygments .hll { background-color: #ffffcc }
+.Pygments  { background: #ffffff; }
+.Pygments .c { color: #808080 } /* Comment */
+.Pygments .err { color: #F00000; background-color: #F0A0A0 } /* Error */
+.Pygments .k { color: #008000; font-weight: bold } /* Keyword */
+.Pygments .o { color: #303030 } /* Operator */
+.Pygments .cm { color: #e08080 } /* Comment.Multiline */
+.Pygments .cp { color: #507090 } /* Comment.Preproc */
+.Pygments .c1 { color: #e08080 } /* Comment.Single */
+.Pygments .cs { color: #cc0000; font-weight: bold } /* Comment.Special */
+.Pygments .gd { color: #A00000 } /* Generic.Deleted */
+.Pygments .ge { font-style: italic } /* Generic.Emph */
+.Pygments .gr { color: #FF0000 } /* Generic.Error */
+.Pygments .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.Pygments .gi { color: #00A000 } /* Generic.Inserted */
+.Pygments .go { color: #808080 } /* Generic.Output */
+.Pygments .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
+.Pygments .gs { font-weight: bold } /* Generic.Strong */
+.Pygments .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.Pygments .gt { color: #0040D0 } /* Generic.Traceback */
+.Pygments .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
+.Pygments .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
+.Pygments .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
+.Pygments .kp { color: #003080; font-weight: bold } /* Keyword.Pseudo */
+.Pygments .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
+.Pygments .kt { color: #303090; font-weight: bold } /* Keyword.Type */
+.Pygments .m { color: #6000E0; font-weight: bold } /* Literal.Number */
+.Pygments .s { background-color: #fff0f0 } /* Literal.String */
+.Pygments .na { color: #0000C0 } /* Name.Attribute */
+.Pygments .nb { color: #007020 } /* Name.Builtin */
+.Pygments .nc { color: #B00060; font-weight: bold } /* Name.Class */
+.Pygments .no { color: #003060; font-weight: bold } /* Name.Constant */
+.Pygments .nd { color: #505050; font-weight: bold } /* Name.Decorator */
+.Pygments .ni { color: #800000; font-weight: bold } /* Name.Entity */
+.Pygments .ne { color: #F00000; font-weight: bold } /* Name.Exception */
+.Pygments .nf { color: #0060B0; font-weight: bold } /* Name.Function */
+.Pygments .nl { color: #907000; font-weight: bold } /* Name.Label */
+.Pygments .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
+.Pygments .nt { color: #007000 } /* Name.Tag */
+.Pygments .nv { color: #906030 } /* Name.Variable */
+.Pygments .ow { color: #000000; font-weight: bold } /* Operator.Word */
+.Pygments .w { color: #bbbbbb } /* Text.Whitespace */
+.Pygments .mf { color: #6000E0; font-weight: bold } /* Literal.Number.Float */
+.Pygments .mh { color: #005080; font-weight: bold } /* Literal.Number.Hex */
+.Pygments .mi { color: #0000D0; font-weight: bold } /* Literal.Number.Integer */
+.Pygments .mo { color: #4000E0; font-weight: bold } /* Literal.Number.Oct */
+.Pygments .sb { background-color: #fff0f0 } /* Literal.String.Backtick */
+.Pygments .sc { color: #0040D0 } /* Literal.String.Char */
+.Pygments .sd { color: #D04020 } /* Literal.String.Doc */
+.Pygments .s2 { background-color: #fff0f0 } /* Literal.String.Double */
+.Pygments .se { color: #606060; font-weight: bold; background-color: #fff0f0 } /* Literal.String.Escape */
+.Pygments .sh { background-color: #fff0f0 } /* Literal.String.Heredoc */
+.Pygments .si { background-color: #e0e0e0 } /* Literal.String.Interpol */
+.Pygments .sx { color: #D02000; background-color: #fff0f0 } /* Literal.String.Other */
+.Pygments .sr { color: #000000; background-color: #fff0ff } /* Literal.String.Regex */
+.Pygments .s1 { background-color: #fff0f0 } /* Literal.String.Single */
+.Pygments .ss { color: #A06000 } /* Literal.String.Symbol */
+.Pygments .bp { color: #007020 } /* Name.Builtin.Pseudo */
+.Pygments .vc { color: #306090 } /* Name.Variable.Class */
+.Pygments .vg { color: #d07000; font-weight: bold } /* Name.Variable.Global */
+.Pygments .vi { color: #3030B0 } /* Name.Variable.Instance */
+.Pygments .il { color: #0000D0; font-weight: bold } /* Literal.Number.Integer.Long */
+
+.Pygments pre { margin: 0px; }
Index: public/stylesheets/application.css
===================================================================
--- public/stylesheets/application.css	(revision 2601)
+++ public/stylesheets/application.css	(working copy)
@@ -477,6 +477,43 @@
     overflow-x: auto;
 }
 
+div.wiki pre.nui 
+{
+  border: none;
+  overflow-x: auto;
+  //color: rgb(36,90,175);
+  color: #666666;
+  width: 95%;
+  background-color: #ffffff;
+  margin-left: 20pt;
+  margin-bottom: -22pt;
+}
+
+div.wiki pre.nuiSimple
+{
+  border: none;
+  overflow-x: auto;
+  //color: rgb(36,90,175);
+  color: #666666;
+  width: 95%;
+  background-color: #ffffff;
+  margin-left: 20pt;
+}
+
+
+div.wiki pre.nuiComment
+{
+  border: none;
+  overflow-x: auto;
+  color: rgb(179,65,65);
+  width: 95%;
+  background-color: #ffffff;
+  margin-bottom:-23pt;
+  margin-left: 20pt;
+}
+
+
+
 div.wiki ul.toc {
     background-color: #ffffdd;
     border: 1px solid #e4e4e4;
@@ -680,3 +717,71 @@
   #main { background: #fff; }
   #content { width: 99%; margin: 0; padding: 0; border: 0; background: #fff; overflow: visible !important;}
 }
+
+
+/***** Pygments ***********/
+.Pygments .hll { background-color: #ffffcc }
+.Pygments  { background: #ffffff; }
+.Pygments .c { color: #808080 } /* Comment */
+.Pygments .err { color: #F00000; background-color: #F0A0A0 } /* Error */
+.Pygments .k { color: #008000; font-weight: bold } /* Keyword */
+.Pygments .o { color: #303030 } /* Operator */
+.Pygments .cm { color: #e08080 } /* Comment.Multiline */
+.Pygments .cp { color: #507090 } /* Comment.Preproc */
+.Pygments .c1 { color: #e08080 } /* Comment.Single */
+.Pygments .cs { color: #cc0000; font-weight: bold } /* Comment.Special */
+.Pygments .gd { color: #A00000 } /* Generic.Deleted */
+.Pygments .ge { font-style: italic } /* Generic.Emph */
+.Pygments .gr { color: #FF0000 } /* Generic.Error */
+.Pygments .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.Pygments .gi { color: #00A000 } /* Generic.Inserted */
+.Pygments .go { color: #808080 } /* Generic.Output */
+.Pygments .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
+.Pygments .gs { font-weight: bold } /* Generic.Strong */
+.Pygments .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.Pygments .gt { color: #0040D0 } /* Generic.Traceback */
+.Pygments .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
+.Pygments .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
+.Pygments .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
+.Pygments .kp { color: #003080; font-weight: bold } /* Keyword.Pseudo */
+.Pygments .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
+.Pygments .kt { color: #303090; font-weight: bold } /* Keyword.Type */
+.Pygments .m { color: #6000E0; font-weight: bold } /* Literal.Number */
+.Pygments .s { background-color: #fff0f0 } /* Literal.String */
+.Pygments .na { color: #0000C0 } /* Name.Attribute */
+.Pygments .nb { color: #007020 } /* Name.Builtin */
+.Pygments .nc { color: #B00060; font-weight: bold } /* Name.Class */
+.Pygments .no { color: #003060; font-weight: bold } /* Name.Constant */
+.Pygments .nd { color: #505050; font-weight: bold } /* Name.Decorator */
+.Pygments .ni { color: #800000; font-weight: bold } /* Name.Entity */
+.Pygments .ne { color: #F00000; font-weight: bold } /* Name.Exception */
+.Pygments .nf { color: #0060B0; font-weight: bold } /* Name.Function */
+.Pygments .nl { color: #907000; font-weight: bold } /* Name.Label */
+.Pygments .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
+.Pygments .nt { color: #007000 } /* Name.Tag */
+.Pygments .nv { color: #906030 } /* Name.Variable */
+.Pygments .ow { color: #000000; font-weight: bold } /* Operator.Word */
+.Pygments .w { color: #bbbbbb } /* Text.Whitespace */
+.Pygments .mf { color: #6000E0; font-weight: bold } /* Literal.Number.Float */
+.Pygments .mh { color: #005080; font-weight: bold } /* Literal.Number.Hex */
+.Pygments .mi { color: #0000D0; font-weight: bold } /* Literal.Number.Integer */
+.Pygments .mo { color: #4000E0; font-weight: bold } /* Literal.Number.Oct */
+.Pygments .sb { background-color: #fff0f0 } /* Literal.String.Backtick */
+.Pygments .sc { color: #0040D0 } /* Literal.String.Char */
+.Pygments .sd { color: #D04020 } /* Literal.String.Doc */
+.Pygments .s2 { background-color: #fff0f0 } /* Literal.String.Double */
+.Pygments .se { color: #606060; font-weight: bold; background-color: #fff0f0 } /* Literal.String.Escape */
+.Pygments .sh { background-color: #fff0f0 } /* Literal.String.Heredoc */
+.Pygments .si { background-color: #e0e0e0 } /* Literal.String.Interpol */
+.Pygments .sx { color: #D02000; background-color: #fff0f0 } /* Literal.String.Other */
+.Pygments .sr { color: #000000; background-color: #fff0ff } /* Literal.String.Regex */
+.Pygments .s1 { background-color: #fff0f0 } /* Literal.String.Single */
+.Pygments .ss { color: #A06000 } /* Literal.String.Symbol */
+.Pygments .bp { color: #007020 } /* Name.Builtin.Pseudo */
+.Pygments .vc { color: #306090 } /* Name.Variable.Class */
+.Pygments .vg { color: #d07000; font-weight: bold } /* Name.Variable.Global */
+.Pygments .vi { color: #3030B0 } /* Name.Variable.Instance */
+.Pygments .il { color: #0000D0; font-weight: bold } /* Literal.Number.Integer.Long */
+
+.Pygments pre { margin: 0px; }
+