Skip to content

Commit

Permalink
Fix position of scraped examples title on mobile devices
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Sep 1, 2024
1 parent 84259ff commit 35a7c1b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -2267,6 +2267,17 @@ in src-script.js and main.js
margin: 0;
padding: var(--nav-sub-mobile-padding);
}

.example-wrap.scraped-example {
flex-wrap: wrap;
}
.example-wrap .scraped-example-title {
width: 100%;
}
.example-wrap.scraped-example .rust {
/* Dirty hacky to force it to remain on the same line as the line numbers. */
width: 10px;
}
}

/* Should have min-width: (N + 1)px where N is the mobile breakpoint above. */
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/html/templates/scraped_source.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<div class="example-wrap scraped-example{% if !info.needs_expansion +%} expanded{% endif %}" data-locs="{{info.locations}}">
<div class="scraped-example-title">
{{info.name +}} (<a href="{{info.url}}">{{info.title}}</a>) {# #}
</div>
{# https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag#data-nosnippet-attr
Do not show "1 2 3 4 5 ..." in web search results. #}
<div data-nosnippet><pre class="src-line-numbers">
Expand All @@ -12,9 +15,6 @@
{{code_html|safe}}
</code> {# #}
</pre> {# #}
<div class="scraped-example-title">
{{info.name +}} (<a href="{{info.url}}">{{info.title}}</a>) {# #}
</div>
{% if info.needs_prev_next_buttons || info.needs_expansion %}
<div class="button-holder">
{% if info.needs_prev_next_buttons %}
Expand Down

0 comments on commit 35a7c1b

Please sign in to comment.