Skip to content

Commit

Permalink
rustdoc: fix source view
Browse files Browse the repository at this point in the history
  • Loading branch information
cynecx authored and GuillaumeGomez committed Nov 29, 2021
1 parent 135281e commit 1e98fb1
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 11 deletions.
47 changes: 43 additions & 4 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,19 @@ main {
overflow-y: auto;
}

.source main {
padding: 15px;
}

.main-inner {
max-width: 960px;
margin-right: auto;
}

.source .main-inner {
max-width: unset;
}

details:not(.rustdoc-toggle) summary {
margin-bottom: .6em;
}
Expand Down Expand Up @@ -310,6 +318,7 @@ li {
}

nav.sub {
position: relative;
font-size: 16px;
text-transform: uppercase;
}
Expand All @@ -325,6 +334,10 @@ nav.sub {
height: 100vh;
}

.source .sidebar {
display: none;
}

/* Improve the scrollbar display on firefox */
* {
scrollbar-width: initial;
Expand Down Expand Up @@ -354,6 +367,18 @@ nav.sub {
display: none !important;
}

.logo-source {
display: none;
}

.source .logo-source {
display: block;
position: absolute;
top: 0;
left: 0;
width: 200px;
}

.logo-container {
height: 100px;
width: 100px;
Expand Down Expand Up @@ -716,6 +741,9 @@ nav:not(.sidebar) {
padding-bottom: 10px;
margin-bottom: 25px;
}
.source nav:not(.sidebar).sub {
margin-left: 230px;
}
nav.main {
padding: 20px 0;
text-align: center;
Expand Down Expand Up @@ -805,6 +833,7 @@ h2.small-section-header > .anchor {

.search-container {
position: relative;
max-width: 960px;
}
.search-container > div {
display: inline-flex;
Expand Down Expand Up @@ -1357,8 +1386,8 @@ pre.rust {

.theme-picker {
position: absolute;
left: 11px;
top: 19px;
left: -34px;
top: 9px;
}

.theme-picker button {
Expand Down Expand Up @@ -1767,10 +1796,18 @@ details.rustdoc-toggle[open] > summary.hideme::after {
margin-bottom: 10px;
}

.source nav:not(.sidebar).sub {
margin-left: 32px;
}

.content {
margin-left: 0px;
}

.source .content {
margin-top: 10px;
}

#search {
margin-left: 0;
padding: 0;
Expand All @@ -1781,8 +1818,6 @@ details.rustdoc-toggle[open] > summary.hideme::after {
}

.theme-picker {
left: 10px;
top: 9px;
z-index: 1;
}

Expand Down Expand Up @@ -1909,6 +1944,10 @@ details.rustdoc-toggle[open] > summary.hideme::after {
.search-results div.desc, .search-results .result-description, .item-right {
padding-left: 2em;
}

.source .logo-source {
display: none;
}
}

@media print {
Expand Down
25 changes: 18 additions & 7 deletions src/librustdoc/html/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,25 @@
</nav> {#- -#}
<main> {#- -#}
<div class="main-inner"> {#- -#}
<div class="theme-picker"> {#- -#}
<button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"> {#- -#}
<img width="18" height="18" alt="Pick another theme!" {# -#}
src="{{static_root_path | safe}}brush{{page.resource_suffix}}.svg"> {#- -#}
</button> {#- -#}
<div id="theme-choices" role="menu"></div> {#- -#}
</div> {#- -#}
<a class="logo-source" href='{{page.root_path | safe}}{{krate_with_trailing_slash | safe}}index.html'> {#- -#}
<div class='logo-container rust-logo'> {#- -#}
<img src='
{%- if layout.logo -%}
{{layout.logo}}
{%- else -%}
{{static_root_path | safe}}rust-logo{{page.resource_suffix}}.png
{%- endif -%}
' alt='logo'> {#- -#}
</div> {#- -#}
</a> {#- -#}
<nav class="sub"> {#- -#}
<div class="theme-picker"> {#- -#}
<button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"> {#- -#}
<img width="18" height="18" alt="Pick another theme!" {# -#}
src="{{static_root_path | safe}}brush{{page.resource_suffix}}.svg"> {#- -#}
</button> {#- -#}
<div id="theme-choices" role="menu"></div> {#- -#}
</div> {#- -#}
<form class="search-form"> {#- -#}
<div class="search-container"> {#- -#}
<div>{%- if layout.generate_search_filter -%}
Expand Down

0 comments on commit 1e98fb1

Please sign in to comment.