Defect #4710

syntax_highlight, wrong number of arguments (1 for 2) redering repositories/entry

Added by Zachary Crockett about 10 years ago. Updated over 9 years ago.

Status:ClosedStart date:2010-02-01
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Resolution:Invalid Affected version:

Description

Quick

Probably ruby 1.9 issue. Line 5 of app/views/common/_file.rhtml has

syntax_highlight(filename, to_utf8(content))

and line 283 of app/helpers/application_helper.rb has
def syntax_highlight(name, content)
  type = CodeRay::FileType[name]
  type ? CodeRay.scan(content, type).html : h(content)
end

Looks like 2 args to me. (shrug) Getting interpreted as a hash?

Environment

Redmine version r3358
Ruby version 1.9.1 (x86_64-linux)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root /srv/http/nginx/redmine
Environment production
Database adapter mysql
Database schema version 20091227112908
mysql Ver 14.14 Distrib 5.1.41, for unknown-linux-gnu (x86_64) using readline 6.0
svn, version 1.6.6 (r40053) compiled Nov 24 2009, 02:01:26

Trace

Processing RepositoriesController#entry (for 68.168.165.208 at 2010-02-01 14:57:00) [GET]
  Parameters: {"controller"=>"repositories", "id"=>"energy-star", "rev"=>"63", "action"=>"entry", "path"=>["branches", "scraper2", "SearchSpec.java"]}
Rendering template within layouts/base
Rendering repositories/entry

ActionView::TemplateError (wrong number of arguments (1 for 2)) on line # 5 of app/views/common/_file.rhtml:
2: <table class="filecontent CodeRay">
3: <tbody>
4: <% line_num = 1 %>
5: <% syntax_highlight(filename, to_utf8(content)).each_line do |line| %>
6: <tr><th class="line-num" id="L<%= line_num %>"><a href="#L<%= line_num %>"><%= line_num %></a></th><td class="line-code"><pre><%= line %></pre></td></tr>
7: <% line_num += 1 %>
8: <% end %>

    app/helpers/application_helper.rb:283:in `syntax_highlight'
    app/views/common/_file.rhtml:5:in `_run_rhtml_app47views47common47_file46rhtml_locals_content_file_filename_object'
    app/views/repositories/entry.rhtml:11:in `_run_rhtml_app47views47repositories47entry46rhtml'
    <internal:prelude>:8:in `synchronize'
    thin (1.2.5) lib/thin/connection.rb:76:in `block in pre_process'
    thin (1.2.5) lib/thin/connection.rb:74:in `catch'
    thin (1.2.5) lib/thin/connection.rb:74:in `pre_process'
    thin (1.2.5) lib/thin/connection.rb:57:in `process'
    thin (1.2.5) lib/thin/connection.rb:42:in `receive_data'
    eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
    eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
    thin (1.2.5) lib/thin/backends/base.rb:57:in `start'
    thin (1.2.5) lib/thin/server.rb:156:in `start'
    thin (1.2.5) lib/thin/controllers/controller.rb:80:in `start'
    thin (1.2.5) lib/thin/runner.rb:177:in `run_command'
    thin (1.2.5) lib/thin/runner.rb:143:in `run!'
    thin (1.2.5) bin/thin:6:in `<top (required)>'
    /usr/bin/thin:19:in `load'
    /usr/bin/thin:19:in `<main>'

Rendering /srv/http/nginx/redmine/public/500.html (500 Internal Server Error)

History

#1 Updated by Brad Rushworth over 9 years ago

  • Status changed from New to Resolved

Probably ruby 1.9 issue

Ruby 1.9 is not supported yet. You have to use Ruby 1.8.x as stated above.

#2 Updated by Felix Schäfer over 9 years ago

  • Status changed from Resolved to Closed
  • Resolution set to Invalid

Also available in: Atom PDF