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.
19 pub playground_url: String,
25 pub root_path: &'a str,
28 pub fn render<T: fmt::Show, S: fmt::Show>(
29 dst: &mut io::Writer, layout: &Layout, page: &Page, sidebar: &S, t: &T)
36 <meta charset="utf-8">
37 <meta name="viewport" content="width=device-width, initial-scale=1.0">
38 <meta name="description" content="The {krate} library documentation.">
40 <title>{title}</title>
42 <link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:400,600'
43 rel='stylesheet' type='text/css'>
44 <link rel="stylesheet" type="text/css" href="{root_path}main.css">
51 This old browser is unsupported and will most likely display funky
56 <section class="sidebar">
62 <form class="search-form js-only">
63 <div class="search-container">
64 <input class="search-input" name="search"
66 placeholder="Search documentation..."
72 <section id='main' class="content {ty}">{content}</section>
73 <section id='search' class="content hidden"></section>
75 <section class="footer"></section>
77 <div id="help" class="hidden">
78 <div class="shortcuts">
79 <h1>Keyboard shortcuts</h1>
82 <dd>Show this help dialog</dd>
84 <dd>Focus the search field</dd>
86 <dd>Move up in search results</dd>
88 <dd>Move down in search results</dd>
90 <dd>Go to active search result</dd>
94 <h1>Search tricks</h1>
96 Prefix searches with a type followed by a colon (e.g.
97 <code>fn:</code>) to restrict the search to a given type.
100 Accepted types are: <code>fn</code>, <code>mod</code>,
101 <code>struct</code> (or <code>str</code>), <code>enum</code>,
102 <code>trait</code>, <code>typedef</code> (or
109 window.rootPath = "{root_path}";
110 window.currentCrate = "{krate}";
111 window.playgroundUrl = "{play_url}";
113 <script src="{root_path}jquery.js"></script>
114 <script src="{root_path}main.js"></script>
116 <script async src="{root_path}search-index.js"></script>
120 root_path = page.root_path,
122 logo = if layout.logo.len() == 0 {
125 format!("<a href='{}{}/index.html'>\
126 <img src='{}' alt='' width='100'></a>",
127 page.root_path, layout.krate,
131 favicon = if layout.favicon.len() == 0 {
134 format!(r#"<link rel="shortcut icon" href="{}">"#, layout.favicon)
137 krate = layout.krate,
138 play_url = layout.playground_url,
139 play_js = if layout.playground_url.len() == 0 {
142 format!(r#"<script src="{}playpen.js"></script>"#, page.root_path)
147 pub fn redirect(dst: &mut io::Writer, url: &str) -> io::IoResult<()> {
152 <meta http-equiv="refresh" content="0;URL={url}">