diff options
| author | Michael Howell <michael@notriddle.com> | 2022-09-26 15:40:55 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-26 15:40:55 -0700 |
| commit | 76b21341a8b7c839bcf7d922837ee5ca512cac6a (patch) | |
| tree | 8e218a6f51456dacb4b397dbb9358c61383b0c83 /src/librustdoc/html/static | |
| parent | 66bab6b7817223ee20b9a610838bf4ce1281ac5c (diff) | |
| parent | 9ca2ae3fa74c0598d0b0dfe6e84cae7b39913539 (diff) | |
| download | rust-76b21341a8b7c839bcf7d922837ee5ca512cac6a.tar.gz rust-76b21341a8b7c839bcf7d922837ee5ca512cac6a.zip | |
Rollup merge of #102325 - notriddle:notriddle/line-number, r=GuillaumeGomez
rustdoc: give `.line-number` / `.line-numbers` meaningful names
Diffstat (limited to 'src/librustdoc/html/static')
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 18 | ||||
| -rw-r--r-- | src/librustdoc/html/static/css/themes/ayu.css | 8 | ||||
| -rw-r--r-- | src/librustdoc/html/static/css/themes/dark.css | 8 | ||||
| -rw-r--r-- | src/librustdoc/html/static/css/themes/light.css | 8 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/main.js | 6 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/scrape-examples.js | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/source-script.js | 4 |
7 files changed, 27 insertions, 27 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 679aea411d1..e7a05b80c12 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -569,7 +569,7 @@ h2.location a { position: relative; } -.example-wrap > pre.line-number { +pre.example-line-numbers { overflow: initial; border: 1px solid; padding: 13px 8px; @@ -582,15 +582,15 @@ h2.location a { text-decoration: underline; } -.line-numbers { +.src-line-numbers { text-align: right; } -.rustdoc:not(.source) .example-wrap > pre:not(.line-number) { +.rustdoc:not(.source) .example-wrap > pre:not(.example-line-numbers) { width: 100%; overflow-x: auto; } -.rustdoc:not(.source) .example-wrap > pre.line-numbers { +.rustdoc:not(.source) .example-wrap > pre.src-line-numbers { width: auto; overflow-x: visible; } @@ -603,14 +603,14 @@ h2.location a { text-align: center; } -.content > .example-wrap pre.line-numbers { +.content > .example-wrap pre.src-line-numbers { position: relative; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } -.line-numbers span { +.src-line-numbers span { cursor: pointer; } @@ -2059,7 +2059,7 @@ in storage.js plus the media query with (min-width: 701px) padding-bottom: 0; } -.scraped-example:not(.expanded) .code-wrapper pre.line-numbers { +.scraped-example:not(.expanded) .code-wrapper pre.src-line-numbers { overflow-x: hidden; } @@ -2105,12 +2105,12 @@ in storage.js plus the media query with (min-width: 701px) bottom: 0; } -.scraped-example .code-wrapper .line-numbers { +.scraped-example .code-wrapper .src-line-numbers { margin: 0; padding: 14px 0; } -.scraped-example .code-wrapper .line-numbers span { +.scraped-example .code-wrapper .src-line-numbers span { padding: 0 14px; } diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index e7a898e9fa6..44238ca573d 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -93,8 +93,8 @@ pre, .rustdoc.source .example-wrap { color: #ff7733; } -.line-numbers span { color: #5c6773; } -.line-numbers .line-highlighted { +.src-line-numbers span { color: #5c6773; } +.src-line-numbers .line-highlighted { color: #708090; background-color: rgba(255, 236, 164, 0.06); padding-right: 4px; @@ -171,7 +171,7 @@ details.rustdoc-toggle > summary::before { color: #788797; } -.line-numbers :target { background-color: transparent; } +.src-line-numbers :target { background-color: transparent; } /* Code highlighting */ pre.rust .number, pre.rust .string { color: #b8cc52; } @@ -190,7 +190,7 @@ pre.rust .attribute { color: #e6e1cf; } -.example-wrap > pre.line-number { +pre.example-line-numbers { color: #5c67736e; border: none; } diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index 07a1ed8b7db..858d836c03d 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -54,8 +54,8 @@ input:focus + .slider { background: #444; } -.line-numbers span { color: #3B91E2; } -.line-numbers .line-highlighted { +.src-line-numbers span { color: #3B91E2; } +.src-line-numbers .line-highlighted { background-color: #0a042f !important; } @@ -141,7 +141,7 @@ details.rustdoc-toggle > summary::before { background: none; } -.line-numbers :target { background-color: transparent; } +.src-line-numbers :target { background-color: transparent; } /* Code highlighting */ pre.rust .kw { color: #ab8ac1; } @@ -155,7 +155,7 @@ pre.rust .question-mark { color: #ff9011; } -.example-wrap > pre.line-number { +pre.example-line-numbers { border-color: #4a4949; } diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index 64335f62928..6fbea6f6c7a 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -53,8 +53,8 @@ input:focus + .slider { background-color: #fff; } -.line-numbers span { color: #c67e2d; } -.line-numbers .line-highlighted { +.src-line-numbers span { color: #c67e2d; } +.src-line-numbers .line-highlighted { background-color: #FDFFD3 !important; } @@ -125,7 +125,7 @@ body.source .example-wrap pre.rust a { .stab { background: #FFF5D6; border-color: #FFC600; } .stab.portability > code { background: none; } -.line-numbers :target { background-color: transparent; } +.src-line-numbers :target { background-color: transparent; } /* Code highlighting */ pre.rust .kw { color: #8959A8; } @@ -141,7 +141,7 @@ pre.rust .question-mark { color: #ff9011; } -.example-wrap > pre.line-number { +pre.example-line-numbers { border-color: #c7c7c7; } diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index c9674f11a5e..bbaf6d3b507 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -699,7 +699,7 @@ function loadCss(cssFileName) { window.rustdoc_add_line_numbers_to_examples = () => { onEachLazy(document.getElementsByClassName("rust-example-rendered"), x => { const parent = x.parentNode; - const line_numbers = parent.querySelectorAll(".line-number"); + const line_numbers = parent.querySelectorAll(".example-line-numbers"); if (line_numbers.length > 0) { return; } @@ -709,7 +709,7 @@ function loadCss(cssFileName) { elems.push(i + 1); } const node = document.createElement("pre"); - addClass(node, "line-number"); + addClass(node, "example-line-numbers"); node.innerHTML = elems.join("\n"); parent.insertBefore(node, x); }); @@ -718,7 +718,7 @@ function loadCss(cssFileName) { window.rustdoc_remove_line_numbers_from_examples = () => { onEachLazy(document.getElementsByClassName("rust-example-rendered"), x => { const parent = x.parentNode; - const line_numbers = parent.querySelectorAll(".line-number"); + const line_numbers = parent.querySelectorAll(".example-line-numbers"); for (const node of line_numbers) { parent.removeChild(node); } diff --git a/src/librustdoc/html/static/js/scrape-examples.js b/src/librustdoc/html/static/js/scrape-examples.js index fd7a1449763..d0fd115fd15 100644 --- a/src/librustdoc/html/static/js/scrape-examples.js +++ b/src/librustdoc/html/static/js/scrape-examples.js @@ -8,7 +8,7 @@ // Scroll code block to the given code location function scrollToLoc(elt, loc) { - const lines = elt.querySelector(".line-numbers"); + const lines = elt.querySelector(".src-line-numbers"); let scrollOffset; // If the block is greater than the size of the viewer, diff --git a/src/librustdoc/html/static/js/source-script.js b/src/librustdoc/html/static/js/source-script.js index 06d15d9e5ff..8286e9201e6 100644 --- a/src/librustdoc/html/static/js/source-script.js +++ b/src/librustdoc/html/static/js/source-script.js @@ -183,7 +183,7 @@ function highlightSourceLines(match) { if (x) { x.scrollIntoView(); } - onEachLazy(document.getElementsByClassName("line-numbers"), e => { + onEachLazy(document.getElementsByClassName("src-line-numbers"), e => { onEachLazy(e.getElementsByTagName("span"), i_e => { removeClass(i_e, "line-highlighted"); }); @@ -245,7 +245,7 @@ window.addEventListener("hashchange", () => { } }); -onEachLazy(document.getElementsByClassName("line-numbers"), el => { +onEachLazy(document.getElementsByClassName("src-line-numbers"), el => { el.addEventListener("click", handleSourceHighlight); }); |
