Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Issue #93: Right-justify line numbers #94

Merged
merged 1 commit into from

2 participants

@wapcaplet

This commit causes the line numbers in HTML source listings to be
right-justified, allowing the code indentation to appear more
consistent.

@wapcaplet wapcaplet Issue #93: Right-justify line numbers
This commit causes the line numbers in HTML source listings to be
right-justified, allowing the code indentation to appear more
consistent.
3d1eca6
@abedra
Owner

could you please post a screenshot of this with an example of the output?

@wapcaplet

Here's a screenshot of the resulting coverage report:
Right-justified line numbers
As for example output, are you referring to the HTML itself? Here's a snippet of that:

<tr class="inferred">
  <td><pre><a name="line8">  8</a> </pre></td>
</tr>
<tr class="inferred">
  <td><pre><a name="line9">  9</a>     # Convert the given locator to a format accepted by Selenium. If `locator`</pre></td>
</tr>
<tr class="inferred">
  <td><pre><a name="line10"> 10</a>     # starts with `id=`, `name=`, `dom=`, `xpath=` `link=` or `css=`, then the</pre></td>
</tr>
@abedra abedra merged commit 66a5bf5 into relevance:master
@abedra
Owner

Thanks!

@wapcaplet

You're quite welcome :-) Thanks for merging it so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 9, 2012
  1. @wapcaplet

    Issue #93: Right-justify line numbers

    wapcaplet authored
    This commit causes the line numbers in HTML source listings to be
    right-justified, allowing the code indentation to appear more
    consistent.
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/rcov/templates/detail.html.erb
View
7 lib/rcov/templates/detail.html.erb
@@ -39,9 +39,9 @@
</tbody>
</table>
</div>
-
+
<h3>Key</h3>
-
+
<div class="key"><pre><span class='marked'>Code reported as executed by Ruby looks like this...</span><span class='marked1'>and this: this line is also marked as covered.</span><span class='inferred'>Lines considered as run by rcov, but not reported by Ruby, look like this,</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics).</span><span class='uncovered'>Finally, here's a line marked as not executed.</span></pre></div>
<h3>Coverage Details</h3>
@@ -51,8 +51,9 @@
<% fileinfo.num_lines.times do |i| %>
<% line = fileinfo.lines[i].chomp %>
<% count = fileinfo.counts[i] %>
+ <% width = fileinfo.num_lines.to_s.length %>
<tr class="<%= line_css(i) %>">
- <td><pre><a name="line<%= i.next %>"><%= i.next %></a> <%= CGI::escapeHTML(line) %></pre></td>
+ <td><pre><a name="line<%= i.next %>"><%= i.next.to_s.rjust(width) %></a> <%= CGI::escapeHTML(line) %></pre></td>
</tr>
<% end %>
</tbody>
Something went wrong with that request. Please try again.