Skip to content

Commit bcbdf41

Browse files
committed
Source code without tables
1 parent f1505af commit bcbdf41

File tree

3 files changed

+154
-142
lines changed

3 files changed

+154
-142
lines changed

coverage/htmlfiles/coverage_html.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ coverage.index_ready = function ($) {
231231
coverage.pyfile_ready = function ($) {
232232
// If we're directed to a particular line number, highlight the line.
233233
var frag = location.hash;
234-
if (frag.length > 2 && frag[1] === 'n') {
234+
if (frag.length > 2 && frag[1] === 't') {
235235
$(frag).addClass('highlight');
236236
coverage.set_sel(parseInt(frag.substr(2), 10));
237237
}
@@ -512,7 +512,7 @@ coverage.finish_scrolling = function () {
512512
coverage.init_scroll_markers = function () {
513513
var c = coverage;
514514
// Init some variables
515-
c.lines_len = $('td.text p').length;
515+
c.lines_len = $('#source p').length;
516516
c.body_h = $('body').height();
517517
c.header_h = $('div#header').height();
518518

@@ -526,7 +526,7 @@ coverage.build_scroll_markers = function () {
526526
max_line_height = 10,
527527
visible_window_h = $(window).height();
528528

529-
c.lines_to_mark = $('td.text').find('p.show_run, p.show_mis, p.show_exc, p.show_par');
529+
c.lines_to_mark = $('#source').find('p.show_run, p.show_mis, p.show_exc, p.show_exc, p.show_par');
530530
$('#scroll_marker').remove();
531531
// Don't build markers if the window has no scroll bar.
532532
if (c.body_h <= visible_window_h) {

coverage/htmlfiles/pyfile.html

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -68,45 +68,26 @@ <h2 class="stats">
6868
</div>
6969

7070
<div id="source">
71-
<table>
72-
<tr>
73-
<td class="linenos">
74-
{% for line in lines -%}
75-
<p id="n{{line.number}}" class="{{line.css_class}}"><a href="#n{{line.number}}">{{line.number}}</a></p>
76-
{% endfor %}
77-
</td>
78-
<td class="text">
79-
{# These are the source lines, which are very sensitive to whitespace. -#}
80-
{# The `{ # - # }` below are comments which slurp up the following space. -#}
81-
{% for line in lines -%}
82-
<p id="t{{line.number}}" class="{{line.css_class}}">{#-#}
83-
{% if line.annotate -%}
84-
<span class="annotate short">{{line.annotate}}</span>{#-#}
85-
<span class="annotate long">{{line.annotate_long}}</span>{#-#}
86-
{% endif -%}
87-
{{line.html}}<span class="strut">&nbsp;</span>{#-#}
88-
</p>
89-
{% endfor %}
90-
</td>
91-
{% if show_contexts -%}
92-
<td class="contexts">
93-
{% for line in lines -%}
94-
<p>{#-#}
95-
{% if line.contexts -%}
96-
<span class="context-button">{{ line.contexts|len }} ctx</span>{#-#}
97-
<span class="context-list">
98-
{% for context in line.contexts -%}
99-
<span class="context-line">{{context}}</span>{#-#}
100-
{% endfor -%}
101-
</span>{#-#}
102-
{% endif -%}
103-
&nbsp;
104-
</p>{#-#}
105-
{% endfor %}
106-
</td>
107-
{% endif %}
108-
</tr>
109-
</table>
71+
{# These are the source lines, which are very sensitive to whitespace. -#}
72+
{# The `{ # - # }` below are comments which slurp up the following space. -#}
73+
{% for line in lines -%}
74+
<p id="t{{line.number}}" class="{{line.css_class}}">{#-#}
75+
<span class="n"><a href="#t{{line.number}}">{{line.number}}</a></span>{#-#}
76+
<span class="t">{{line.html}}&nbsp;</span>{#-#}
77+
{% if line.annotate -%}
78+
<span class="annotate short">{{line.annotate}}</span>{#-#}
79+
<span class="annotate long">{{line.annotate_long}}</span>{#-#}
80+
{% endif -%}
81+
{% if line.contexts -%}
82+
<span class="context-button">{{ line.contexts|len }} ctx</span>{#-#}
83+
<span class="context-list">
84+
{% for context in line.contexts -%}
85+
<span class="context-line">{{context}}</span>{#-#}
86+
{% endfor -%}
87+
</span>{#-#}
88+
{% endif -%}
89+
</p>
90+
{% endfor %}
11091
</div>
11192

11293
<div id="footer">

coverage/htmlfiles/style.scss

Lines changed: 131 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@
66
// When you edit this file, you need to run "make css" to get the CSS file
77
// generated, and then check in both the .scss and the .css files.
88

9+
// When working on the file, this command is useful:
10+
// sass --watch --style=compact --sourcemap=none --no-cache coverage/htmlfiles/style.scss:htmlcov/style.css
11+
912
// Ignore this comment, it's for the CSS output file:
1013
/* Don't edit this .css file. Edit the .scss file instead! */
1114

15+
// Dimensions
16+
$left-gutter: 3rem;
17+
1218
// Page-wide styles
1319
html, body, h1, h2, h3, p, table, td, th {
1420
margin: 0;
1521
padding: 0;
1622
border: 0;
17-
outline: 0;
1823
font-weight: inherit;
1924
font-style: inherit;
2025
font-size: 100%;
@@ -70,11 +75,6 @@ a.nav {
7075
border-bottom: 1px solid #eee;
7176
}
7277

73-
#source {
74-
padding: 1em;
75-
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
76-
}
77-
7878
.indexfile #footer {
7979
margin: 1em 3em;
8080
}
@@ -97,7 +97,7 @@ a.nav {
9797

9898
/* Header styles */
9999
#header .content {
100-
padding: 1em 3em;
100+
padding: 1em $left-gutter;
101101
}
102102

103103
h1 {
@@ -235,131 +235,162 @@ h2.stats {
235235
}
236236

237237
// Source file styles
238-
.linenos p {
239-
text-align: right;
240-
margin: 0;
241-
padding: 0 .5em;
242-
color: #999999;
243-
font-family: verdana, sans-serif;
244-
245-
&.highlight {
246-
background: #ffdd00;
247-
}
248-
a {
249-
text-decoration: none;
250-
color: #999999;
251-
font-size: .8333em; // 10/12
252-
line-height: 1em;
253-
&:hover {
254-
text-decoration: underline;
255-
color: #999999;
256-
}
257-
}
258-
}
259-
260-
td.text {
261-
width: 100%;
262-
}
263238

264239
$hover-dark-amt: 95%;
265240
$pln-hover-color: mix($pln-color, #000, $hover-dark-amt);
266241
$mis-hover-color: mix($mis-color, #000, $hover-dark-amt);
267242
$run-hover-color: mix($run-color, #000, $hover-dark-amt);
268243
$exc-hover-color: mix($exc-color, #000, $hover-dark-amt);
269244
$par-hover-color: mix($par-color, #000, $hover-dark-amt);
245+
$border-indicator-width: .2em;
270246

271-
.text p {
272-
margin: 0;
273-
padding: 0 0 0 .5em;
274-
border-left: 2px solid #ffffff;
275-
white-space: pre;
276-
position: relative;
247+
#source {
248+
padding: 1em 0 1em $left-gutter;
249+
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
277250

278-
&:hover {
279-
background: $pln-hover-color;
280-
}
251+
p {
252+
/* position relative makes position:absolute pop-ups appear in the right place. */
253+
position: relative;
254+
white-space: pre;
255+
256+
.n {
257+
float: left;
258+
text-align: right;
259+
width: $left-gutter;
260+
box-sizing: border-box;
261+
margin-left: -$left-gutter;
262+
padding-right: 1em;
263+
color: #999999;
264+
font-family: verdana, sans-serif;
265+
266+
a {
267+
text-decoration: none;
268+
color: #999999;
269+
font-size: .8333em; // 10/12
270+
line-height: 1em;
271+
&:hover {
272+
text-decoration: underline;
273+
color: #999999;
274+
}
275+
}
276+
}
281277

282-
&.run {
283-
border-left: 2px solid #00ff00;
284-
&.show_run {
285-
background: $run-color;
278+
&.highlight .n {
279+
background: #ffdd00;
280+
}
281+
282+
.t {
283+
display: inline-block;
284+
width: 100%;
285+
box-sizing: border-box;
286+
margin-left: -.5em;
287+
padding-left: .5em - $border-indicator-width;
288+
border-left: $border-indicator-width solid white;
286289

287290
&:hover {
288-
background: $run-hover-color;
291+
background: $pln-hover-color;
292+
}
293+
// Syntax coloring
294+
.com {
295+
color: green;
296+
font-style: italic;
297+
line-height: 1px;
298+
}
299+
.key {
300+
font-weight: bold;
301+
line-height: 1px;
302+
}
303+
.str {
304+
color: #000080;
289305
}
290306
}
291-
}
292307

293-
&.mis {
294-
border-left: 2px solid #ff0000;
295-
&.show_mis {
296-
background: $mis-color;
308+
&.mis {
309+
.t {
310+
border-left: $border-indicator-width solid #ff0000;
311+
}
297312

298-
&:hover {
299-
background: $mis-hover-color;
313+
&.show_mis .t {
314+
background: $mis-color;
315+
316+
&:hover {
317+
background: $mis-hover-color;
318+
}
300319
}
301320
}
302-
}
303321

304-
&.exc {
305-
border-left: 2px solid #808080;
306-
&.show_exc {
307-
background: $exc-color;
322+
&.run {
323+
.t {
324+
border-left: $border-indicator-width solid #00ff00;
325+
}
308326

309-
&:hover {
310-
background: $exc-hover-color;
327+
&.show_run .t {
328+
background: $run-color;
329+
330+
&:hover {
331+
background: $run-hover-color;
332+
}
311333
}
312334
}
313-
}
314335

315-
&.par {
316-
border-left: 2px solid #eeee99;
317-
&.show_par {
318-
background: $par-color;
336+
&.exc {
337+
.t {
338+
border-left: $border-indicator-width solid #808080;
339+
}
319340

320-
&:hover {
321-
background: $par-hover-color;
341+
&.show_exc .t {
342+
background: $exc-color;
343+
344+
&:hover {
345+
background: $exc-hover-color;
346+
}
322347
}
323348
}
324-
}
325-
}
326349

350+
&.par {
351+
.t {
352+
border-left: $border-indicator-width solid #eeee99;
353+
}
327354

328-
.text {
329-
span.annotate {
330-
font-family: georgia;
331-
color: #666;
332-
float: right;
333-
padding-right: .5em;
334-
display: none;
335-
}
336-
p.show_par span.annotate {
337-
display: inline;
338-
}
339-
p.show_par span.annotate.long {
340-
@extend %in-text-popup;
341-
max-width: 50%;
342-
width: 30em;
343-
}
344-
p.show_par:hover span.annotate.long {
345-
display: block;
346-
}
355+
&.show_par .t {
356+
background: $par-color;
347357

348-
// Syntax coloring
349-
.com {
350-
color: green;
351-
font-style: italic;
352-
line-height: 1px;
353-
}
354-
.key {
355-
font-weight: bold;
356-
line-height: 1px;
357-
}
358-
.str {
359-
color: #000080;
358+
&:hover {
359+
background: $par-hover-color;
360+
}
361+
}
362+
363+
span.annotate {
364+
&.short {
365+
display: inline;
366+
position: absolute;
367+
right: 1.5em;
368+
}
369+
370+
&.long {
371+
@extend %in-text-popup;
372+
max-width: 50%;
373+
width: 30em;
374+
right: 2.5em;
375+
}
376+
}
377+
378+
&:hover span.annotate.long {
379+
display: block;
380+
}
381+
}
382+
383+
384+
span.annotate {
385+
font-family: georgia;
386+
color: #666;
387+
float: right;
388+
padding-right: .5em;
389+
}
360390
}
361391
}
362392

393+
363394
// Line contexts
364395
td.contexts {
365396
p {

0 commit comments

Comments
 (0)