Skip to content

Commit d08f897

Browse files
Small size reduction
1 parent 47a9ffa commit d08f897

File tree

1 file changed

+106
-122
lines changed

1 file changed

+106
-122
lines changed

src/librustdoc/html/layout.rs

Lines changed: 106 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -37,128 +37,112 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
3737
-> io::Result<()>
3838
{
3939
write!(dst,
40-
r##"<!DOCTYPE html>
41-
<html lang="en">
42-
<head>
43-
<meta charset="utf-8">
44-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
45-
<meta name="generator" content="rustdoc">
46-
<meta name="description" content="{description}">
47-
<meta name="keywords" content="{keywords}">
48-
49-
<title>{title}</title>
50-
51-
<link rel="stylesheet" type="text/css" href="{root_path}normalize{suffix}.css">
52-
<link rel="stylesheet" type="text/css" href="{root_path}rustdoc{suffix}.css"
53-
id="mainThemeStyle">
54-
{themes}
55-
<link rel="stylesheet" type="text/css" href="{root_path}dark{suffix}.css">
56-
<link rel="stylesheet" type="text/css" href="{root_path}light{suffix}.css" id="themeStyle">
57-
<script src="{root_path}storage{suffix}.js"></script>
58-
{css_extension}
59-
60-
{favicon}
61-
{in_header}
62-
</head>
63-
<body class="rustdoc {css_class}">
64-
<!--[if lte IE 8]>
65-
<div class="warning">
66-
This old browser is unsupported and will most likely display funky
67-
things.
68-
</div>
69-
<![endif]-->
70-
71-
{before_content}
72-
73-
<nav class="sidebar">
74-
<div class="sidebar-menu">&#9776;</div>
75-
{logo}
76-
{sidebar}
77-
</nav>
78-
79-
<div class="theme-picker">
80-
<button id="theme-picker" aria-label="Pick another theme!">
81-
<img src="{root_path}brush{suffix}.svg" width="18" alt="Pick another theme!">
82-
</button>
83-
<div id="theme-choices"></div>
84-
</div>
85-
<script src="{root_path}theme{suffix}.js"></script>
86-
<nav class="sub">
87-
<form class="search-form js-only">
88-
<div class="search-container">
89-
<input class="search-input" name="search"
90-
autocomplete="off"
91-
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
92-
type="search">
93-
</div>
94-
</form>
95-
</nav>
96-
97-
<section id='main' class="content">{content}</section>
98-
<section id='search' class="content hidden"></section>
99-
100-
<section class="footer"></section>
101-
102-
<aside id="help" class="hidden">
103-
<div>
104-
<h1 class="hidden">Help</h1>
105-
106-
<div class="shortcuts">
107-
<h2>Keyboard Shortcuts</h2>
108-
109-
<dl>
110-
<dt><kbd>?</kbd></dt>
111-
<dd>Show this help dialog</dd>
112-
<dt><kbd>S</kbd></dt>
113-
<dd>Focus the search field</dd>
114-
<dt><kbd>↑</kbd></dt>
115-
<dd>Move up in search results</dd>
116-
<dt><kbd>↓</kbd></dt>
117-
<dd>Move down in search results</dd>
118-
<dt><kbd>↹</kbd></dt>
119-
<dd>Switch tab</dd>
120-
<dt><kbd>&#9166;</kbd></dt>
121-
<dd>Go to active search result</dd>
122-
<dt><kbd>+</kbd></dt>
123-
<dd>Expand all sections</dd>
124-
<dt><kbd>-</kbd></dt>
125-
<dd>Collapse all sections</dd>
126-
</dl>
127-
</div>
128-
129-
<div class="infos">
130-
<h2>Search Tricks</h2>
131-
132-
<p>
133-
Prefix searches with a type followed by a colon (e.g.
134-
<code>fn:</code>) to restrict the search to a given type.
135-
</p>
136-
137-
<p>
138-
Accepted types are: <code>fn</code>, <code>mod</code>,
139-
<code>struct</code>, <code>enum</code>,
140-
<code>trait</code>, <code>type</code>, <code>macro</code>,
141-
and <code>const</code>.
142-
</p>
143-
144-
<p>
145-
Search functions by type signature (e.g.
146-
<code>vec -> usize</code> or <code>* -> vec</code>)
147-
</p>
148-
</div>
149-
</div>
150-
</aside>
151-
152-
{after_content}
153-
154-
<script>
155-
window.rootPath = "{root_path}";
156-
window.currentCrate = "{krate}";
157-
</script>
158-
<script src="{root_path}main{suffix}.js"></script>
159-
<script defer src="{root_path}search-index.js"></script>
160-
</body>
161-
</html>"##,
40+
"<!DOCTYPE html>\
41+
<html lang=\"en\">\
42+
<head>\
43+
<meta charset=\"utf-8\">\
44+
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\
45+
<meta name=\"generator\" content=\"rustdoc\">\
46+
<meta name=\"description\" content=\"{description}\">\
47+
<meta name=\"keywords\" content=\"{keywords}\">\
48+
<title>{title}</title>\
49+
<link rel=\"stylesheet\" type=\"text/css\" href=\"{root_path}normalize{suffix}.css\">\
50+
<link rel=\"stylesheet\" type=\"text/css\" href=\"{root_path}rustdoc{suffix}.css\" \
51+
id=\"mainThemeStyle\">\
52+
{themes}\
53+
<link rel=\"stylesheet\" type=\"text/css\" href=\"{root_path}dark{suffix}.css\">\
54+
<link rel=\"stylesheet\" type=\"text/css\" href=\"{root_path}light{suffix}.css\" \
55+
id=\"themeStyle\">\
56+
<script src=\"{root_path}storage{suffix}.js\"></script>\
57+
{css_extension}\
58+
{favicon}\
59+
{in_header}\
60+
</head>\
61+
<body class=\"rustdoc {css_class}\">\
62+
<!--[if lte IE 8]>\
63+
<div class=\"warning\">\
64+
This old browser is unsupported and will most likely display funky \
65+
things.\
66+
</div>\
67+
<![endif]-->\
68+
{before_content}\
69+
<nav class=\"sidebar\">\
70+
<div class=\"sidebar-menu\">&#9776;</div>\
71+
{logo}\
72+
{sidebar}\
73+
</nav>\
74+
<div class=\"theme-picker\">\
75+
<button id=\"theme-picker\" aria-label=\"Pick another theme!\">\
76+
<img src=\"{root_path}brush{suffix}.svg\" width=\"18\" alt=\"Pick another theme!\">\
77+
</button>\
78+
<div id=\"theme-choices\"></div>\
79+
</div>\
80+
<script src=\"{root_path}theme{suffix}.js\"></script>\
81+
<nav class=\"sub\">\
82+
<form class=\"search-form js-only\">\
83+
<div class=\"search-container\">\
84+
<input class=\"search-input\" name=\"search\" \
85+
autocomplete=\"off\" \
86+
placeholder=\"Click or press ‘S’ to search, ‘?’ for more options…\" \
87+
type=\"search\">\
88+
</div>\
89+
</form>\
90+
</nav>\
91+
<section id=\"main\" class=\"content\">{content}</section>\
92+
<section id=\"search\" class=\"content hidden\"></section>\
93+
<section class=\"footer\"></section>\
94+
<aside id=\"help\" class=\"hidden\">\
95+
<div>\
96+
<h1 class=\"hidden\">Help</h1>\
97+
<div class=\"shortcuts\">\
98+
<h2>Keyboard Shortcuts</h2>\
99+
<dl>\
100+
<dt><kbd>?</kbd></dt>\
101+
<dd>Show this help dialog</dd>\
102+
<dt><kbd>S</kbd></dt>\
103+
<dd>Focus the search field</dd>\
104+
<dt><kbd>↑</kbd></dt>\
105+
<dd>Move up in search results</dd>\
106+
<dt><kbd>↓</kbd></dt>\
107+
<dd>Move down in search results</dd>\
108+
<dt><kbd>↹</kbd></dt>\
109+
<dd>Switch tab</dd>\
110+
<dt><kbd>&#9166;</kbd></dt>\
111+
<dd>Go to active search result</dd>\
112+
<dt><kbd>+</kbd></dt>\
113+
<dd>Expand all sections</dd>\
114+
<dt><kbd>-</kbd></dt>\
115+
<dd>Collapse all sections</dd>\
116+
</dl>\
117+
</div>\
118+
<div class=\"infos\">\
119+
<h2>Search Tricks</h2>\
120+
<p>\
121+
Prefix searches with a type followed by a colon (e.g. \
122+
<code>fn:</code>) to restrict the search to a given type.\
123+
</p>\
124+
<p>\
125+
Accepted types are: <code>fn</code>, <code>mod</code>, \
126+
<code>struct</code>, <code>enum</code>, \
127+
<code>trait</code>, <code>type</code>, <code>macro</code>, \
128+
and <code>const</code>.\
129+
</p>\
130+
<p>\
131+
Search functions by type signature (e.g. \
132+
<code>vec -> usize</code> or <code>* -> vec</code>)\
133+
</p>\
134+
</div>\
135+
</div>\
136+
</aside>\
137+
{after_content}\
138+
<script>\
139+
window.rootPath = \"{root_path}\";\
140+
window.currentCrate = \"{krate}\";\
141+
</script>\
142+
<script src=\"{root_path}main{suffix}.js\"></script>\
143+
<script defer src=\"{root_path}search-index.js\"></script>\
144+
</body>\
145+
</html>",
162146
css_extension = if css_file_extension {
163147
format!("<link rel=\"stylesheet\" type=\"text/css\" href=\"{root_path}theme{suffix}.css\">",
164148
root_path = page.root_path,

0 commit comments

Comments
 (0)