Skip to content

Commit d7e998d

Browse files
Rename ID "main" into "main-content"
1 parent 1e55c31 commit d7e998d

25 files changed

+88
-90
lines changed

src/librustdoc/html/markdown.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,7 @@ fn init_id_map() -> FxHashMap<String, usize> {
14471447
map.insert("theme-choices".to_owned(), 1);
14481448
map.insert("settings-menu".to_owned(), 1);
14491449
map.insert("help-button".to_owned(), 1);
1450-
map.insert("main".to_owned(), 1);
1450+
map.insert("main-content".to_owned(), 1);
14511451
map.insert("search".to_owned(), 1);
14521452
map.insert("crate-search".to_owned(), 1);
14531453
map.insert("render-detail".to_owned(), 1);

src/librustdoc/html/markdown/tests.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn test_unique_id() {
1212
"examples",
1313
"method.into_iter",
1414
"foo",
15-
"main",
15+
"main-content",
1616
"search",
1717
"methods",
1818
"examples",
@@ -28,7 +28,7 @@ fn test_unique_id() {
2828
"examples-2",
2929
"method.into_iter-1",
3030
"foo-1",
31-
"main-1",
31+
"main-content-1",
3232
"search-1",
3333
"methods",
3434
"examples-3",
@@ -219,8 +219,8 @@ fn test_header_ids_multiple_blocks() {
219219
);
220220
t(
221221
&mut map,
222-
"# Main",
223-
"<h2 id=\"main-1\" class=\"section-header\"><a href=\"#main-1\">Main</a></h2>",
222+
"# Search",
223+
"<h2 id=\"search-1\" class=\"section-header\"><a href=\"#search-1\">Search</a></h2>",
224224
);
225225
t(
226226
&mut map,

src/librustdoc/html/static/css/noscript.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ of content is hidden by default (depending on the settings too), we have to over
44
rules.
55
*/
66

7-
#main .attributes {
7+
#main-content .attributes {
88
/* Since there is no toggle (the "[-]") when JS is disabled, no need for this margin either. */
99
margin-left: 0 !important;
1010
}

src/librustdoc/html/static/css/rustdoc.css

+10-10
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ details.rustdoc-toggle > summary::before,
201201
div.impl-items > div:not(.docblock):not(.item-info),
202202
.content ul.crate a.crate, a.srclink,
203203
/* This selector is for the items listed in the "all items" page. */
204-
#main > ul.docblock > li > a {
204+
#main-content > ul.docblock > li > a {
205205
font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif;
206206
}
207207

@@ -633,10 +633,10 @@ nav.sub {
633633
display: inline-block;
634634
}
635635

636-
#main {
636+
#main-content {
637637
position: relative;
638638
}
639-
#main > .since {
639+
#main-content > .since {
640640
top: inherit;
641641
font-family: "Fira Sans", Arial, sans-serif;
642642
}
@@ -755,7 +755,7 @@ nav.sub {
755755
flex-basis: 100%;
756756
}
757757

758-
#main > .item-info {
758+
#main-content > .item-info {
759759
margin-top: 0;
760760
}
761761

@@ -1521,10 +1521,10 @@ kbd {
15211521
left: -5px;
15221522
}
15231523

1524-
#main > ul {
1524+
#main-content > ul {
15251525
padding-left: 10px;
15261526
}
1527-
#main > ul > li {
1527+
#main-content > ul > li {
15281528
list-style: none;
15291529
}
15301530

@@ -1920,8 +1920,8 @@ details.rustdoc-toggle[open] > summary.hideme::after {
19201920
border-bottom: 1px solid;
19211921
}
19221922

1923-
#main > details.rustdoc-toggle > summary::before,
1924-
#main > div > details.rustdoc-toggle > summary::before {
1923+
#main-content > details.rustdoc-toggle > summary::before,
1924+
#main-content > div > details.rustdoc-toggle > summary::before {
19251925
left: -11px;
19261926
}
19271927

@@ -1954,7 +1954,7 @@ details.rustdoc-toggle[open] > summary.hideme::after {
19541954
z-index: 11;
19551955
}
19561956

1957-
#main > .line-numbers {
1957+
#main-content > .line-numbers {
19581958
margin-top: 0;
19591959
}
19601960

@@ -2008,7 +2008,7 @@ details.rustdoc-toggle[open] > summary.hideme::after {
20082008
height: 73px;
20092009
}
20102010

2011-
#main > table:not(.table-display) td {
2011+
#main-content > table:not(.table-display) td {
20122012
word-break: break-word;
20132013
width: 50%;
20142014
}

src/librustdoc/html/static/js/main.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ function getVirtualKey(ev) {
9494

9595
var THEME_PICKER_ELEMENT_ID = "theme-picker";
9696
var THEMES_ELEMENT_ID = "theme-choices";
97+
var MAIN_ID = "main-content";
9798

9899
function getThemesElement() {
99100
return document.getElementById(THEMES_ELEMENT_ID);
@@ -362,7 +363,7 @@ function hideThemeButtonState() {
362363
}
363364

364365
var toggleAllDocsId = "toggle-all-docs";
365-
var main = document.getElementById("main");
366+
var main = document.getElementById(MAIN_ID);
366367
var savedHash = "";
367368

368369
function handleHashes(ev) {
@@ -787,7 +788,7 @@ function hideThemeButtonState() {
787788
} else {
788789
addClass(innerToggle, "will-expand");
789790
onEachLazy(document.getElementsByClassName("rustdoc-toggle"), function(e) {
790-
if (e.parentNode.id !== "main" ||
791+
if (e.parentNode.id !== MAIN_ID ||
791792
(!hasClass(e, "implementors-toggle") &&
792793
!hasClass(e, "type-contents-toggle")))
793794
{

src/librustdoc/html/static/js/source-script.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,17 @@ function createSourceSidebar() {
113113
if (!window.rootPath.endsWith("/")) {
114114
window.rootPath += "/";
115115
}
116-
var main = document.querySelector("nav.sidebar");
116+
var container = document.querySelector("nav.sidebar");
117117

118118
var sidebarToggle = createSidebarToggle();
119-
main.insertBefore(sidebarToggle, main.firstChild);
119+
container.insertBefore(sidebarToggle, container.firstChild);
120120

121121
var sidebar = document.createElement("div");
122122
sidebar.id = "source-sidebar";
123123
if (getCurrentValue("rustdoc-source-sidebar-show") !== "true") {
124-
main.classList.remove("expanded");
124+
container.classList.remove("expanded");
125125
} else {
126-
main.classList.add("expanded");
126+
container.classList.add("expanded");
127127
}
128128

129129
var currentFile = getCurrentFilePath();
@@ -139,7 +139,7 @@ function createSourceSidebar() {
139139
currentFile, hasFoundFile);
140140
});
141141

142-
main.insertBefore(sidebar, document.querySelector(".sidebar-logo").nextSibling);
142+
container.insertBefore(sidebar, document.querySelector(".sidebar-logo").nextSibling);
143143
// Focus on the current file in the source files sidebar.
144144
var selected_elem = sidebar.getElementsByClassName("selected")[0];
145145
if (typeof selected_elem !== "undefined") {

src/librustdoc/html/templates/page.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
</form> {#- -#}
126126
</nav> {#- -#}
127127
</div> {#- -#}
128-
<section id="main" class="content">{{- content | safe -}}</section> {#- -#}
128+
<section id="main-content" class="content">{{- content | safe -}}</section> {#- -#}
129129
<section id="search" class="content hidden"></section> {#- -#}
130130
</div> {#- -#}
131131
</main> {#- -#}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This test ensures that the docblock elements have the appropriate left margin.
22
goto: file://|DOC_PATH|/test_docs/fn.foo.html
33
// The top docblock elements shouldn't have left margin...
4-
assert-css: ("#main .docblock.item-decl", {"margin-left": "0px"})
4+
assert-css: ("#main-content .docblock.item-decl", {"margin-left": "0px"})
55
// ... but all the others should!
6-
assert-css: ("#main .docblock:not(.item-decl)", {"margin-left": "24px"})
6+
assert-css: ("#main-content .docblock:not(.item-decl)", {"margin-left": "24px"})

src/test/rustdoc-gui/escape-key.goml

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ goto: file://|DOC_PATH|/test_docs/index.html
33
write: (".search-input", "test")
44
wait-for: "#search > h1" // The search element is empty before the first search
55
assert-attribute: ("#search", {"class": "content"})
6-
assert-attribute: ("#main", {"class": "content hidden"})
6+
assert-attribute: ("#main-content", {"class": "content hidden"})
77
press-key: "Escape"
88
assert-attribute: ("#search", {"class": "content hidden"})
9-
assert-attribute: ("#main", {"class": "content"})
9+
assert-attribute: ("#main-content", {"class": "content"})
1010

1111
// Check that focusing the search input brings back the search results
1212
focus: ".search-input"
1313
assert-attribute: ("#search", {"class": "content"})
14-
assert-attribute: ("#main", {"class": "content hidden"})
14+
assert-attribute: ("#main-content", {"class": "content hidden"})
1515

1616
// Now let's check that when the help popup is displayed and we press Escape, it doesn't
1717
// hide the search results too.
@@ -20,7 +20,7 @@ assert-attribute: ("#help", {"class": ""})
2020
press-key: "Escape"
2121
assert-attribute: ("#help", {"class": "hidden"})
2222
assert-attribute: ("#search", {"class": "content"})
23-
assert-attribute: ("#main", {"class": "content hidden"})
23+
assert-attribute: ("#main-content", {"class": "content hidden"})
2424

2525
// Check that Escape hides the search results when a search result is focused.
2626
focus: ".search-input"
@@ -31,4 +31,4 @@ assert: "#results a:focus"
3131
press-key: "Escape"
3232
assert-attribute: ("#help", {"class": "hidden"})
3333
assert-attribute: ("#search", {"class": "content hidden"})
34-
assert-attribute: ("#main", {"class": "content"})
34+
assert-attribute: ("#main-content", {"class": "content"})
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// This test ensures that the impl blocks are open by default.
22
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
3-
assert-attribute: ("#main > details.implementors-toggle", {"open": ""})
3+
assert-attribute: ("#main-content > details.implementors-toggle", {"open": ""})

src/test/rustdoc-gui/search-result-go-to-first.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ goto: file://|DOC_PATH|/test_docs/index.html?search=struct%3AFoo
1111
wait-for: "#titles"
1212
assert-text-false: (".fqn .in-band", "Struct test_docs::Foo")
1313
// Ensure that the search results are displayed, not the "normal" content.
14-
assert-css: ("#main", {"display": "none"})
14+
assert-css: ("#main-content", {"display": "none"})
1515

1616
// Now we can check that the feature is working as expected!
1717
goto: file://|DOC_PATH|/test_docs/index.html?search=struct%3AFoo&go_to_first=true

src/test/rustdoc-gui/toggle-docs.goml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
goto: file://|DOC_PATH|/test_docs/index.html
2-
assert-attribute: ("#main > details.top-doc", {"open": ""})
2+
assert-attribute: ("#main-content > details.top-doc", {"open": ""})
33
click: "#toggle-all-docs"
44
wait-for: 1000
55
// This is now collapsed so there shouldn't be the "open" attribute on details.
6-
assert-attribute-false: ("#main > details.top-doc", {"open": ""})
6+
assert-attribute-false: ("#main-content > details.top-doc", {"open": ""})
77
click: "#toggle-all-docs"
88
wait-for: 1000
99
// Not collapsed anymore so the "open" attribute should be back.
10-
assert-attribute: ("#main > details.top-doc", {"open": ""})
10+
assert-attribute: ("#main-content > details.top-doc", {"open": ""})

src/test/rustdoc-gui/type-declation-overflow.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ assert-property: (".item-decl pre", {"scrollWidth": "1324"})
1111
goto: file://|DOC_PATH|/lib2/too_long/type.ReallyLongTypeNameLongLongLong.html
1212
assert-property: ("body", {"scrollWidth": "1100"})
1313
// We now check that the section width hasn't grown because of it.
14-
assert-property: ("#main", {"scrollWidth": "840"})
14+
assert-property: ("#main-content", {"scrollWidth": "840"})
1515
// And now checking that it has scrollable content.
1616
assert-property: (".item-decl pre", {"scrollWidth": "1103"})
1717

@@ -20,6 +20,6 @@ assert-property: (".item-decl pre", {"scrollWidth": "1103"})
2020
goto: file://|DOC_PATH|/lib2/too_long/constant.ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong.html
2121
assert-property: ("body", {"scrollWidth": "1100"})
2222
// We now check that the section width hasn't grown because of it.
23-
assert-property: ("#main", {"scrollWidth": "840"})
23+
assert-property: ("#main-content", {"scrollWidth": "840"})
2424
// And now checking that it has scrollable content.
2525
assert-property: (".item-decl pre", {"scrollWidth": "950"})

src/test/rustdoc/doc-cfg.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@
22
#![feature(target_feature, cfg_target_feature)]
33

44
// @has doc_cfg/struct.Portable.html
5-
// @!has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' ''
5+
// @!has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' ''
66
// @has - '//*[@id="method.unix_and_arm_only_function"]' 'fn unix_and_arm_only_function()'
77
// @has - '//*[@class="stab portability"]' 'This is supported on Unix and ARM only.'
88
// @has - '//*[@id="method.wasi_and_wasm32_only_function"]' 'fn wasi_and_wasm32_only_function()'
99
// @has - '//*[@class="stab portability"]' 'This is supported on WASI and WebAssembly only.'
1010
pub struct Portable;
1111

1212
// @has doc_cfg/unix_only/index.html \
13-
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
13+
// '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
1414
// 'This is supported on Unix only.'
1515
// @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\AARM\Z'
1616
// @count - '//*[@class="stab portability"]' 2
1717
#[doc(cfg(unix))]
1818
pub mod unix_only {
1919
// @has doc_cfg/unix_only/fn.unix_only_function.html \
20-
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
20+
// '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
2121
// 'This is supported on Unix only.'
2222
// @count - '//*[@class="stab portability"]' 1
2323
pub fn unix_only_function() {
2424
content::should::be::irrelevant();
2525
}
2626

2727
// @has doc_cfg/unix_only/trait.ArmOnly.html \
28-
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
28+
// '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
2929
// 'This is supported on Unix and ARM only.'
3030
// @count - '//*[@class="stab portability"]' 1
3131
#[doc(cfg(target_arch = "arm"))]
@@ -40,22 +40,22 @@ pub mod unix_only {
4040
}
4141

4242
// @has doc_cfg/wasi_only/index.html \
43-
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
43+
// '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
4444
// 'This is supported on WASI only.'
4545
// @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\AWebAssembly\Z'
4646
// @count - '//*[@class="stab portability"]' 2
4747
#[doc(cfg(target_os = "wasi"))]
4848
pub mod wasi_only {
4949
// @has doc_cfg/wasi_only/fn.wasi_only_function.html \
50-
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
50+
// '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
5151
// 'This is supported on WASI only.'
5252
// @count - '//*[@class="stab portability"]' 1
5353
pub fn wasi_only_function() {
5454
content::should::be::irrelevant();
5555
}
5656

5757
// @has doc_cfg/wasi_only/trait.Wasm32Only.html \
58-
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
58+
// '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
5959
// 'This is supported on WASI and WebAssembly only.'
6060
// @count - '//*[@class="stab portability"]' 1
6161
#[doc(cfg(target_arch = "wasm32"))]
@@ -77,15 +77,15 @@ pub mod wasi_only {
7777
// @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\Aavx\Z'
7878

7979
// @has doc_cfg/fn.uses_target_feature.html
80-
// @has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
80+
// @has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
8181
// 'This is supported with target feature avx only.'
8282
#[target_feature(enable = "avx")]
8383
pub unsafe fn uses_target_feature() {
8484
content::should::be::irrelevant();
8585
}
8686

8787
// @has doc_cfg/fn.uses_cfg_target_feature.html
88-
// @has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
88+
// @has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
8989
// 'This is supported with target feature avx only.'
9090
#[doc(cfg(target_feature = "avx"))]
9191
pub fn uses_cfg_target_feature() {
@@ -94,7 +94,7 @@ pub fn uses_cfg_target_feature() {
9494

9595
// multiple attributes should be allowed
9696
// @has doc_cfg/fn.multiple_attrs.html \
97-
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
97+
// '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
9898
// 'This is supported on x and y and z only.'
9999
#[doc(inline, cfg(x))]
100100
#[doc(cfg(y), cfg(z))]

src/test/rustdoc/duplicate_impls/issue-33054.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// @has - '//h3[@class="code-header in-band"]' 'impl Foo'
33
// @has - '//h3[@class="code-header in-band"]' 'impl Bar for Foo'
44
// @count - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]' 1
5-
// @count - '//*[@id="main"]/details/summary/*[@class="impl has-srclink"]' 1
5+
// @count - '//*[@id="main-content"]/details/summary/*[@class="impl has-srclink"]' 1
66
// @has issue_33054/impls/bar/trait.Bar.html
77
// @has - '//h3[@class="code-header in-band"]' 'impl Bar for Foo'
88
// @count - '//*[@class="struct"]' 1

0 commit comments

Comments
 (0)