Tweak breadcrumbs list
This commit is contained in:
parent
e31a719cce
commit
cc3ffe4c91
@ -194,6 +194,11 @@ h1, h2, h3, h4 {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: end;
|
align-items: end;
|
||||||
}
|
}
|
||||||
|
.rustdoc-breadcrumbs a {
|
||||||
|
padding: 4px 0;
|
||||||
|
margin: -4px 0;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
/* The only headings that get underlines are:
|
/* The only headings that get underlines are:
|
||||||
Markdown-generated headings within the top-doc
|
Markdown-generated headings within the top-doc
|
||||||
Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc)
|
Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Local js definitions:
|
// Local js definitions:
|
||||||
/* global addClass, getSettingValue, hasClass, searchState, updateLocalStorage */
|
/* global addClass, getSettingValue, hasClass, searchState, updateLocalStorage */
|
||||||
/* global onEach, onEachLazy, removeClass, getVar */
|
/* global onEachLazy, removeClass, getVar */
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -1826,14 +1826,11 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
but.onclick = () => {
|
but.onclick = () => {
|
||||||
const parent = but.parentElement;
|
|
||||||
const path = [];
|
const path = [];
|
||||||
|
onEachLazy(document.querySelectorAll(".rustdoc-breadcrumbs a"), a => {
|
||||||
onEach(parent.childNodes, child => {
|
path.push(a.textContent);
|
||||||
if (child.tagName === "A") {
|
|
||||||
path.push(child.textContent);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
path.push(document.querySelector("title").textContent.split(" ")[0]);
|
||||||
|
|
||||||
copyContentToClipboard(path.join("::"));
|
copyContentToClipboard(path.join("::"));
|
||||||
copyButtonAnimation(but);
|
copyButtonAnimation(but);
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
<div class="main-heading"> {# #}
|
<div class="main-heading"> {# #}
|
||||||
{% if !path_components.is_empty() %}
|
{% if !path_components.is_empty() %}
|
||||||
<span class="rustdoc-breadcrumbs">
|
<span class="rustdoc-breadcrumbs">
|
||||||
{% for component in path_components %}
|
{% for (i, component) in path_components.iter().enumerate() %}
|
||||||
<a href="{{component.path|safe}}index.html">{{component.name}}</a>::<wbr>
|
{% if i != 0 %}
|
||||||
|
::<wbr>
|
||||||
|
{% endif %}
|
||||||
|
<a href="{{component.path|safe}}index.html">{{component.name}}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -15,7 +18,7 @@
|
|||||||
Copy item path {# #}
|
Copy item path {# #}
|
||||||
</button> {# #}
|
</button> {# #}
|
||||||
</h1> {# #}
|
</h1> {# #}
|
||||||
<rustdoc-toolbar></rustdoc-toolbar>
|
<rustdoc-toolbar></rustdoc-toolbar> {# #}
|
||||||
<span class="sub-heading">
|
<span class="sub-heading">
|
||||||
{% if !stability_since_raw.is_empty() %}
|
{% if !stability_since_raw.is_empty() %}
|
||||||
{{ stability_since_raw|safe +}}
|
{{ stability_since_raw|safe +}}
|
||||||
@ -26,5 +29,5 @@
|
|||||||
<a class="src" href="{{href|safe}}">source</a> {#+ #}
|
<a class="src" href="{{href|safe}}">source</a> {#+ #}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% endmatch %}
|
{% endmatch %}
|
||||||
</span>
|
</span> {# #}
|
||||||
</div> {# #}
|
</div> {# #}
|
||||||
|
@ -16,5 +16,5 @@ assert-css: ("#main-content", {"display": "none"})
|
|||||||
// Now we can check that the feature is working as expected!
|
// Now we can check that the feature is working as expected!
|
||||||
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=struct%3AFoo&go_to_first=true"
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=struct%3AFoo&go_to_first=true"
|
||||||
// Waiting for the page to load...
|
// Waiting for the page to load...
|
||||||
wait-for-text: (".main-heading .rustdoc-breadcrumbs", "test_docs::")
|
wait-for-text: (".main-heading .rustdoc-breadcrumbs", "test_docs")
|
||||||
wait-for-text: (".main-heading h1", "Struct FooCopy item path")
|
wait-for-text: (".main-heading h1", "Struct FooCopy item path")
|
||||||
|
@ -12,5 +12,5 @@ assert-attribute-false: (".impl-items .toggle", {"open": ""})
|
|||||||
|
|
||||||
// Click the "Trait" part of "impl Trait" and verify it navigates.
|
// Click the "Trait" part of "impl Trait" and verify it navigates.
|
||||||
click: "#impl-Trait-for-Foo h3 a:first-of-type"
|
click: "#impl-Trait-for-Foo h3 a:first-of-type"
|
||||||
assert-text: (".main-heading .rustdoc-breadcrumbs", "lib2::")
|
assert-text: (".main-heading .rustdoc-breadcrumbs", "lib2")
|
||||||
assert-text: (".main-heading h1", "Trait TraitCopy item path")
|
assert-text: (".main-heading h1", "Trait TraitCopy item path")
|
||||||
|
@ -3,17 +3,17 @@
|
|||||||
//@ has 'empty_mod_private/index.html' '//a[@href="foo/index.html"]' 'foo'
|
//@ has 'empty_mod_private/index.html' '//a[@href="foo/index.html"]' 'foo'
|
||||||
//@ hasraw 'empty_mod_private/sidebar-items.js' 'foo'
|
//@ hasraw 'empty_mod_private/sidebar-items.js' 'foo'
|
||||||
//@ matches 'empty_mod_private/foo/index.html' '//h1' 'Module foo'
|
//@ matches 'empty_mod_private/foo/index.html' '//h1' 'Module foo'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private'
|
||||||
mod foo {}
|
mod foo {}
|
||||||
|
|
||||||
//@ has 'empty_mod_private/index.html' '//a[@href="bar/index.html"]' 'bar'
|
//@ has 'empty_mod_private/index.html' '//a[@href="bar/index.html"]' 'bar'
|
||||||
//@ hasraw 'empty_mod_private/sidebar-items.js' 'bar'
|
//@ hasraw 'empty_mod_private/sidebar-items.js' 'bar'
|
||||||
//@ matches 'empty_mod_private/bar/index.html' '//h1' 'Module bar'
|
//@ matches 'empty_mod_private/bar/index.html' '//h1' 'Module bar'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private'
|
||||||
mod bar {
|
mod bar {
|
||||||
//@ has 'empty_mod_private/bar/index.html' '//a[@href="baz/index.html"]' 'baz'
|
//@ has 'empty_mod_private/bar/index.html' '//a[@href="baz/index.html"]' 'baz'
|
||||||
//@ hasraw 'empty_mod_private/bar/sidebar-items.js' 'baz'
|
//@ hasraw 'empty_mod_private/bar/sidebar-items.js' 'baz'
|
||||||
//@ matches 'empty_mod_private/bar/baz/index.html' '//h1' 'Module baz'
|
//@ matches 'empty_mod_private/bar/baz/index.html' '//h1' 'Module baz'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private::bar::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private::bar'
|
||||||
mod baz {}
|
mod baz {}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
//@ has 'empty_mod_public/index.html' '//a[@href="foo/index.html"]' 'foo'
|
//@ has 'empty_mod_public/index.html' '//a[@href="foo/index.html"]' 'foo'
|
||||||
//@ hasraw 'empty_mod_public/sidebar-items.js' 'foo'
|
//@ hasraw 'empty_mod_public/sidebar-items.js' 'foo'
|
||||||
//@ matches 'empty_mod_public/foo/index.html' '//h1' 'Module foo'
|
//@ matches 'empty_mod_public/foo/index.html' '//h1' 'Module foo'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public'
|
||||||
pub mod foo {}
|
pub mod foo {}
|
||||||
|
|
||||||
//@ has 'empty_mod_public/index.html' '//a[@href="bar/index.html"]' 'bar'
|
//@ has 'empty_mod_public/index.html' '//a[@href="bar/index.html"]' 'bar'
|
||||||
//@ hasraw 'empty_mod_public/sidebar-items.js' 'bar'
|
//@ hasraw 'empty_mod_public/sidebar-items.js' 'bar'
|
||||||
//@ matches 'empty_mod_public/bar/index.html' '//h1' 'Module bar'
|
//@ matches 'empty_mod_public/bar/index.html' '//h1' 'Module bar'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public'
|
||||||
pub mod bar {
|
pub mod bar {
|
||||||
//@ has 'empty_mod_public/bar/index.html' '//a[@href="baz/index.html"]' 'baz'
|
//@ has 'empty_mod_public/bar/index.html' '//a[@href="baz/index.html"]' 'baz'
|
||||||
//@ hasraw 'empty_mod_public/bar/sidebar-items.js' 'baz'
|
//@ hasraw 'empty_mod_public/bar/sidebar-items.js' 'baz'
|
||||||
//@ matches 'empty_mod_public/bar/baz/index.html' '//h1' 'Module baz'
|
//@ matches 'empty_mod_public/bar/baz/index.html' '//h1' 'Module baz'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public::bar::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public::bar'
|
||||||
pub mod baz {}
|
pub mod baz {}
|
||||||
}
|
}
|
||||||
|
@ -11,18 +11,18 @@
|
|||||||
//@ has - '//a/[@href="struct.StepBy.html"]' "StepBy"
|
//@ has - '//a/[@href="struct.StepBy.html"]' "StepBy"
|
||||||
//@ has foo/iter/struct.DeprecatedStepBy.html
|
//@ has foo/iter/struct.DeprecatedStepBy.html
|
||||||
//@ has - '//h1' "Struct DeprecatedStepBy"
|
//@ has - '//h1' "Struct DeprecatedStepBy"
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::iter::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::iter'
|
||||||
//@ has foo/iter/struct.StepBy.html
|
//@ has foo/iter/struct.StepBy.html
|
||||||
//@ has - '//h1' "Struct StepBy"
|
//@ has - '//h1' "Struct StepBy"
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::iter::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::iter'
|
||||||
|
|
||||||
//@ has bar/iter/index.html
|
//@ has bar/iter/index.html
|
||||||
//@ has - '//a/[@href="struct.DeprecatedStepBy.html"]' "DeprecatedStepBy"
|
//@ has - '//a/[@href="struct.DeprecatedStepBy.html"]' "DeprecatedStepBy"
|
||||||
//@ has - '//a/[@href="struct.StepBy.html"]' "StepBy"
|
//@ has - '//a/[@href="struct.StepBy.html"]' "StepBy"
|
||||||
//@ has bar/iter/struct.DeprecatedStepBy.html
|
//@ has bar/iter/struct.DeprecatedStepBy.html
|
||||||
//@ has - '//h1' "Struct DeprecatedStepBy"
|
//@ has - '//h1' "Struct DeprecatedStepBy"
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'bar::iter::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'bar::iter'
|
||||||
//@ has bar/iter/struct.StepBy.html
|
//@ has bar/iter/struct.StepBy.html
|
||||||
//@ has - '//h1' "Struct StepBy"
|
//@ has - '//h1' "Struct StepBy"
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'bar::iter::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'bar::iter'
|
||||||
pub use foo::iter;
|
pub use foo::iter;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
//@ count 'foo/index.html' '//h2[@class="location"]' 0
|
//@ count 'foo/index.html' '//h2[@class="location"]' 0
|
||||||
|
|
||||||
//@ matches 'foo/foo_mod/index.html' '//h1' 'Module foo_mod'
|
//@ matches 'foo/foo_mod/index.html' '//h1' 'Module foo_mod'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
|
||||||
//@ matches - '//h2[@class="location"]' 'Module foo_mod'
|
//@ matches - '//h2[@class="location"]' 'Module foo_mod'
|
||||||
pub mod foo_mod {
|
pub mod foo_mod {
|
||||||
pub struct __Thing {}
|
pub struct __Thing {}
|
||||||
@ -14,36 +14,36 @@ pub struct __Thing {}
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
//@ matches 'foo/fn.foo_ffn.html' '//h1' 'Function foo_ffn'
|
//@ matches 'foo/fn.foo_ffn.html' '//h1' 'Function foo_ffn'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
|
||||||
pub fn foo_ffn();
|
pub fn foo_ffn();
|
||||||
}
|
}
|
||||||
|
|
||||||
//@ matches 'foo/fn.foo_fn.html' '//h1' 'Function foo_fn'
|
//@ matches 'foo/fn.foo_fn.html' '//h1' 'Function foo_fn'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
|
||||||
pub fn foo_fn() {}
|
pub fn foo_fn() {}
|
||||||
|
|
||||||
//@ matches 'foo/trait.FooTrait.html' '//h1' 'Trait FooTrait'
|
//@ matches 'foo/trait.FooTrait.html' '//h1' 'Trait FooTrait'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
|
||||||
//@ matches - '//h2[@class="location"]' 'FooTrait'
|
//@ matches - '//h2[@class="location"]' 'FooTrait'
|
||||||
pub trait FooTrait {}
|
pub trait FooTrait {}
|
||||||
|
|
||||||
//@ matches 'foo/struct.FooStruct.html' '//h1' 'Struct FooStruct'
|
//@ matches 'foo/struct.FooStruct.html' '//h1' 'Struct FooStruct'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
|
||||||
//@ matches - '//h2[@class="location"]' 'FooStruct'
|
//@ matches - '//h2[@class="location"]' 'FooStruct'
|
||||||
pub struct FooStruct;
|
pub struct FooStruct;
|
||||||
|
|
||||||
//@ matches 'foo/enum.FooEnum.html' '//h1' 'Enum FooEnum'
|
//@ matches 'foo/enum.FooEnum.html' '//h1' 'Enum FooEnum'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
|
||||||
//@ matches - '//h2[@class="location"]' 'FooEnum'
|
//@ matches - '//h2[@class="location"]' 'FooEnum'
|
||||||
pub enum FooEnum {}
|
pub enum FooEnum {}
|
||||||
|
|
||||||
//@ matches 'foo/type.FooType.html' '//h1' 'Type Alias FooType'
|
//@ matches 'foo/type.FooType.html' '//h1' 'Type Alias FooType'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
|
||||||
//@ matches - '//h2[@class="location"]' 'FooType'
|
//@ matches - '//h2[@class="location"]' 'FooType'
|
||||||
pub type FooType = FooStruct;
|
pub type FooType = FooStruct;
|
||||||
|
|
||||||
//@ matches 'foo/macro.foo_macro.html' '//h1' 'Macro foo_macro'
|
//@ matches 'foo/macro.foo_macro.html' '//h1' 'Macro foo_macro'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! foo_macro {
|
macro_rules! foo_macro {
|
||||||
() => {};
|
() => {};
|
||||||
@ -55,15 +55,15 @@ macro_rules! foo_macro {
|
|||||||
mod bool {}
|
mod bool {}
|
||||||
|
|
||||||
//@ matches 'foo/static.FOO_STATIC.html' '//h1' 'Static FOO_STATIC'
|
//@ matches 'foo/static.FOO_STATIC.html' '//h1' 'Static FOO_STATIC'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
|
||||||
pub static FOO_STATIC: FooStruct = FooStruct;
|
pub static FOO_STATIC: FooStruct = FooStruct;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
//@ matches 'foo/static.FOO_FSTATIC.html' '//h1' 'Static FOO_FSTATIC'
|
//@ matches 'foo/static.FOO_FSTATIC.html' '//h1' 'Static FOO_FSTATIC'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
|
||||||
pub static FOO_FSTATIC: FooStruct;
|
pub static FOO_FSTATIC: FooStruct;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@ matches 'foo/constant.FOO_CONSTANT.html' '//h1' 'Constant FOO_CONSTANT'
|
//@ matches 'foo/constant.FOO_CONSTANT.html' '//h1' 'Constant FOO_CONSTANT'
|
||||||
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
|
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
|
||||||
pub const FOO_CONSTANT: FooStruct = FooStruct;
|
pub const FOO_CONSTANT: FooStruct = FooStruct;
|
||||||
|
Loading…
Reference in New Issue
Block a user