1 // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
14 use externalfiles::ExternalHtml;
20 pub external_html: ExternalHtml,
22 pub playground_url: String,
28 pub root_path: &'a str,
31 pub fn render<T: fmt::Show, S: fmt::Show>(
32 dst: &mut io::Writer, layout: &Layout, page: &Page, sidebar: &S, t: &T)
39 <meta charset="utf-8">
40 <meta name="viewport" content="width=device-width, initial-scale=1.0">
41 <meta name="description" content="The {krate} library documentation.">
43 <title>{title}</title>
45 <link rel="stylesheet" type="text/css" href="{root_path}main.css">
53 This old browser is unsupported and will most likely display funky
60 <section class="sidebar">
66 <form class="search-form js-only">
67 <div class="search-container">
68 <input class="search-input" name="search"
70 placeholder="Click or press 'S' to search, '?' for more options..."
76 <section id='main' class="content {ty}">{content}</section>
77 <section id='search' class="content hidden"></section>
79 <section class="footer"></section>
81 <div id="help" class="hidden">
82 <div class="shortcuts">
83 <h1>Keyboard shortcuts</h1>
86 <dd>Show this help dialog</dd>
88 <dd>Focus the search field</dd>
90 <dd>Move up in search results</dd>
92 <dd>Move down in search results</dd>
94 <dd>Go to active search result</dd>
98 <h1>Search tricks</h1>
100 Prefix searches with a type followed by a colon (e.g.
101 <code>fn:</code>) to restrict the search to a given type.
104 Accepted types are: <code>fn</code>, <code>mod</code>,
105 <code>struct</code> (or <code>str</code>), <code>enum</code>,
106 <code>trait</code>, <code>typedef</code> (or
115 window.rootPath = "{root_path}";
116 window.currentCrate = "{krate}";
117 window.playgroundUrl = "{play_url}";
119 <script src="{root_path}jquery.js"></script>
120 <script src="{root_path}main.js"></script>
122 <script async src="{root_path}search-index.js"></script>
126 root_path = page.root_path,
128 logo = if layout.logo.len() == 0 {
131 format!("<a href='{}{}/index.html'>\
132 <img src='{}' alt='' width='100'></a>",
133 page.root_path, layout.krate,
137 favicon = if layout.favicon.len() == 0 {
140 format!(r#"<link rel="shortcut icon" href="{}">"#, layout.favicon)
142 in_header = layout.external_html.in_header,
143 before_content = layout.external_html.before_content,
144 after_content = layout.external_html.after_content,
146 krate = layout.krate,
147 play_url = layout.playground_url,
148 play_js = if layout.playground_url.len() == 0 {
151 format!(r#"<script src="{}playpen.js"></script>"#, page.root_path)
156 pub fn redirect(dst: &mut io::Writer, url: &str) -> io::IoResult<()> {
161 <meta http-equiv="refresh" content="0;URL={url}">