diff options
| author | Michael Howell <michael@notriddle.com> | 2024-09-10 22:03:54 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2024-09-23 09:21:39 -0700 |
| commit | cc3ffe4c912ff00baeec1f52bb16389136a23a27 (patch) | |
| tree | 24599ad802b54140eea6ef91d9383f23ef9c4919 /src/librustdoc/html | |
| parent | e31a719cceb693a00f558eaa448152246b28b31b (diff) | |
| download | rust-cc3ffe4c912ff00baeec1f52bb16389136a23a27.tar.gz rust-cc3ffe4c912ff00baeec1f52bb16389136a23a27.zip | |
Tweak breadcrumbs list
Diffstat (limited to 'src/librustdoc/html')
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 5 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/main.js | 11 | ||||
| -rw-r--r-- | src/librustdoc/html/templates/print_item.html | 11 |
3 files changed, 16 insertions, 11 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 2dfe5107210..0237677f9d4 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -194,6 +194,11 @@ h1, h2, h3, h4 { display: flex; align-items: end; } +.rustdoc-breadcrumbs a { + padding: 4px 0; + margin: -4px 0; + z-index: 1; +} /* The only headings that get underlines are: Markdown-generated headings within the top-doc Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc) diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 3e8c903afcb..2fb686effc1 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -1,6 +1,6 @@ // Local js definitions: /* global addClass, getSettingValue, hasClass, searchState, updateLocalStorage */ -/* global onEach, onEachLazy, removeClass, getVar */ +/* global onEachLazy, removeClass, getVar */ "use strict"; @@ -1826,14 +1826,11 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm return; } but.onclick = () => { - const parent = but.parentElement; const path = []; - - onEach(parent.childNodes, child => { - if (child.tagName === "A") { - path.push(child.textContent); - } + onEachLazy(document.querySelectorAll(".rustdoc-breadcrumbs a"), a => { + path.push(a.textContent); }); + path.push(document.querySelector("title").textContent.split(" ")[0]); copyContentToClipboard(path.join("::")); copyButtonAnimation(but); diff --git a/src/librustdoc/html/templates/print_item.html b/src/librustdoc/html/templates/print_item.html index 2c9f8dbddf0..32ded1fbe42 100644 --- a/src/librustdoc/html/templates/print_item.html +++ b/src/librustdoc/html/templates/print_item.html @@ -1,8 +1,11 @@ <div class="main-heading"> {# #} {% if !path_components.is_empty() %} <span class="rustdoc-breadcrumbs"> - {% for component in path_components %} - <a href="{{component.path|safe}}index.html">{{component.name}}</a>::<wbr> + {% for (i, component) in path_components.iter().enumerate() %} + {% if i != 0 %} + ::<wbr> + {% endif %} + <a href="{{component.path|safe}}index.html">{{component.name}}</a> {% endfor %} </span> {% endif %} @@ -15,7 +18,7 @@ Copy item path {# #} </button> {# #} </h1> {# #} - <rustdoc-toolbar></rustdoc-toolbar> + <rustdoc-toolbar></rustdoc-toolbar> {# #} <span class="sub-heading"> {% if !stability_since_raw.is_empty() %} {{ stability_since_raw|safe +}} @@ -26,5 +29,5 @@ <a class="src" href="{{href|safe}}">source</a> {#+ #} {% else %} {% endmatch %} - </span> + </span> {# #} </div> {# #} |
