|
16 | 16 | --plan: #0550ae; |
17 | 17 | --bar-bg: #f2f2f2; |
18 | 18 | --hl: #fff8c5; |
| 19 | + --bg-line: #f2dd2650; |
19 | 20 | } |
20 | 21 | @media (prefers-color-scheme: dark) { |
21 | 22 | :root { |
|
28 | 29 | --plan: #809fff; |
29 | 30 | --bar-bg: #282828; |
30 | 31 | --hl: #4a3f1a; |
| 32 | + --bg-line: #f2dd2650; |
31 | 33 | } |
32 | 34 | } |
33 | 35 | html, body { |
|
76 | 78 | .ln-diag { color: var(--dim); } |
77 | 79 | .ln-totals { color: var(--plan); } |
78 | 80 | .ln-err { color: var(--fail); } |
| 81 | + .ln-bg { background-color: var(--bg-line); } |
79 | 82 | .fold-toggle { |
80 | 83 | cursor: pointer; |
81 | 84 | color: var(--plan); |
|
160 | 163 |
|
161 | 164 | function renderLine(line, i) { |
162 | 165 | i += this.add; |
| 166 | + var classes = [] |
163 | 167 | const cls = classify(line); |
164 | 168 | if (cls === "ln-pass") pass++; |
165 | 169 | else if (cls === "ln-fail") fail++; |
166 | 170 | else if (cls === "ln-skip") skip++; |
| 171 | + if (cls) classes.push(cls); |
| 172 | + if (this.bg == i) classes.push("ln-bg") |
167 | 173 | const e = esc(line); |
168 | | - const c = cls ? `class=${cls}` : ``; |
| 174 | + const c = classes.length > 0 ? `class="${classes.join(" ")}"` : ``; |
169 | 175 | return `<span id="L${i}" ${c}>${e}</span>`; |
170 | 176 | } |
171 | 177 |
|
172 | 178 | // Group runs of deeply-nested "# #" diagnostic lines into a foldable |
173 | 179 | // block (rendered expanded; collapse via the marker or "fold all"). |
174 | 180 | // Totals lines are kept out so the summary stays visible. |
175 | 181 | const foldable = l => l.startsWith("# #") && !/Totals: pass/.test(l); |
| 182 | + const anchor = window.location.hash.match(/^#L(\d+)/); |
| 183 | + this.bg = anchor && anchor.length > 1 ? anchor[1] : -1; |
176 | 184 | this.add = 0; |
177 | 185 | const pieces = []; |
178 | 186 | let i = 0; |
179 | 187 | while (i < lines.length) { |
180 | 188 | if (foldable(lines[i])) { |
181 | 189 | let j = i; |
182 | 190 | while (j < lines.length && foldable(lines[j])) j++; |
183 | | - const body = lines.slice(i, j).map(renderLine, {add: i}).join("\n"); |
| 191 | + const body = lines.slice(i, j).map(renderLine, |
| 192 | + {add: i, bg: bg}).join("\n"); |
184 | 193 | pieces.push( |
185 | 194 | `<span class="fold open"><span class="fold-toggle">${j - i} lines` + |
186 | 195 | `</span><span class="fold-body">\n${body}</span></span>`); |
|
0 commit comments