Skip to content

Commit 49c5972

Browse files
authored
previous/next page links (#128)
* bump to 4.3.0 * docs update: wrap nav links in nav element * prev/next feature and unit tests * document theme feature
1 parent 81c5f60 commit 49c5972

27 files changed

+260
-62
lines changed

documentation/docs/about/coverage-report/coverage_html.js

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ coverage.LINE_FILTERS_STORAGE = "COVERAGE_LINE_FILTERS";
214214
coverage.pyfile_ready = function () {
215215
// If we're directed to a particular line number, highlight the line.
216216
var frag = location.hash;
217-
if (frag.length > 2 && frag[1] === 't') {
217+
if (frag.length > 2 && frag[1] === "t") {
218218
document.querySelector(frag).closest(".n").classList.add("highlight");
219219
coverage.set_sel(parseInt(frag.substr(2), 10));
220220
} else {
@@ -257,6 +257,10 @@ coverage.pyfile_ready = function () {
257257
coverage.init_scroll_markers();
258258
coverage.wire_up_sticky_header();
259259

260+
document.querySelectorAll("[id^=ctxs]").forEach(
261+
cbox => cbox.addEventListener("click", coverage.expand_contexts)
262+
);
263+
260264
// Rebuild scroll markers when the window height changes.
261265
window.addEventListener("resize", coverage.build_scroll_markers);
262266
};
@@ -528,14 +532,14 @@ coverage.scroll_window = function (to_pos) {
528532

529533
coverage.init_scroll_markers = function () {
530534
// Init some variables
531-
coverage.lines_len = document.querySelectorAll('#source > p').length;
535+
coverage.lines_len = document.querySelectorAll("#source > p").length;
532536

533537
// Build html
534538
coverage.build_scroll_markers();
535539
};
536540

537541
coverage.build_scroll_markers = function () {
538-
const temp_scroll_marker = document.getElementById('scroll_marker')
542+
const temp_scroll_marker = document.getElementById("scroll_marker")
539543
if (temp_scroll_marker) temp_scroll_marker.remove();
540544
// Don't build markers if the window has no scroll bar.
541545
if (document.body.scrollHeight <= window.innerHeight) {
@@ -549,8 +553,8 @@ coverage.build_scroll_markers = function () {
549553

550554
const scroll_marker = document.createElement("div");
551555
scroll_marker.id = "scroll_marker";
552-
document.getElementById('source').querySelectorAll(
553-
'p.show_run, p.show_mis, p.show_exc, p.show_exc, p.show_par'
556+
document.getElementById("source").querySelectorAll(
557+
"p.show_run, p.show_mis, p.show_exc, p.show_exc, p.show_par"
554558
).forEach(element => {
555559
const line_top = Math.floor(element.offsetTop * marker_scale);
556560
const line_number = parseInt(element.querySelector(".n a").id.substr(1));
@@ -577,24 +581,40 @@ coverage.build_scroll_markers = function () {
577581
};
578582

579583
coverage.wire_up_sticky_header = function () {
580-
const header = document.querySelector('header');
584+
const header = document.querySelector("header");
581585
const header_bottom = (
582-
header.querySelector('.content h2').getBoundingClientRect().top -
586+
header.querySelector(".content h2").getBoundingClientRect().top -
583587
header.getBoundingClientRect().top
584588
);
585589

586590
function updateHeader() {
587591
if (window.scrollY > header_bottom) {
588-
header.classList.add('sticky');
592+
header.classList.add("sticky");
589593
} else {
590-
header.classList.remove('sticky');
594+
header.classList.remove("sticky");
591595
}
592596
}
593597

594-
window.addEventListener('scroll', updateHeader);
598+
window.addEventListener("scroll", updateHeader);
595599
updateHeader();
596600
};
597601

602+
coverage.expand_contexts = function (e) {
603+
var ctxs = e.target.parentNode.querySelector(".ctxs");
604+
605+
if (!ctxs.classList.contains("expanded")) {
606+
var ctxs_text = ctxs.textContent;
607+
var width = Number(ctxs_text[0]);
608+
ctxs.textContent = "";
609+
for (var i = 1; i < ctxs_text.length; i += width) {
610+
key = ctxs_text.substring(i, i + width).trim();
611+
ctxs.appendChild(document.createTextNode(contexts[key]));
612+
ctxs.appendChild(document.createElement("br"));
613+
}
614+
ctxs.classList.add("expanded");
615+
}
616+
};
617+
598618
document.addEventListener("DOMContentLoaded", () => {
599619
if (document.body.classList.contains("indexfile")) {
600620
coverage.index_ready();

documentation/docs/about/coverage-report/d_23bf7247bda4ebb4___init___py.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ <h2>
6666
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
6767
<a id="nextFileLink" class="nav" href="d_23bf7247bda4ebb4_plugin_py.html">&#xbb; next</a>
6868
&nbsp; &nbsp; &nbsp;
69-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
70-
created at 2023-01-29 23:25 +0000
69+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
70+
created at 2023-04-15 03:31 +0000
7171
</p>
7272
<aside class="hidden">
7373
<button type="button" class="button_next_chunk" data-shortcut="j"/>
@@ -90,8 +90,8 @@ <h2>
9090
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
9191
<a id="nextFileLink" class="nav" href="d_23bf7247bda4ebb4_plugin_py.html">&#xbb; next</a>
9292
&nbsp; &nbsp; &nbsp;
93-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
94-
created at 2023-01-29 23:25 +0000
93+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
94+
created at 2023-04-15 03:31 +0000
9595
</p>
9696
</div>
9797
</footer>

documentation/docs/about/coverage-report/d_23bf7247bda4ebb4_plugin_py.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ <h2>
6666
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
6767
<a id="nextFileLink" class="nav" href="d_2583e640454d58aa___init___py.html">&#xbb; next</a>
6868
&nbsp; &nbsp; &nbsp;
69-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
70-
created at 2023-01-30 04:48 +0000
69+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
70+
created at 2023-04-15 03:31 +0000
7171
</p>
7272
<aside class="hidden">
7373
<button type="button" class="button_next_chunk" data-shortcut="j"/>
@@ -129,8 +129,8 @@ <h2>
129129
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
130130
<a id="nextFileLink" class="nav" href="d_2583e640454d58aa___init___py.html">&#xbb; next</a>
131131
&nbsp; &nbsp; &nbsp;
132-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
133-
created at 2023-01-30 04:48 +0000
132+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
133+
created at 2023-04-15 03:31 +0000
134134
</p>
135135
</div>
136136
</footer>

documentation/docs/about/coverage-report/d_2583e640454d58aa___init___py.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ <h2>
6666
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
6767
<a id="nextFileLink" class="nav" href="d_7e1d11d1cf628cf7___init___py.html">&#xbb; next</a>
6868
&nbsp; &nbsp; &nbsp;
69-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
70-
created at 2023-01-29 23:25 +0000
69+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
70+
created at 2023-04-15 03:31 +0000
7171
</p>
7272
<aside class="hidden">
7373
<button type="button" class="button_next_chunk" data-shortcut="j"/>
@@ -90,8 +90,8 @@ <h2>
9090
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
9191
<a id="nextFileLink" class="nav" href="d_7e1d11d1cf628cf7___init___py.html">&#xbb; next</a>
9292
&nbsp; &nbsp; &nbsp;
93-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
94-
created at 2023-01-29 23:25 +0000
93+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
94+
created at 2023-04-15 03:31 +0000
9595
</p>
9696
</div>
9797
</footer>

documentation/docs/about/coverage-report/d_7e1d11d1cf628cf7___init___py.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ <h2>
6666
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
6767
<a id="nextFileLink" class="nav" href="d_7e1d11d1cf628cf7_macro_py.html">&#xbb; next</a>
6868
&nbsp; &nbsp; &nbsp;
69-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
70-
created at 2023-01-29 23:25 +0000
69+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
70+
created at 2023-04-15 03:31 +0000
7171
</p>
7272
<aside class="hidden">
7373
<button type="button" class="button_next_chunk" data-shortcut="j"/>
@@ -90,8 +90,8 @@ <h2>
9090
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
9191
<a id="nextFileLink" class="nav" href="d_7e1d11d1cf628cf7_macro_py.html">&#xbb; next</a>
9292
&nbsp; &nbsp; &nbsp;
93-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
94-
created at 2023-01-29 23:25 +0000
93+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
94+
created at 2023-04-15 03:31 +0000
9595
</p>
9696
</div>
9797
</footer>

documentation/docs/about/coverage-report/d_7e1d11d1cf628cf7_macro_py.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ <h2>
6666
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
6767
<a id="nextFileLink" class="nav" href="d_7e1d11d1cf628cf7_main_py.html">&#xbb; next</a>
6868
&nbsp; &nbsp; &nbsp;
69-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
70-
created at 2023-01-30 04:48 +0000
69+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
70+
created at 2023-04-15 03:31 +0000
7171
</p>
7272
<aside class="hidden">
7373
<button type="button" class="button_next_chunk" data-shortcut="j"/>
@@ -178,8 +178,8 @@ <h2>
178178
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
179179
<a id="nextFileLink" class="nav" href="d_7e1d11d1cf628cf7_main_py.html">&#xbb; next</a>
180180
&nbsp; &nbsp; &nbsp;
181-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
182-
created at 2023-01-30 04:48 +0000
181+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
182+
created at 2023-04-15 03:31 +0000
183183
</p>
184184
</div>
185185
</footer>

documentation/docs/about/coverage-report/d_7e1d11d1cf628cf7_main_py.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ <h2>
6666
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
6767
<a id="nextFileLink" class="nav" href="d_7e1d11d1cf628cf7_util_py.html">&#xbb; next</a>
6868
&nbsp; &nbsp; &nbsp;
69-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
70-
created at 2023-01-30 04:48 +0000
69+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
70+
created at 2023-04-15 03:31 +0000
7171
</p>
7272
<aside class="hidden">
7373
<button type="button" class="button_next_chunk" data-shortcut="j"/>
@@ -96,8 +96,8 @@ <h2>
9696
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
9797
<a id="nextFileLink" class="nav" href="d_7e1d11d1cf628cf7_util_py.html">&#xbb; next</a>
9898
&nbsp; &nbsp; &nbsp;
99-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
100-
created at 2023-01-30 04:48 +0000
99+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
100+
created at 2023-04-15 03:31 +0000
101101
</p>
102102
</div>
103103
</footer>

documentation/docs/about/coverage-report/d_7e1d11d1cf628cf7_util_py.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ <h2>
6666
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
6767
<a id="nextFileLink" class="nav" href="index.html">&#xbb; next</a>
6868
&nbsp; &nbsp; &nbsp;
69-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
70-
created at 2023-01-30 04:48 +0000
69+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
70+
created at 2023-04-15 03:31 +0000
7171
</p>
7272
<aside class="hidden">
7373
<button type="button" class="button_next_chunk" data-shortcut="j"/>
@@ -114,8 +114,8 @@ <h2>
114114
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
115115
<a id="nextFileLink" class="nav" href="index.html">&#xbb; next</a>
116116
&nbsp; &nbsp; &nbsp;
117-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
118-
created at 2023-01-30 04:48 +0000
117+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
118+
created at 2023-04-15 03:31 +0000
119119
</p>
120120
</div>
121121
</footer>

documentation/docs/about/coverage-report/d_c926557d4617d0dd___init___py.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ <h2>
6666
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
6767
<a id="nextFileLink" class="nav" href="d_23bf7247bda4ebb4___init___py.html">&#xbb; next</a>
6868
&nbsp; &nbsp; &nbsp;
69-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
70-
created at 2023-01-29 23:25 +0000
69+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
70+
created at 2023-04-15 03:31 +0000
7171
</p>
7272
<aside class="hidden">
7373
<button type="button" class="button_next_chunk" data-shortcut="j"/>
@@ -90,8 +90,8 @@ <h2>
9090
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
9191
<a id="nextFileLink" class="nav" href="d_23bf7247bda4ebb4___init___py.html">&#xbb; next</a>
9292
&nbsp; &nbsp; &nbsp;
93-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
94-
created at 2023-01-29 23:25 +0000
93+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
94+
created at 2023-04-15 03:31 +0000
9595
</p>
9696
</div>
9797
</footer>

documentation/docs/about/coverage-report/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ <h1>Coverage report:
4646
<input id="filter" type="text" value="" placeholder="filter..." />
4747
</form>
4848
<p class="text">
49-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
50-
created at 2023-02-03 16:19 +0000
49+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
50+
created at 2023-04-15 03:31 +0000
5151
</p>
5252
</div>
5353
</header>
@@ -157,8 +157,8 @@ <h1>Coverage report:
157157
<footer>
158158
<div class="content">
159159
<p>
160-
<a class="nav" href="https://coverage.readthedocs.io">coverage.py v7.1.0</a>,
161-
created at 2023-02-03 16:19 +0000
160+
<a class="nav" href="https://coverage.readthedocs.io/en/7.2.3">coverage.py v7.2.3</a>,
161+
created at 2023-04-15 03:31 +0000
162162
</p>
163163
</div>
164164
<aside class="hidden">

0 commit comments

Comments
 (0)