Skip to content

Commit c1ba5de

Browse files
committed
Add best-effort warning header
Because we modify index.hbs, we should occasionally compare with mdbook's own copy and rebase our changes onto it.
1 parent 768cb76 commit c1ba5de

File tree

1 file changed

+229
-0
lines changed

1 file changed

+229
-0
lines changed

theme/index.hbs

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
<!DOCTYPE HTML>
2+
<html lang="{{ language }}">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>{{ title }}</title>
6+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
7+
<meta name="description" content="{{ description }}">
8+
<meta name="viewport" content="width=device-width, initial-scale=1">
9+
10+
<base href="{{ path_to_root }}">
11+
12+
<link rel="stylesheet" href="book.css">
13+
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css">
14+
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500" rel="stylesheet" type="text/css">
15+
16+
<link rel="shortcut icon" href="{{ favicon }}">
17+
18+
<!-- Font Awesome -->
19+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
20+
21+
<link rel="stylesheet" href="highlight.css">
22+
<link rel="stylesheet" href="tomorrow-night.css">
23+
<link rel="stylesheet" href="ayu-highlight.css">
24+
<style>
25+
.page-wrapper.has-warning > .nav-chapters {
26+
/* add height for warning content & margin */
27+
top: 120px;
28+
}
29+
30+
p.warning {
31+
background-color: rgb(242, 222, 222);
32+
border-bottom-color: rgb(238, 211, 215);
33+
border-bottom-left-radius: 4px;
34+
border-bottom-right-radius: 4px;
35+
border-bottom-style: solid;
36+
border-bottom-width: 0.666667px;
37+
border-image-outset: 0 0 0 0;
38+
border-image-repeat: stretch stretch;
39+
border-image-slice: 100% 100% 100% 100%;
40+
border-image-source: none;
41+
border-image-width: 1 1 1 1;
42+
border-left-color: rgb(238, 211, 215);
43+
border-left-style: solid;
44+
border-left-width: 0.666667px;
45+
border-right-color: rgb(238, 211, 215);
46+
border-right-style: solid;
47+
border-right-width: 0.666667px;
48+
border-top-color: rgb(238, 211, 215);
49+
border-top-left-radius: 4px;
50+
border-top-right-radius: 4px;
51+
border-top-style: solid;
52+
border-top-width: 0.666667px;
53+
color: rgb(185, 74, 72);
54+
margin-bottom: 0px;
55+
margin-left: 0px;
56+
margin-right: 0px;
57+
margin-top: 30px;
58+
padding-bottom: 8px;
59+
padding-left: 14px;
60+
padding-right: 35px;
61+
padding-top: 8px;
62+
}
63+
p.warning strong {
64+
color: rgb(185, 74, 72)
65+
}
66+
p.warning a {
67+
color: rgb(0, 136, 204)
68+
}
69+
70+
a .hljs {
71+
color: #4183c4;
72+
}
73+
</style>
74+
75+
<!-- Custom theme -->
76+
{{#each additional_css}}
77+
<link rel="stylesheet" href="{{this}}">
78+
{{/each}}
79+
80+
{{#if mathjax_support}}
81+
<!-- MathJax -->
82+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
83+
{{/if}}
84+
85+
<!-- Fetch Clipboard.js from CDN but have a local fallback -->
86+
<script src="https://cdn.jsdelivr.net/clipboard.js/1.6.1/clipboard.min.js"></script>
87+
<script>
88+
if (typeof Clipboard == 'undefined') {
89+
document.write(unescape("%3Cscript src='clipboard.min.js'%3E%3C/script%3E"));
90+
}
91+
</script>
92+
93+
<!-- Fetch JQuery from CDN but have a local fallback -->
94+
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
95+
<script>
96+
if (typeof jQuery == 'undefined') {
97+
document.write(unescape("%3Cscript src='jquery.js'%3E%3C/script%3E"));
98+
}
99+
</script>
100+
101+
<!-- Fetch store.js from local - TODO add CDN when 2.x.x is available on cdnjs -->
102+
<script src="store.js"></script>
103+
104+
<!-- Custom JS script -->
105+
{{#each additional_js}}
106+
<script type="text/javascript" src="{{this}}"></script>
107+
{{/each}}
108+
109+
</head>
110+
<body class="light">
111+
<!-- Set the theme before any content is loaded, prevents flash -->
112+
<script type="text/javascript">
113+
var theme = store.get('mdbook-theme');
114+
if (theme === null || theme === undefined) { theme = 'light'; }
115+
$('body').removeClass().addClass(theme);
116+
</script>
117+
118+
<!-- Hide / unhide sidebar before it is displayed -->
119+
<script type="text/javascript">
120+
var sidebar = store.get('mdbook-sidebar');
121+
if (sidebar === "hidden") { $("html").addClass("sidebar-hidden") }
122+
else if (sidebar === "visible") { $("html").addClass("sidebar-visible") }
123+
</script>
124+
125+
<div id="sidebar" class="sidebar">
126+
{{#toc}}{{/toc}}
127+
</div>
128+
129+
<div id="page-wrapper" class="page-wrapper has-warning">
130+
131+
<div class="page" tabindex="-1">
132+
<header><p class="warning">
133+
For now, this reference is a best-effort document. We strive for validity and completeness, but are
134+
not yet there. In the future, the docs and lang teams will work together to figure out how
135+
best to do this. Until then, this is a best-effort attempt. If you find something wrong or
136+
missing, file an <a href="https://github.com/rust-lang-nursery/reference/issues">issue</a> or send in a
137+
pull request.
138+
</p></header>
139+
<div id="menu-bar" class="menu-bar">
140+
<div class="left-buttons">
141+
<i id="sidebar-toggle" class="fa fa-bars"></i>
142+
<i id="theme-toggle" class="fa fa-paint-brush"></i>
143+
</div>
144+
145+
<h1 class="menu-title">{{ book_title }}</h1>
146+
147+
<div class="right-buttons">
148+
<a href="print.html">
149+
<i id="print-button" class="fa fa-print" title="Print this book"></i>
150+
</a>
151+
</div>
152+
</div>
153+
154+
<div id="content" class="content">
155+
{{{ content }}}
156+
</div>
157+
158+
<!-- Mobile navigation buttons -->
159+
{{#previous}}
160+
<a rel="prev" href="{{link}}" class="mobile-nav-chapters previous">
161+
<i class="fa fa-angle-left"></i>
162+
</a>
163+
{{/previous}}
164+
165+
{{#next}}
166+
<a rel="next" href="{{link}}" class="mobile-nav-chapters next">
167+
<i class="fa fa-angle-right"></i>
168+
</a>
169+
{{/next}}
170+
171+
</div>
172+
173+
{{#previous}}
174+
<a href="{{link}}" class="nav-chapters previous" title="You can navigate through the chapters using the arrow keys">
175+
<i class="fa fa-angle-left"></i>
176+
</a>
177+
{{/previous}}
178+
179+
{{#next}}
180+
<a href="{{link}}" class="nav-chapters next" title="You can navigate through the chapters using the arrow keys">
181+
<i class="fa fa-angle-right"></i>
182+
</a>
183+
{{/next}}
184+
185+
</div>
186+
187+
188+
<!-- Local fallback for Font Awesome -->
189+
<script>
190+
if ($(".fa").css("font-family") !== "FontAwesome") {
191+
$('<link rel="stylesheet" type="text/css" href="_FontAwesome/css/font-awesome.css">').prependTo('head');
192+
}
193+
</script>
194+
195+
<!-- Livereload script (if served using the cli tool) -->
196+
{{{livereload}}}
197+
198+
{{#if google_analytics}}
199+
<script>
200+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
201+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
202+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
203+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
204+
205+
ga('create', '{{google_analytics}}', 'auto');
206+
ga('send', 'pageview');
207+
</script>
208+
{{/if}}
209+
210+
{{#if playpens_editable}}
211+
<script src="{{ ace_js }}" type="text/javascript" charset="utf-8"></script>
212+
<script src="{{ editor_js }}" type="text/javascript" charset="utf-8"></script>
213+
<script src="{{ mode_rust_js }}" type="text/javascript" charset="utf-8"></script>
214+
<script src="{{ theme_dawn_js }}" type="text/javascript" charset="utf-8"></script>
215+
<script src="{{ theme_tomorrow_night_js }}" type="text/javascript" charset="utf-8"></script>
216+
{{/if}}
217+
218+
{{#if is_print}}
219+
<script>
220+
$(document).ready(function() {
221+
window.print();
222+
})
223+
</script>
224+
{{/if}}
225+
226+
<script src="highlight.js"></script>
227+
<script src="book.js"></script>
228+
</body>
229+
</html>

0 commit comments

Comments
 (0)