rustdoc: consistentify #TOC
and #ModNav
to lowercase
This commit is contained in:
parent
95fcddd29f
commit
12a3c42ccc
@ -2,7 +2,7 @@
|
||||
|
||||
<!-- Completely hide the TOC and the section numbers -->
|
||||
<style type="text/css">
|
||||
#TOC { display: none; }
|
||||
#rustdoc-toc { display: none; }
|
||||
.header-section-number { display: none; }
|
||||
li {list-style-type: none; }
|
||||
#search-input {
|
||||
|
@ -1452,7 +1452,7 @@ pub(crate) fn into_parts(self) -> (Toc, String) {
|
||||
}
|
||||
pub(crate) fn into_string(self) -> String {
|
||||
let (toc, s) = self.into_parts();
|
||||
format!("<nav id=\"TOC\">{toc}</nav>{s}", toc = toc.print())
|
||||
format!("<nav id=\"rustdoc\">{toc}</nav>{s}", toc = toc.print())
|
||||
}
|
||||
}
|
||||
|
||||
@ -2028,7 +2028,8 @@ fn init_id_map() -> FxHashMap<Cow<'static, str>, usize> {
|
||||
map.insert("default-settings".into(), 1);
|
||||
map.insert("sidebar-vars".into(), 1);
|
||||
map.insert("copy-path".into(), 1);
|
||||
map.insert("TOC".into(), 1);
|
||||
map.insert("rustdoc-toc".into(), 1);
|
||||
map.insert("rustdoc-modnav".into(), 1);
|
||||
// This is the list of IDs used by rustdoc sections (but still generated by
|
||||
// rustdoc).
|
||||
map.insert("fields".into(), 1);
|
||||
|
@ -589,11 +589,11 @@ ul.block, .block li, .block ul {
|
||||
background-clip: border-box;
|
||||
}
|
||||
|
||||
.hide-toc #TOC, .hide-toc .in-crate {
|
||||
.hide-toc #rustdoc-toc, .hide-toc .in-crate {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.hide-modnav #ModNav {
|
||||
.hide-modnav #rustdoc-modnav {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
@ -499,7 +499,7 @@ function preLoadCss(cssUrl) {
|
||||
if (!window.SIDEBAR_ITEMS) {
|
||||
return;
|
||||
}
|
||||
const sidebar = document.getElementById("ModNav");
|
||||
const sidebar = document.getElementById("rustdoc-modnav");
|
||||
|
||||
/**
|
||||
* Append to the sidebar a "block" of links - a heading along with a list (`<ul>`) of items.
|
||||
@ -885,7 +885,7 @@ function preLoadCss(cssUrl) {
|
||||
if (!window.ALL_CRATES) {
|
||||
return;
|
||||
}
|
||||
const sidebarElems = document.getElementById("ModNav");
|
||||
const sidebarElems = document.getElementById("rustdoc-modnav");
|
||||
if (!sidebarElems) {
|
||||
return;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
{% endif %}
|
||||
|
||||
{% if self.should_render_blocks() %}
|
||||
<section id="TOC">
|
||||
<section id="rustdoc-toc">
|
||||
{% if !title.is_empty() %}
|
||||
<h2 class="location"> {# #}
|
||||
<a href="#">{{title_prefix}}{{title|wrapped|safe}}</a> {# #}
|
||||
@ -53,7 +53,7 @@
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% endif %}
|
||||
<div id="ModNav">
|
||||
<div id="rustdoc-modnav">
|
||||
{% if !path.is_empty() %}
|
||||
<h2{% if parent_is_crate +%} class="in-crate"{% endif %}> {# #}
|
||||
<a href="{% if is_mod %}../{% endif %}index.html">In {{+ path|wrapped|safe}}</a> {# #}
|
||||
|
@ -126,8 +126,8 @@ assert-text: (".sidebar-elems ul.block > li.current > a", "module")
|
||||
// - Module name, followed by TOC for module headings
|
||||
// - "In crate [name]" parent pointer, followed by sibling navigation
|
||||
assert-count: (".sidebar h2", 3)
|
||||
assert-text: (".sidebar > .sidebar-elems > #ModNav > h2", "In crate lib2")
|
||||
assert-property: (".sidebar > .sidebar-elems > #ModNav > h2 > a", {
|
||||
assert-text: (".sidebar > .sidebar-elems > #rustdoc-modnav > h2", "In crate lib2")
|
||||
assert-property: (".sidebar > .sidebar-elems > #rustdoc-modnav > h2 > a", {
|
||||
"href": "/lib2/index.html",
|
||||
}, ENDS_WITH)
|
||||
// We check that we don't have the crate list.
|
||||
@ -137,8 +137,8 @@ go-to: "./sub_module/sub_sub_module/index.html"
|
||||
assert-property: (".sidebar", {"clientWidth": "200"})
|
||||
assert-text: (".sidebar > .sidebar-crate > h2 > a", "lib2")
|
||||
assert-text: (".sidebar .location", "Module sub_sub_module")
|
||||
assert-text: (".sidebar > .sidebar-elems > #ModNav > h2", "In lib2::module::sub_module")
|
||||
assert-property: (".sidebar > .sidebar-elems > #ModNav > h2 > a", {
|
||||
assert-text: (".sidebar > .sidebar-elems > #rustdoc-modnav > h2", "In lib2::module::sub_module")
|
||||
assert-property: (".sidebar > .sidebar-elems > #rustdoc-modnav > h2 > a", {
|
||||
"href": "/module/sub_module/index.html",
|
||||
}, ENDS_WITH)
|
||||
assert-text: (".sidebar-elems ul.block > li.current > a", "sub_sub_module")
|
||||
@ -202,32 +202,32 @@ assert-position: (".sidebar-crate > h2 > a", {"x": -3})
|
||||
// Configuration option to show TOC in sidebar.
|
||||
set-local-storage: {"rustdoc-hide-toc": "true"}
|
||||
go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
|
||||
assert-css: ("#TOC", {"display": "none"})
|
||||
assert-css: ("#rustdoc-toc", {"display": "none"})
|
||||
assert-css: (".sidebar .in-crate", {"display": "none"})
|
||||
set-local-storage: {"rustdoc-hide-toc": "false"}
|
||||
go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
|
||||
assert-css: ("#TOC", {"display": "block"})
|
||||
assert-css: ("#rustdoc-toc", {"display": "block"})
|
||||
assert-css: (".sidebar .in-crate", {"display": "block"})
|
||||
|
||||
set-local-storage: {"rustdoc-hide-modnav": "true"}
|
||||
go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
|
||||
assert-css: ("#ModNav", {"display": "none"})
|
||||
assert-css: ("#rustdoc-modnav", {"display": "none"})
|
||||
set-local-storage: {"rustdoc-hide-modnav": "false"}
|
||||
go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
|
||||
assert-css: ("#ModNav", {"display": "block"})
|
||||
assert-css: ("#rustdoc-modnav", {"display": "block"})
|
||||
|
||||
set-local-storage: {"rustdoc-hide-toc": "true"}
|
||||
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
||||
assert-css: ("#TOC", {"display": "none"})
|
||||
assert-css: ("#rustdoc-toc", {"display": "none"})
|
||||
assert-false: ".sidebar .in-crate"
|
||||
set-local-storage: {"rustdoc-hide-toc": "false"}
|
||||
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
||||
assert-css: ("#TOC", {"display": "block"})
|
||||
assert-css: ("#rustdoc-toc", {"display": "block"})
|
||||
assert-false: ".sidebar .in-crate"
|
||||
|
||||
set-local-storage: {"rustdoc-hide-modnav": "true"}
|
||||
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
||||
assert-css: ("#ModNav", {"display": "none"})
|
||||
assert-css: ("#rustdoc-modnav", {"display": "none"})
|
||||
set-local-storage: {"rustdoc-hide-modnav": "false"}
|
||||
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
||||
assert-css: ("#ModNav", {"display": "block"})
|
||||
assert-css: ("#rustdoc-modnav", {"display": "block"})
|
||||
|
@ -1,16 +1,16 @@
|
||||
#![crate_name = "foo"]
|
||||
|
||||
//@ has 'foo/index.html'
|
||||
//@ has - '//section[@id="TOC"]/h3' 'Crate Items'
|
||||
//@ has - '//section[@id="rustdoc-toc"]/h3' 'Crate Items'
|
||||
|
||||
//@ has 'foo/bar/index.html'
|
||||
//@ has - '//section[@id="TOC"]/h3' 'Module Items'
|
||||
//@ has - '//section[@id="rustdoc-toc"]/h3' 'Module Items'
|
||||
pub mod bar {
|
||||
//@ has 'foo/bar/struct.Baz.html'
|
||||
//@ !has - '//section[@id="TOC"]/h3' 'Module Items'
|
||||
//@ !has - '//section[@id="rustdoc-toc"]/h3' 'Module Items'
|
||||
pub struct Baz;
|
||||
}
|
||||
|
||||
//@ has 'foo/baz/index.html'
|
||||
//@ !has - '//section[@id="TOC"]/h3' 'Module Items'
|
||||
//@ !has - '//section[@id="rustdoc-toc"]/h3' 'Module Items'
|
||||
pub mod baz {}
|
||||
|
@ -14,10 +14,10 @@
|
||||
|
||||
//@ has foo/index.html
|
||||
// User header
|
||||
//@ has - '//section[@id="TOC"]/h3' 'Sections'
|
||||
//@ has - '//section[@id="TOC"]/ul[@class="block top-toc"]/li/a[@href="#basic-link-emphasis-very-emphasis-and-code"]/@title' 'Basic link, emphasis, very emphasis and `code`'
|
||||
//@ has - '//section[@id="TOC"]/ul[@class="block top-toc"]/li/a[@href="#basic-link-emphasis-very-emphasis-and-code"]' 'Basic link, emphasis, very emphasis and code'
|
||||
//@ count - '//section[@id="TOC"]/ul[@class="block top-toc"]/li/a[@href="#basic-link-emphasis-very-emphasis-and-code"]/em' 0
|
||||
//@ count - '//section[@id="TOC"]/ul[@class="block top-toc"]/li/a[@href="#basic-link-emphasis-very-emphasis-and-code"]/a' 0
|
||||
//@ count - '//section[@id="TOC"]/ul[@class="block top-toc"]/li/a[@href="#basic-link-emphasis-very-emphasis-and-code"]/code' 1
|
||||
//@ has - '//section[@id="TOC"]/ul[@class="block top-toc"]/li/a[@href="#basic-link-emphasis-very-emphasis-and-code"]/code' 'code'
|
||||
//@ has - '//section[@id="rustdoc-toc"]/h3' 'Sections'
|
||||
//@ has - '//section[@id="rustdoc-toc"]/ul[@class="block top-toc"]/li/a[@href="#basic-link-emphasis-very-emphasis-and-code"]/@title' 'Basic link, emphasis, very emphasis and `code`'
|
||||
//@ has - '//section[@id="rustdoc-toc"]/ul[@class="block top-toc"]/li/a[@href="#basic-link-emphasis-very-emphasis-and-code"]' 'Basic link, emphasis, very emphasis and code'
|
||||
//@ count - '//section[@id="rustdoc-toc"]/ul[@class="block top-toc"]/li/a[@href="#basic-link-emphasis-very-emphasis-and-code"]/em' 0
|
||||
//@ count - '//section[@id="rustdoc-toc"]/ul[@class="block top-toc"]/li/a[@href="#basic-link-emphasis-very-emphasis-and-code"]/a' 0
|
||||
//@ count - '//section[@id="rustdoc-toc"]/ul[@class="block top-toc"]/li/a[@href="#basic-link-emphasis-very-emphasis-and-code"]/code' 1
|
||||
//@ has - '//section[@id="rustdoc-toc"]/ul[@class="block top-toc"]/li/a[@href="#basic-link-emphasis-very-emphasis-and-code"]/code' 'code'
|
||||
|
@ -16,10 +16,10 @@
|
||||
|
||||
//@ has foo/index.html
|
||||
// User header
|
||||
//@ has - '//section[@id="TOC"]/ul[@class="block top-toc"]/li/a[@href="#structs"]' 'Structs'
|
||||
//@ has - '//section[@id="rustdoc-toc"]/ul[@class="block top-toc"]/li/a[@href="#structs"]' 'Structs'
|
||||
//@ has - '//details[@class="toggle top-doc"]/div[@class="docblock"]/h2[@id="structs"]' 'Structs'
|
||||
// Built-in header
|
||||
//@ has - '//section[@id="TOC"]/ul[@class="block"]/li/a[@href="#structs-1"]' 'Structs'
|
||||
//@ has - '//section[@id="rustdoc-toc"]/ul[@class="block"]/li/a[@href="#structs-1"]' 'Structs'
|
||||
//@ has - '//section[@id="main-content"]/h2[@id="structs-1"]' 'Structs'
|
||||
|
||||
/// # Fields
|
||||
@ -31,12 +31,12 @@
|
||||
|
||||
//@ has foo/struct.MyStruct.html
|
||||
// User header
|
||||
//@ has - '//section[@id="TOC"]/ul[@class="block top-toc"]/li/a[@href="#fields-1"]' 'Fields'
|
||||
//@ has - '//section[@id="rustdoc-toc"]/ul[@class="block top-toc"]/li/a[@href="#fields-1"]' 'Fields'
|
||||
//@ has - '//details[@class="toggle top-doc"]/div[@class="docblock"]/h2[@id="fields-1"]' 'Fields'
|
||||
// Only one level of nesting
|
||||
//@ count - '//section[@id="TOC"]/ul[@class="block top-toc"]//a' 2
|
||||
//@ count - '//section[@id="rustdoc-toc"]/ul[@class="block top-toc"]//a' 2
|
||||
// Built-in header
|
||||
//@ has - '//section[@id="TOC"]/h3/a[@href="#fields"]' 'Fields'
|
||||
//@ has - '//section[@id="rustdoc-toc"]/h3/a[@href="#fields"]' 'Fields'
|
||||
//@ has - '//section[@id="main-content"]/h2[@id="fields"]' 'Fields'
|
||||
|
||||
pub struct MyStruct {
|
||||
|
@ -4,4 +4,4 @@
|
||||
|
||||
//@ has foo/index.html
|
||||
// User header
|
||||
//@ !has - '//section[@id="TOC"]/ul[@class="block top-toc"]' 'Basic link and emphasis'
|
||||
//@ !has - '//section[@id="rustdoc-toc"]/ul[@class="block top-toc"]' 'Basic link and emphasis'
|
||||
|
Loading…
Reference in New Issue
Block a user