diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-04-14 17:13:46 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-04-14 17:13:46 +0200 |
| commit | d08f8978e7b883cb01ec8f1118b5eeb3ebc94ab4 (patch) | |
| tree | ba5d932441eb371462cdccf1a4c0fd29013365ca | |
| parent | 47a9ffa573aac587b7d045177a4f05bd649261e3 (diff) | |
| download | rust-d08f8978e7b883cb01ec8f1118b5eeb3ebc94ab4.tar.gz rust-d08f8978e7b883cb01ec8f1118b5eeb3ebc94ab4.zip | |
Small size reduction
| -rw-r--r-- | src/librustdoc/html/layout.rs | 228 |
1 files changed, 106 insertions, 122 deletions
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index aac5d0d2601..88d28323e1a 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -37,128 +37,112 @@ pub fn render<T: fmt::Display, S: fmt::Display>( -> io::Result<()> { write!(dst, -r##"<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <meta name="generator" content="rustdoc"> - <meta name="description" content="{description}"> - <meta name="keywords" content="{keywords}"> - - <title>{title}</title> - - <link rel="stylesheet" type="text/css" href="{root_path}normalize{suffix}.css"> - <link rel="stylesheet" type="text/css" href="{root_path}rustdoc{suffix}.css" - id="mainThemeStyle"> - {themes} - <link rel="stylesheet" type="text/css" href="{root_path}dark{suffix}.css"> - <link rel="stylesheet" type="text/css" href="{root_path}light{suffix}.css" id="themeStyle"> - <script src="{root_path}storage{suffix}.js"></script> - {css_extension} - - {favicon} - {in_header} -</head> -<body class="rustdoc {css_class}"> - <!--[if lte IE 8]> - <div class="warning"> - This old browser is unsupported and will most likely display funky - things. - </div> - <![endif]--> - - {before_content} - - <nav class="sidebar"> - <div class="sidebar-menu">☰</div> - {logo} - {sidebar} - </nav> - - <div class="theme-picker"> - <button id="theme-picker" aria-label="Pick another theme!"> - <img src="{root_path}brush{suffix}.svg" width="18" alt="Pick another theme!"> - </button> - <div id="theme-choices"></div> - </div> - <script src="{root_path}theme{suffix}.js"></script> - <nav class="sub"> - <form class="search-form js-only"> - <div class="search-container"> - <input class="search-input" name="search" - autocomplete="off" - placeholder="Click or press ‘S’ to search, ‘?’ for more options…" - type="search"> - </div> - </form> - </nav> - - <section id='main' class="content">{content}</section> - <section id='search' class="content hidden"></section> - - <section class="footer"></section> - - <aside id="help" class="hidden"> - <div> - <h1 class="hidden">Help</h1> - - <div class="shortcuts"> - <h2>Keyboard Shortcuts</h2> - - <dl> - <dt><kbd>?</kbd></dt> - <dd>Show this help dialog</dd> - <dt><kbd>S</kbd></dt> - <dd>Focus the search field</dd> - <dt><kbd>↑</kbd></dt> - <dd>Move up in search results</dd> - <dt><kbd>↓</kbd></dt> - <dd>Move down in search results</dd> - <dt><kbd>↹</kbd></dt> - <dd>Switch tab</dd> - <dt><kbd>⏎</kbd></dt> - <dd>Go to active search result</dd> - <dt><kbd>+</kbd></dt> - <dd>Expand all sections</dd> - <dt><kbd>-</kbd></dt> - <dd>Collapse all sections</dd> - </dl> - </div> - - <div class="infos"> - <h2>Search Tricks</h2> - - <p> - Prefix searches with a type followed by a colon (e.g. - <code>fn:</code>) to restrict the search to a given type. - </p> - - <p> - Accepted types are: <code>fn</code>, <code>mod</code>, - <code>struct</code>, <code>enum</code>, - <code>trait</code>, <code>type</code>, <code>macro</code>, - and <code>const</code>. - </p> - - <p> - Search functions by type signature (e.g. - <code>vec -> usize</code> or <code>* -> vec</code>) - </p> - </div> - </div> - </aside> - - {after_content} - - <script> - window.rootPath = "{root_path}"; - window.currentCrate = "{krate}"; - </script> - <script src="{root_path}main{suffix}.js"></script> - <script defer src="{root_path}search-index.js"></script> -</body> -</html>"##, +"<!DOCTYPE html>\ +<html lang=\"en\">\ +<head>\ + <meta charset=\"utf-8\">\ + <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\ + <meta name=\"generator\" content=\"rustdoc\">\ + <meta name=\"description\" content=\"{description}\">\ + <meta name=\"keywords\" content=\"{keywords}\">\ + <title>{title}</title>\ + <link rel=\"stylesheet\" type=\"text/css\" href=\"{root_path}normalize{suffix}.css\">\ + <link rel=\"stylesheet\" type=\"text/css\" href=\"{root_path}rustdoc{suffix}.css\" \ + id=\"mainThemeStyle\">\ + {themes}\ + <link rel=\"stylesheet\" type=\"text/css\" href=\"{root_path}dark{suffix}.css\">\ + <link rel=\"stylesheet\" type=\"text/css\" href=\"{root_path}light{suffix}.css\" \ + id=\"themeStyle\">\ + <script src=\"{root_path}storage{suffix}.js\"></script>\ + {css_extension}\ + {favicon}\ + {in_header}\ +</head>\ +<body class=\"rustdoc {css_class}\">\ + <!--[if lte IE 8]>\ + <div class=\"warning\">\ + This old browser is unsupported and will most likely display funky \ + things.\ + </div>\ + <![endif]-->\ + {before_content}\ + <nav class=\"sidebar\">\ + <div class=\"sidebar-menu\">☰</div>\ + {logo}\ + {sidebar}\ + </nav>\ + <div class=\"theme-picker\">\ + <button id=\"theme-picker\" aria-label=\"Pick another theme!\">\ + <img src=\"{root_path}brush{suffix}.svg\" width=\"18\" alt=\"Pick another theme!\">\ + </button>\ + <div id=\"theme-choices\"></div>\ + </div>\ + <script src=\"{root_path}theme{suffix}.js\"></script>\ + <nav class=\"sub\">\ + <form class=\"search-form js-only\">\ + <div class=\"search-container\">\ + <input class=\"search-input\" name=\"search\" \ + autocomplete=\"off\" \ + placeholder=\"Click or press ‘S’ to search, ‘?’ for more options…\" \ + type=\"search\">\ + </div>\ + </form>\ + </nav>\ + <section id=\"main\" class=\"content\">{content}</section>\ + <section id=\"search\" class=\"content hidden\"></section>\ + <section class=\"footer\"></section>\ + <aside id=\"help\" class=\"hidden\">\ + <div>\ + <h1 class=\"hidden\">Help</h1>\ + <div class=\"shortcuts\">\ + <h2>Keyboard Shortcuts</h2>\ + <dl>\ + <dt><kbd>?</kbd></dt>\ + <dd>Show this help dialog</dd>\ + <dt><kbd>S</kbd></dt>\ + <dd>Focus the search field</dd>\ + <dt><kbd>↑</kbd></dt>\ + <dd>Move up in search results</dd>\ + <dt><kbd>↓</kbd></dt>\ + <dd>Move down in search results</dd>\ + <dt><kbd>↹</kbd></dt>\ + <dd>Switch tab</dd>\ + <dt><kbd>⏎</kbd></dt>\ + <dd>Go to active search result</dd>\ + <dt><kbd>+</kbd></dt>\ + <dd>Expand all sections</dd>\ + <dt><kbd>-</kbd></dt>\ + <dd>Collapse all sections</dd>\ + </dl>\ + </div>\ + <div class=\"infos\">\ + <h2>Search Tricks</h2>\ + <p>\ + Prefix searches with a type followed by a colon (e.g. \ + <code>fn:</code>) to restrict the search to a given type.\ + </p>\ + <p>\ + Accepted types are: <code>fn</code>, <code>mod</code>, \ + <code>struct</code>, <code>enum</code>, \ + <code>trait</code>, <code>type</code>, <code>macro</code>, \ + and <code>const</code>.\ + </p>\ + <p>\ + Search functions by type signature (e.g. \ + <code>vec -> usize</code> or <code>* -> vec</code>)\ + </p>\ + </div>\ + </div>\ + </aside>\ + {after_content}\ + <script>\ + window.rootPath = \"{root_path}\";\ + window.currentCrate = \"{krate}\";\ + </script>\ + <script src=\"{root_path}main{suffix}.js\"></script>\ + <script defer src=\"{root_path}search-index.js\"></script>\ +</body>\ +</html>", css_extension = if css_file_extension { format!("<link rel=\"stylesheet\" type=\"text/css\" href=\"{root_path}theme{suffix}.css\">", root_path = page.root_path, |
