linkable_line_numbers.patch

Alex U, 2009-02-25 01:56

Download (2.19 KB)

View differences:

app/views/repositories/annotate.rhtml (working copy)
11 11
    <% syntax_highlight(@path, to_utf8(@annotate.content)).each_line do |line| %>
12 12
    <% revision = @annotate.revisions[line_num-1] %>
13 13
    <tr class="bloc-<%= revision.nil? ? 0 : colors[revision.identifier || revision.revision] %>">
14
      <th class="line-num"><%= line_num %></th>
14
      <th class="line-num" id="L<%= line_num %>"><a href="#L<%= line_num %>" title="line #<%= line_num %>"><%= line_num %></a></th>
15 15
      <td class="revision">
16 16
      <%= (revision.identifier ? link_to(format_revision(revision.identifier), :action => 'revision', :id => @project, :rev => revision.identifier) : format_revision(revision.revision)) if revision %></td>
17 17
      <td class="author"><%= h(revision.author.to_s.split('<').first) if revision %></td>
app/views/common/_file.rhtml (working copy)
3 3
<tbody>
4 4
<% line_num = 1 %>
5 5
<% syntax_highlight(filename, to_utf8(content)).each_line do |line| %>
6
<tr><th class="line-num" id="L<%= line_num %>"><%= line_num %></th><td class="line-code"><pre><%= line %></pre></td></tr>
6
<tr><th class="line-num" id="L<%= line_num %>"><a href="#L<%= line_num %>" title="line #<%= line_num %>"><%= line_num %></a></th><td class="line-code"><pre><%= line %></pre></td></tr>
7 7
<% line_num += 1 %>
8 8
<% end %>
9 9
</tbody>
public/stylesheets/scm.css (working copy)
40 40
       padding-right: 3px;
41 41
       color: #999;
42 42
}
43
table.filecontent th.line-num a {
44
       text-decoration: none;
45
       color: inherit;
46
}
43 47
table.filecontent td.line-code pre {
44 48
    white-space: pre-wrap; /* CSS2.1 compliant */
45 49
    white-space: -moz-pre-wrap; /* Mozilla-based browsers */
46 50