##// END OF EJS Templates
Rails3: prevent double rendering file view and annotate on Rails 3.0.11 and Rails 3.1.3...
Toshi MARUYAMA -
r8868:b4630c03f732
parent child
Show More
@@ -355,6 +355,12 module ApplicationHelper
355 355 end
356 356 end
357 357
358 def syntax_highlight_lines(name, content)
359 lines = []
360 syntax_highlight(name, content).each_line { |line| lines << line }
361 lines
362 end
363
358 364 def syntax_highlight(name, content)
359 365 Redmine::SyntaxHighlighting.highlight_by_filename(content, name)
360 366 end
@@ -2,13 +2,13
2 2 <table class="filecontent syntaxhl">
3 3 <tbody>
4 4 <% line_num = 1 %>
5 <% syntax_highlight(filename, Redmine::CodesetUtil.to_utf8_by_setting(content)).each_line do |line| %>
5 <% syntax_highlight_lines(filename, Redmine::CodesetUtil.to_utf8_by_setting(content)).each do |line| %>
6 6 <tr>
7 7 <th class="line-num" id="L<%= line_num %>">
8 8 <a href="#L<%= line_num %>"><%= line_num %></a>
9 9 </th>
10 10 <td class="line-code">
11 <pre><%= line %></pre>
11 <pre><%= line.html_safe %></pre>
12 12 </td>
13 13 </tr>
14 14 <% line_num += 1 %>
@@ -14,14 +14,14
14 14 <table class="filecontent annotate syntaxhl">
15 15 <tbody>
16 16 <% line_num = 1 %>
17 <% syntax_highlight(@path, Redmine::CodesetUtil.to_utf8_by_setting(@annotate.content)).each_line do |line| %>
17 <% syntax_highlight_lines(@path, Redmine::CodesetUtil.to_utf8_by_setting(@annotate.content)).each do |line| %>
18 18 <% revision = @annotate.revisions[line_num - 1] %>
19 19 <tr class="bloc-<%= revision.nil? ? 0 : colors[revision.identifier || revision.revision] %>">
20 20 <th class="line-num" id="L<%= line_num %>"><a href="#L<%= line_num %>"><%= line_num %></a></th>
21 21 <td class="revision">
22 22 <%= (revision.identifier ? link_to_revision(revision, @repository) : format_revision(revision)) if revision %></td>
23 23 <td class="author"><%= h(revision.author.to_s.split('<').first) if revision %></td>
24 <td class="line-code"><pre><%= line %></pre></td>
24 <td class="line-code"><pre><%= line.html_safe %></pre></td>
25 25 </tr>
26 26 <% line_num += 1 %>
27 27 <% end %>
General Comments 0
You need to be logged in to leave comments. Login now