about summary refs log tree commit diff
path: root/src/librustdoc/html
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-07-15 19:42:53 +0200
committerGitHub <noreply@github.com>2023-07-15 19:42:53 +0200
commit331b5badddd37f499ff29add68d8c5bf61f3d7ae (patch)
treec632236946fef390b3ce24f9ef069553f1147a96 /src/librustdoc/html
parentd0ef799156d052b8404b9938b1ad221759f27d07 (diff)
parentd7d0a4533c80a0d69f50b4f736a55f0bb4d55e81 (diff)
downloadrust-331b5badddd37f499ff29add68d8c5bf61f3d7ae.tar.gz
rust-331b5badddd37f499ff29add68d8c5bf61f3d7ae.zip
Rollup merge of #113709 - notriddle:notriddle/src, r=GuillaumeGomez
rustdoc: use src consistently over source in CSS/JS

The two terms have been used, inconsistently, in closely related spots like the `src/` directory vs `source-files.js`, and with things like `src-sidebar-toggle` vs the `source-sidebar`. This PR changes most use of `source` to `src` instead (except the localStorage configuration variables, which would be very complicated to migrate).

It also renames `.srclink` to `.src`. This is mostly aiming to cut out one of those many little peanut-butter bits of bloat, and is consistent with how other link classes are done (like how you have `a.mod` stylesheet rules, but there's also a `mod` class put on the body tag).
Diffstat (limited to 'src/librustdoc/html')
-rw-r--r--src/librustdoc/html/render/mod.rs4
-rw-r--r--src/librustdoc/html/render/write_shared.rs8
-rw-r--r--src/librustdoc/html/sources.rs2
-rw-r--r--src/librustdoc/html/static/css/noscript.css2
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css60
-rw-r--r--src/librustdoc/html/static/css/themes/ayu.css14
-rw-r--r--src/librustdoc/html/static/css/themes/dark.css4
-rw-r--r--src/librustdoc/html/static/css/themes/light.css4
-rw-r--r--src/librustdoc/html/static/js/src-script.js (renamed from src/librustdoc/html/static/js/source-script.js)32
-rw-r--r--src/librustdoc/html/static/js/storage.js2
-rw-r--r--src/librustdoc/html/static_files.rs2
-rw-r--r--src/librustdoc/html/templates/page.html16
-rw-r--r--src/librustdoc/html/templates/print_item.html2
13 files changed, 76 insertions, 76 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 8a1ce9fb135..575ce6aa99a 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -1821,9 +1821,9 @@ fn render_rightside(
     );
     if let Some(l) = src_href {
         if has_stability {
-            write!(rightside, " · <a class=\"srclink\" href=\"{}\">source</a>", l)
+            write!(rightside, " · <a class=\"src\" href=\"{}\">source</a>", l)
         } else {
-            write!(rightside, "<a class=\"srclink rightside\" href=\"{}\">source</a>", l)
+            write!(rightside, "<a class=\"src rightside\" href=\"{}\">source</a>", l)
         }
     }
     if has_stability && has_src_ref {
diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs
index 54749e9a317..3f41765a5af 100644
--- a/src/librustdoc/html/render/write_shared.rs
+++ b/src/librustdoc/html/render/write_shared.rs
@@ -270,7 +270,7 @@ pub(super) fn write_shared(
             hierarchy.add_path(source);
         }
         let hierarchy = Rc::try_unwrap(hierarchy).unwrap();
-        let dst = cx.dst.join(&format!("source-files{}.js", cx.shared.resource_suffix));
+        let dst = cx.dst.join(&format!("src-files{}.js", cx.shared.resource_suffix));
         let make_sources = || {
             let (mut all_sources, _krates) =
                 try_err!(collect_json(&dst, krate.name(cx.tcx()).as_str()), &dst);
@@ -286,12 +286,12 @@ pub(super) fn write_shared(
                     .replace("\\\"", "\\\\\"")
             ));
             all_sources.sort();
-            let mut v = String::from("var sourcesIndex = JSON.parse('{\\\n");
+            let mut v = String::from("var srcIndex = JSON.parse('{\\\n");
             v.push_str(&all_sources.join(",\\\n"));
-            v.push_str("\\\n}');\ncreateSourceSidebar();\n");
+            v.push_str("\\\n}');\ncreateSrcSidebar();\n");
             Ok(v.into_bytes())
         };
-        write_invocation_specific("source-files.js", &make_sources)?;
+        write_invocation_specific("src-files.js", &make_sources)?;
     }
 
     // Update the search index and crate list.
diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs
index a26fa374912..3e3fc8a0e72 100644
--- a/src/librustdoc/html/sources.rs
+++ b/src/librustdoc/html/sources.rs
@@ -227,7 +227,7 @@ impl SourceCollector<'_, '_> {
         let desc = format!("Source of the Rust file `{}`.", filename.prefer_remapped());
         let page = layout::Page {
             title: &title,
-            css_class: "source",
+            css_class: "src",
             root_path: &root_path,
             static_root_path: shared.static_root_path.as_deref(),
             description: &desc,
diff --git a/src/librustdoc/html/static/css/noscript.css b/src/librustdoc/html/static/css/noscript.css
index 54e8b6561f3..93aa11a5852 100644
--- a/src/librustdoc/html/static/css/noscript.css
+++ b/src/librustdoc/html/static/css/noscript.css
@@ -19,7 +19,7 @@ nav.sub {
 	display: none;
 }
 
-.source .sidebar {
+.src .sidebar {
 	display: none;
 }
 
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index b7f455259ef..9209915895a 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -194,7 +194,7 @@ h1, h2, h3, h4, h5, h6,
 .item-name > a,
 .out-of-band,
 span.since,
-a.srclink,
+a.src,
 #help-button > a,
 summary.hideme,
 .scraped-example-list,
@@ -206,7 +206,7 @@ ul.all-items {
 #toggle-all-docs,
 a.anchor,
 .small-section-header a,
-#source-sidebar a,
+#src-sidebar a,
 .rust a,
 .sidebar h2 a,
 .sidebar h3 a,
@@ -315,7 +315,7 @@ main {
 	min-width: 0; /* avoid growing beyond the size limit */
 }
 
-.source main {
+.src main {
 	padding: 15px;
 }
 
@@ -350,10 +350,10 @@ pre.item-decl {
 	contain: initial;
 }
 
-.source .content pre {
+.src .content pre {
 	padding: 20px;
 }
-.rustdoc.source .example-wrap pre.src-line-numbers  {
+.rustdoc.src .example-wrap pre.src-line-numbers  {
 	padding: 20px 0 20px 4px;
 }
 
@@ -392,7 +392,7 @@ img {
 	left: 0;
 }
 
-.rustdoc.source .sidebar {
+.rustdoc.src .sidebar {
 	flex-basis: 50px;
 	border-right: 1px solid;
 	overflow-x: hidden;
@@ -402,7 +402,7 @@ img {
 }
 
 .sidebar, .mobile-topbar, .sidebar-menu-toggle,
-#src-sidebar-toggle, #source-sidebar {
+#src-sidebar-toggle, #src-sidebar {
 	background-color: var(--sidebar-background-color);
 }
 
@@ -410,16 +410,16 @@ img {
 	background-color: var(--sidebar-background-color-hover);
 }
 
-.source .sidebar > *:not(#src-sidebar-toggle) {
+.src .sidebar > *:not(#src-sidebar-toggle) {
 	visibility: hidden;
 }
 
-.source-sidebar-expanded .source .sidebar {
+.src-sidebar-expanded .src .sidebar {
 	overflow-y: auto;
 	flex-basis: 300px;
 }
 
-.source-sidebar-expanded .source .sidebar > *:not(#src-sidebar-toggle) {
+.src-sidebar-expanded .src .sidebar > *:not(#src-sidebar-toggle) {
 	visibility: visible;
 }
 
@@ -544,7 +544,7 @@ ul.block, .block li {
 	flex-grow: 1;
 }
 
-.rustdoc:not(.source) .example-wrap pre {
+.rustdoc:not(.src) .example-wrap pre {
 	overflow: auto hidden;
 }
 
@@ -619,7 +619,7 @@ ul.block, .block li {
 }
 
 .docblock code, .docblock-short code,
-pre, .rustdoc.source .example-wrap {
+pre, .rustdoc.src .example-wrap {
 	background-color: var(--code-block-background-color);
 }
 
@@ -676,7 +676,7 @@ nav.sub {
 	height: 34px;
 	flex-grow: 1;
 }
-.source nav.sub {
+.src nav.sub {
 	margin: 0 0 15px 0;
 }
 
@@ -1074,7 +1074,7 @@ pre.rust .doccomment {
 	color: var(--code-highlight-doc-comment-color);
 }
 
-.rustdoc.source .example-wrap pre.rust a {
+.rustdoc.src .example-wrap pre.rust a {
 	background: var(--codeblock-link-background);
 }
 
@@ -1301,22 +1301,22 @@ a.tooltip:hover::after {
 	align-items: stretch;
 	z-index: 10;
 }
-#source-sidebar {
+#src-sidebar {
 	width: 100%;
 	overflow: auto;
 }
-#source-sidebar > .title {
+#src-sidebar > .title {
 	font-size: 1.5rem;
 	text-align: center;
 	border-bottom: 1px solid var(--border-color);
 	margin-bottom: 6px;
 }
-#source-sidebar div.files > a:hover, details.dir-entry summary:hover,
-#source-sidebar div.files > a:focus, details.dir-entry summary:focus {
-	background-color: var(--source-sidebar-background-hover);
+#src-sidebar div.files > a:hover, details.dir-entry summary:hover,
+#src-sidebar div.files > a:focus, details.dir-entry summary:focus {
+	background-color: var(--src-sidebar-background-hover);
 }
-#source-sidebar div.files > a.selected {
-	background-color: var(--source-sidebar-background-selected);
+#src-sidebar div.files > a.selected {
+	background-color: var(--src-sidebar-background-selected);
 }
 #src-sidebar-toggle > button {
 	font-size: inherit;
@@ -1562,7 +1562,7 @@ However, it's not needed with smaller screen width because the doc/code block is
 /*
 WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY
 If you update this line, then you also need to update the line with the same warning
-in source-script.js
+in src-script.js
 */
 @media (max-width: 700px) {
 	/* When linking to an item with an `id` (for instance, by clicking a link in the sidebar,
@@ -1619,8 +1619,8 @@ in source-script.js
 
 	/* The source view uses a different design for the sidebar toggle, and doesn't have a topbar,
 	   so don't bump down the main content or the sidebar. */
-	.source main,
-	.rustdoc.source .sidebar {
+	.src main,
+	.rustdoc.src .sidebar {
 		top: 0;
 		padding: 0;
 		height: 100vh;
@@ -1628,8 +1628,8 @@ in source-script.js
 	}
 
 	.sidebar.shown,
-	.source-sidebar-expanded .source .sidebar,
-	.rustdoc:not(.source) .sidebar:focus-within {
+	.src-sidebar-expanded .src .sidebar,
+	.rustdoc:not(.src) .sidebar:focus-within {
 		left: 0;
 	}
 
@@ -1709,7 +1709,7 @@ in source-script.js
 		border-left: 0;
 	}
 
-	.source-sidebar-expanded #src-sidebar-toggle {
+	.src-sidebar-expanded #src-sidebar-toggle {
 		left: unset;
 		top: unset;
 		width: unset;
@@ -1749,7 +1749,7 @@ in source-script.js
 		display: inline;
 	}
 
-	.source-sidebar-expanded .source .sidebar {
+	.src-sidebar-expanded .src .sidebar {
 		max-width: 100vw;
 		width: 100vw;
 	}
@@ -1769,7 +1769,7 @@ in source-script.js
 		margin-left: 34px;
 	}
 
-	.source nav.sub {
+	.src nav.sub {
 		margin: 0;
 		padding: var(--nav-sub-mobile-padding);
 	}
@@ -1792,7 +1792,7 @@ in source-script.js
 }
 
 @media print {
-	nav.sidebar, nav.sub, .out-of-band, a.srclink, #copy-path,
+	nav.sidebar, nav.sub, .out-of-band, a.src, #copy-path,
 	details.toggle[open] > summary::before, details.toggle > summary::before,
 	details.toggle.top-doc > summary {
 		display: none;
diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css
index 7145baad256..d8dae51eb1b 100644
--- a/src/librustdoc/html/static/css/themes/ayu.css
+++ b/src/librustdoc/html/static/css/themes/ayu.css
@@ -89,8 +89,8 @@ Original by Dempfi (https://github.com/dempfi/ayu)
 	--crate-search-div-hover-filter: invert(98%) sepia(12%) saturate(81%) hue-rotate(343deg)
 		brightness(113%) contrast(76%);
 	--crate-search-hover-border: #e0e0e0;
-	--source-sidebar-background-selected: #14191f;
-	--source-sidebar-background-hover: #14191f;
+	--src-sidebar-background-selected: #14191f;
+	--src-sidebar-background-hover: #14191f;
 	--table-alt-row-background-color: #191f26;
 	--codeblock-link-background: #333;
 	--scrape-example-toggle-line-background: #999;
@@ -107,7 +107,7 @@ Original by Dempfi (https://github.com/dempfi/ayu)
 
 h1, h2, h3, h4,
 h1 a, .sidebar h2 a, .sidebar h3 a,
-#source-sidebar > .title {
+#src-sidebar > .title {
 	color: #fff;
 }
 h4 {
@@ -124,15 +124,15 @@ h4 {
 .docblock pre > code,
 pre, pre > code,
 .item-info code,
-.rustdoc.source .example-wrap {
+.rustdoc.src .example-wrap {
 	color: #e6e1cf;
 }
 
 .sidebar .current,
 .sidebar a:hover,
-#source-sidebar div.files > a:hover, details.dir-entry summary:hover,
-#source-sidebar div.files > a:focus, details.dir-entry summary:focus,
-#source-sidebar div.files > a.selected {
+#src-sidebar div.files > a:hover, details.dir-entry summary:hover,
+#src-sidebar div.files > a:focus, details.dir-entry summary:focus,
+#src-sidebar div.files > a.selected {
 	color: #ffb44c;
 }
 
diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css
index 3c1186a5649..b653f61d536 100644
--- a/src/librustdoc/html/static/css/themes/dark.css
+++ b/src/librustdoc/html/static/css/themes/dark.css
@@ -84,8 +84,8 @@
 	--crate-search-div-hover-filter: invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg)
 		brightness(100%) contrast(91%);
 	--crate-search-hover-border: #2196f3;
-	--source-sidebar-background-selected: #333;
-	--source-sidebar-background-hover: #444;
+	--src-sidebar-background-selected: #333;
+	--src-sidebar-background-hover: #444;
 	--table-alt-row-background-color: #2A2A2A;
 	--codeblock-link-background: #333;
 	--scrape-example-toggle-line-background: #999;
diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css
index f8c287137de..6be25fc0544 100644
--- a/src/librustdoc/html/static/css/themes/light.css
+++ b/src/librustdoc/html/static/css/themes/light.css
@@ -81,8 +81,8 @@
 	--crate-search-div-hover-filter: invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg)
 		brightness(96%) contrast(93%);
 	--crate-search-hover-border: #717171;
-	--source-sidebar-background-selected: #fff;
-	--source-sidebar-background-hover: #e0e0e0;
+	--src-sidebar-background-selected: #fff;
+	--src-sidebar-background-hover: #e0e0e0;
 	--table-alt-row-background-color: #F5F5F5;
 	--codeblock-link-background: #eee;
 	--scrape-example-toggle-line-background: #ccc;
diff --git a/src/librustdoc/html/static/js/source-script.js b/src/librustdoc/html/static/js/src-script.js
index 6eb99136040..679c2341f02 100644
--- a/src/librustdoc/html/static/js/source-script.js
+++ b/src/librustdoc/html/static/js/src-script.js
@@ -1,5 +1,5 @@
 // From rust:
-/* global sourcesIndex */
+/* global srcIndex */
 
 // Local js definitions:
 /* global addClass, getCurrentValue, onEachLazy, removeClass, browserSupportsHistoryApi */
@@ -74,11 +74,11 @@ function createDirEntry(elem, parent, fullPath, hasFoundFile) {
 function toggleSidebar() {
     const child = this.parentNode.children[0];
     if (child.innerText === ">") {
-        addClass(document.documentElement, "source-sidebar-expanded");
+        addClass(document.documentElement, "src-sidebar-expanded");
         child.innerText = "<";
         updateLocalStorage("source-sidebar-show", "true");
     } else {
-        removeClass(document.documentElement, "source-sidebar-expanded");
+        removeClass(document.documentElement, "src-sidebar-expanded");
         child.innerText = ">";
         updateLocalStorage("source-sidebar-show", "false");
     }
@@ -101,16 +101,16 @@ function createSidebarToggle() {
     return sidebarToggle;
 }
 
-// This function is called from "source-files.js", generated in `html/render/write_shared.rs`.
+// This function is called from "src-files.js", generated in `html/render/write_shared.rs`.
 // eslint-disable-next-line no-unused-vars
-function createSourceSidebar() {
+function createSrcSidebar() {
     const container = document.querySelector("nav.sidebar");
 
     const sidebarToggle = createSidebarToggle();
     container.insertBefore(sidebarToggle, container.firstChild);
 
     const sidebar = document.createElement("div");
-    sidebar.id = "source-sidebar";
+    sidebar.id = "src-sidebar";
 
     let hasFoundFile = false;
 
@@ -118,9 +118,9 @@ function createSourceSidebar() {
     title.className = "title";
     title.innerText = "Files";
     sidebar.appendChild(title);
-    Object.keys(sourcesIndex).forEach(key => {
-        sourcesIndex[key][NAME_OFFSET] = key;
-        hasFoundFile = createDirEntry(sourcesIndex[key], sidebar, "", hasFoundFile);
+    Object.keys(srcIndex).forEach(key => {
+        srcIndex[key][NAME_OFFSET] = key;
+        hasFoundFile = createDirEntry(srcIndex[key], sidebar, "", hasFoundFile);
     });
 
     container.appendChild(sidebar);
@@ -133,7 +133,7 @@ function createSourceSidebar() {
 
 const lineNumbersRegex = /^#?(\d+)(?:-(\d+))?$/;
 
-function highlightSourceLines(match) {
+function highlightSrcLines(match) {
     if (typeof match === "undefined") {
         match = window.location.hash.match(lineNumbersRegex);
     }
@@ -172,7 +172,7 @@ function highlightSourceLines(match) {
     }
 }
 
-const handleSourceHighlight = (function() {
+const handleSrcHighlight = (function() {
     let prev_line_id = 0;
 
     const set_fragment = name => {
@@ -180,7 +180,7 @@ const handleSourceHighlight = (function() {
             y = window.scrollY;
         if (browserSupportsHistoryApi()) {
             history.replaceState(null, null, "#" + name);
-            highlightSourceLines();
+            highlightSrcLines();
         } else {
             location.replace("#" + name);
         }
@@ -221,15 +221,15 @@ const handleSourceHighlight = (function() {
 window.addEventListener("hashchange", () => {
     const match = window.location.hash.match(lineNumbersRegex);
     if (match) {
-        return highlightSourceLines(match);
+        return highlightSrcLines(match);
     }
 });
 
 onEachLazy(document.getElementsByClassName("src-line-numbers"), el => {
-    el.addEventListener("click", handleSourceHighlight);
+    el.addEventListener("click", handleSrcHighlight);
 });
 
-highlightSourceLines();
+highlightSrcLines();
 
-window.createSourceSidebar = createSourceSidebar;
+window.createSrcSidebar = createSrcSidebar;
 })();
diff --git a/src/librustdoc/html/static/js/storage.js b/src/librustdoc/html/static/js/storage.js
index 71961f6f2a9..af3ca42a6c0 100644
--- a/src/librustdoc/html/static/js/storage.js
+++ b/src/librustdoc/html/static/js/storage.js
@@ -185,7 +185,7 @@ updateTheme();
 if (getSettingValue("source-sidebar-show") === "true") {
     // At this point in page load, `document.body` is not available yet.
     // Set a class on the `<html>` element instead.
-    addClass(document.documentElement, "source-sidebar-expanded");
+    addClass(document.documentElement, "src-sidebar-expanded");
 }
 
 // If we navigate away (for example to a settings page), and then use the back or
diff --git a/src/librustdoc/html/static_files.rs b/src/librustdoc/html/static_files.rs
index 767b974cc91..5d2e4b073c1 100644
--- a/src/librustdoc/html/static_files.rs
+++ b/src/librustdoc/html/static_files.rs
@@ -97,7 +97,7 @@ static_files! {
     main_js => "static/js/main.js",
     search_js => "static/js/search.js",
     settings_js => "static/js/settings.js",
-    source_script_js => "static/js/source-script.js",
+    src_script_js => "static/js/src-script.js",
     storage_js => "static/js/storage.js",
     scrape_examples_js => "static/js/scrape-examples.js",
     wheel_svg => "static/images/wheel.svg",
diff --git a/src/librustdoc/html/templates/page.html b/src/librustdoc/html/templates/page.html
index d4ec9c34b6f..60ccfe4da44 100644
--- a/src/librustdoc/html/templates/page.html
+++ b/src/librustdoc/html/templates/page.html
@@ -42,9 +42,9 @@
     <script src="{{static_root_path|safe}}{{files.storage_js}}"></script> {# #}
     {% if page.css_class.contains("crate") %}
     <script defer src="{{page.root_path|safe}}crates{{page.resource_suffix}}.js"></script> {# #}
-    {% else if page.css_class == "source" %}
-    <script defer src="{{static_root_path|safe}}{{files.source_script_js}}"></script> {# #}
-    <script defer src="{{page.root_path|safe}}source-files{{page.resource_suffix}}.js"></script> {# #}
+    {% else if page.css_class == "src" %}
+    <script defer src="{{static_root_path|safe}}{{files.src_script_js}}"></script> {# #}
+    <script defer src="{{page.root_path|safe}}src-files{{page.resource_suffix}}.js"></script> {# #}
     {% else if !page.css_class.contains("mod") %}
     <script defer src="sidebar-items{{page.resource_suffix}}.js"></script> {# #}
     {% endif %}
@@ -85,7 +85,7 @@
     </div> {# #}
     <![endif]--> {# #}
     {{ layout.external_html.before_content|safe }}
-    {% if page.css_class != "source" %}
+    {% if page.css_class != "src" %}
     <nav class="mobile-topbar"> {# #}
         <button class="sidebar-menu-toggle">&#9776;</button> {# #}
         <a class="logo-container" href="{{page.root_path|safe}}{{krate_with_trailing_slash|safe}}index.html"> {# #}
@@ -99,7 +99,7 @@
     </nav> {# #}
     {% endif %}
     <nav class="sidebar"> {# #}
-        {% if page.css_class != "source" %}
+        {% if page.css_class != "src" %}
         <a class="logo-container" href="{{page.root_path|safe}}{{krate_with_trailing_slash|safe}}index.html"> {# #}
             {% if !layout.logo.is_empty() %}
                 <img src="{{layout.logo}}" alt="logo"> {# #}
@@ -111,9 +111,9 @@
         {{ sidebar|safe }}
     </nav> {# #}
     <main> {# #}
-        {% if page.css_class != "source" %}<div class="width-limiter">{% endif %}
+        {% if page.css_class != "src" %}<div class="width-limiter">{% endif %}
             <nav class="sub"> {# #}
-                {% if page.css_class == "source" %}
+                {% if page.css_class == "src" %}
                 <a class="sub-logo-container" href="{{page.root_path|safe}}{{krate_with_trailing_slash|safe}}index.html"> {# #}
                     {% if !layout.logo.is_empty() %}
                         <img src="{{layout.logo}}" alt="logo"> {# #}
@@ -144,7 +144,7 @@
                 </form> {# #}
             </nav> {# #}
             <section id="main-content" class="content">{{ content|safe }}</section> {# #}
-        {% if page.css_class != "source" %}</div>{% endif %}
+        {% if page.css_class != "src" %}</div>{% endif %}
     </main> {# #}
     {{ layout.external_html.after_content|safe }}
 </body> {# #}
diff --git a/src/librustdoc/html/templates/print_item.html b/src/librustdoc/html/templates/print_item.html
index 68a295ae095..1d215c26968 100644
--- a/src/librustdoc/html/templates/print_item.html
+++ b/src/librustdoc/html/templates/print_item.html
@@ -18,7 +18,7 @@
         {% endif %}
         {% match src_href %}
             {% when Some with (href) %}
-                <a class="srclink" href="{{href|safe}}">source</a> · {#+ #}
+                <a class="src" href="{{href|safe}}">source</a> · {#+ #}
             {% else %}
         {% endmatch %}
         <button id="toggle-all-docs" title="collapse all docs"> {# #}