File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
src/librustdoc/html/static/js Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -986,7 +986,13 @@ function preLoadCss(cssUrl) {
986
986
}());
987
987
988
988
window.rustdoc_add_line_numbers_to_examples = () => {
989
- onEachLazy(document.getElementsByClassName("rust-example-rendered"), x => {
989
+ if (document.querySelector(".rustdoc.src")) {
990
+ // We are in the source code page, nothing to be done here!
991
+ return;
992
+ }
993
+ onEachLazy(document.querySelectorAll(
994
+ ":not(.scraped-example) > .example-wrap > pre:not(.example-line-numbers)",
995
+ ), x => {
990
996
const parent = x.parentNode;
991
997
const line_numbers = parent.querySelectorAll(".example-line-numbers");
992
998
if (line_numbers.length > 0) {
@@ -1005,12 +1011,8 @@ function preLoadCss(cssUrl) {
1005
1011
};
1006
1012
1007
1013
window.rustdoc_remove_line_numbers_from_examples = () => {
1008
- onEachLazy(document.getElementsByClassName("rust-example-rendered"), x => {
1009
- const parent = x.parentNode;
1010
- const line_numbers = parent.querySelectorAll(".example-line-numbers");
1011
- for (const node of line_numbers) {
1012
- parent.removeChild(node);
1013
- }
1014
+ onEachLazy(document.querySelectorAll(".example-wrap > .example-line-numbers"), x => {
1015
+ x.parentNode.removeChild(x);
1014
1016
});
1015
1017
};
1016
1018
You can’t perform that action at this time.
0 commit comments