diff options
| author | bors <bors@rust-lang.org> | 2024-09-22 07:48:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-09-22 07:48:56 +0000 |
| commit | 80aa6fa7314bddcfe95a68f4eb426b296bfdf4a9 (patch) | |
| tree | 1b267c6f486e10f7a0a8dd557e7520f40f369fe2 /src/librustdoc/html/static | |
| parent | 1f9a018fa30a13150b5e3b308d1aa16f86e27ecb (diff) | |
| parent | f314db6d6bf3f0fb8268334f2868a266c3587572 (diff) | |
| download | rust-80aa6fa7314bddcfe95a68f4eb426b296bfdf4a9.tar.gz rust-80aa6fa7314bddcfe95a68f4eb426b296bfdf4a9.zip | |
Auto merge of #130688 - workingjubilee:rollup-ovre6p7, r=workingjubilee
Rollup of 5 pull requests Successful merges: - #130648 (move enzyme flags from general cargo to rustc-specific cargo) - #130650 (Fixup Apple target's description strings) - #130664 (Generate line numbers for non-rust code examples as well) - #130665 (Prevent Deduplication of `LongRunningWarn`) - #130669 (tests: Test that `extern "C" fn` ptrs lint on slices) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/librustdoc/html/static')
| -rw-r--r-- | src/librustdoc/html/static/js/main.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index a0ec45b5ef3..0eba80133df 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -986,7 +986,13 @@ function preLoadCss(cssUrl) { }()); window.rustdoc_add_line_numbers_to_examples = () => { - onEachLazy(document.getElementsByClassName("rust-example-rendered"), x => { + if (document.querySelector(".rustdoc.src")) { + // We are in the source code page, nothing to be done here! + return; + } + onEachLazy(document.querySelectorAll( + ":not(.scraped-example) > .example-wrap > pre:not(.example-line-numbers)", + ), x => { const parent = x.parentNode; const line_numbers = parent.querySelectorAll(".example-line-numbers"); if (line_numbers.length > 0) { @@ -1005,12 +1011,8 @@ function preLoadCss(cssUrl) { }; window.rustdoc_remove_line_numbers_from_examples = () => { - onEachLazy(document.getElementsByClassName("rust-example-rendered"), x => { - const parent = x.parentNode; - const line_numbers = parent.querySelectorAll(".example-line-numbers"); - for (const node of line_numbers) { - parent.removeChild(node); - } + onEachLazy(document.querySelectorAll(".example-wrap > .example-line-numbers"), x => { + x.parentNode.removeChild(x); }); }; |
