Skip to content

Commit ba21d47

Browse files
committed
auto merge of #9868 : adridu59/rust/patch-doc, r=brson
- switch pandoc to HTML5, add tutorial PDF gen. - cleanup and refactor CSS, expand tutorial/manual CSS +some Bootstrap elements, cleanup unused doc/lib.css you can see it here in action: http://adrientetar.legtux.org/cached/rust-doc/rust.html - minor rustdoc cleanups @alexcrichton
2 parents 2cb96a4 + 8c38016 commit ba21d47

File tree

13 files changed

+568
-851
lines changed

13 files changed

+568
-851
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ src/.DS_Store
7777
/nd/
7878
/llvm/
7979
version.md
80-
rust.tex
80+
*.tex
8181
keywords.md
8282
x86_64-apple-darwin/
8383
x86_64-unknown-linux-gnu/

doc/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ To generate HTML documentation from one source file/crate, do something like:
1919
To generate an HTML version of a doc from Markdown, without having Node.js
2020
installed, do something like:
2121

22-
pandoc --from=markdown --to=html --number-sections -o rust.html rust.md
22+
pandoc --from=markdown --to=html5 --number-sections -o rust.html rust.md
2323

2424
The syntax for pandoc flavored markdown can be found at:
2525
http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown

doc/css/manual.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<style>
2+
/* Display the full TOC */
3+
#TOC ul ul {
4+
display: block;
5+
padding-left: 2em;
6+
}
7+
</style>

doc/css/rust.css

Lines changed: 311 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,311 @@
1+
/**
2+
* Copyright 2013 The Rust Project Developers. See the COPYRIGHT
3+
* file at the top-level directory of this distribution and at
4+
* http://rust-lang.org/COPYRIGHT.
5+
* With elements taken from Bootstrap v3.0.0 (Apache v2.0 licensed).
6+
*
7+
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8+
* http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9+
* <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10+
* option. This file may not be copied, modified, or distributed
11+
* except according to those terms.
12+
*/
13+
/* Global page semantics
14+
========================================================================== */
15+
body {
16+
background-color: #fff;
17+
margin: 0 auto;
18+
padding: 0 15px;
19+
margin-bottom: 4em;
20+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
21+
font-size: 14px;
22+
color: #333;
23+
line-height: 1.428571429;
24+
}
25+
@media (min-width: 768px) {
26+
body {
27+
max-width: 750px;
28+
}
29+
}
30+
@media (min-width: 992px) {
31+
body {
32+
max-width: 970px;
33+
}
34+
}
35+
@media (min-width: 1200px) {
36+
body {
37+
max-width: 1170px;
38+
}
39+
}
40+
41+
h1, h2, h3, h4, h5, h6 {
42+
color: black;
43+
font-weight: 500;
44+
line-height: 1.1;
45+
}
46+
h1, h2, h3 {
47+
margin-top: 20px;
48+
margin-bottom: 10px;
49+
}
50+
h4, h5, h6 {
51+
margin-top: 12px;
52+
margin-bottom: 10px;
53+
}
54+
55+
h1 {
56+
font-size: 36px;
57+
padding: .1em .4em;
58+
margin: 0.67em 0;
59+
background-color: #E9E9E9;
60+
border-radius: .2em;
61+
}
62+
h1.title {
63+
line-height: 1.5em;
64+
}
65+
h2 {
66+
font-size: 30px;
67+
padding: .2em .5em;
68+
background-color: #E9E9E9;
69+
border-radius: .3em;
70+
}
71+
h3 {
72+
font-size: 24px;
73+
padding: .2em .5em;
74+
background-color: #DDE8FC;
75+
border-radius: .4em;
76+
}
77+
h4 {
78+
font-size: 18px;
79+
}
80+
h5 {
81+
font-size: 16px;
82+
}
83+
h6 {
84+
font-size: 14px;
85+
}
86+
87+
p {
88+
margin: 0 0 10px;
89+
}
90+
91+
/* Links layout
92+
========================================================================== */
93+
a {
94+
text-decoration: none;
95+
color: #428BCA;
96+
}
97+
a:hover, a:focus {
98+
color: #2A6496;
99+
text-decoration: underline;
100+
}
101+
a:focus {
102+
outline: thin dotted #333;
103+
outline: 5px auto -webkit-focus-ring-color;
104+
outline-offset: -2px;
105+
}
106+
a:hover, a:active {
107+
outline: 0;
108+
}
109+
110+
h1 a:link, h1 a:visited, h2 a:link, h2 a:visited,
111+
h3 a:link, h3 a:visited, h4 a:link, h4 a:visited,
112+
h5 a:link, h5 a:visited {color: black;}
113+
114+
/* Code
115+
========================================================================== */
116+
pre, code {
117+
font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
118+
border-radius: 4px;
119+
}
120+
pre {
121+
background-color: #F5F5F5;
122+
border: 1px solid #CCC;
123+
border-radius: 0.5em;
124+
white-space: pre-wrap;
125+
padding: 9.5px;
126+
margin: 10px 0;
127+
font-size: 13px;
128+
word-break: break-all;
129+
word-wrap: break-word;
130+
}
131+
code {
132+
padding: 2px 4px;
133+
font-size: 90%;
134+
color: #C7254E;
135+
background-color: #F9F2F4;
136+
white-space: nowrap;
137+
}
138+
pre code {
139+
padding: 0;
140+
font-size: inherit;
141+
color: inherit;
142+
white-space: pre-wrap;
143+
background-color: transparent;
144+
border: 0;
145+
}
146+
147+
/* Code highlighting */
148+
.cm-s-default span.cm-keyword {color: #708;}
149+
.cm-s-default span.cm-atom {color: #219;}
150+
.cm-s-default span.cm-number {color: #164;}
151+
.cm-s-default span.cm-def {color: #00f;}
152+
.cm-s-default span.cm-variable {color: black;}
153+
.cm-s-default span.cm-variable-2 {color: #05a;}
154+
.cm-s-default span.cm-variable-3 {color: #085;}
155+
.cm-s-default span.cm-property {color: black;}
156+
.cm-s-default span.cm-operator {color: black;}
157+
.cm-s-default span.cm-comment {color: #a50;}
158+
.cm-s-default span.cm-string {color: #a11;}
159+
.cm-s-default span.cm-string-2 {color: #f50;}
160+
.cm-s-default span.cm-meta {color: #555;}
161+
.cm-s-default span.cm-error {color: #f00;}
162+
.cm-s-default span.cm-qualifier {color: #555;}
163+
.cm-s-default span.cm-builtin {color: #30a;}
164+
.cm-s-default span.cm-bracket {color: #cc7;}
165+
.cm-s-default span.cm-tag {color: #170;}
166+
.cm-s-default span.cm-attribute {color: #00c;}
167+
168+
/* The rest
169+
========================================================================== */
170+
#versioninfo {
171+
text-align: center;
172+
margin: 0.5em;
173+
font-size: 1.1em;
174+
}
175+
@media (min-width: 768px) {
176+
#versioninfo {
177+
position: fixed;
178+
bottom: 0px;
179+
right: 0px;
180+
}
181+
.white-sticker {
182+
background-color: #fff;
183+
margin: 2px;
184+
padding: 0 2px;
185+
border-radius: .3em;
186+
}
187+
}
188+
#versioninfo a.hash {
189+
color: gray;
190+
font-size: 60%;
191+
}
192+
193+
blockquote {
194+
color: black;
195+
border-left: 5px solid #eee;
196+
margin: 0 0 20px;
197+
padding: 10px 20px;
198+
}
199+
blockquote p {
200+
font-size: 17px;
201+
font-weight: 300;
202+
line-height: 1.25;
203+
}
204+
blockquote p:last-child {
205+
margin-bottom: 0;
206+
}
207+
blockquote small {
208+
display: block;
209+
line-height: 1.428571429;
210+
color: #999;
211+
}
212+
213+
/* Make the table under the tutorial's 'Types' section look nicer */
214+
table {
215+
border-top: 1px solid silver;
216+
border-bottom: 1px solid silver;
217+
padding: 0.8em;
218+
font-size: smaller;
219+
}
220+
/* Also for the benefit of the type table */
221+
td {
222+
padding-right: 1em;
223+
}
224+
225+
ul,
226+
ol {
227+
margin-top: 0;
228+
margin-bottom: 10px;
229+
}
230+
ul ul,
231+
ol ul,
232+
ul ol,
233+
ol ol {
234+
margin-bottom: 0;
235+
}
236+
dl {
237+
margin-bottom: 20px;
238+
}
239+
dd {
240+
margin-left: 0;
241+
}
242+
243+
#TOC ul {
244+
list-style-type: none;
245+
padding-left: 0px;
246+
}
247+
/* Only display one level of hierarchy in the TOC */
248+
#TOC ul ul {
249+
display: none;
250+
}
251+
252+
/* Adjust list alignment so rustdoc indexes don't align with blockquotes */
253+
div.index ul {
254+
padding-left: 1em;
255+
}
256+
257+
div.section.level3 {
258+
margin-left: 1em;
259+
}
260+
261+
sub,
262+
sup {
263+
font-size: 75%;
264+
line-height: 0;
265+
position: relative;
266+
}
267+
268+
hr {
269+
margin-top: 20px;
270+
margin-bottom: 20px;
271+
border: 0;
272+
border-top: 1px solid #eeeeee;
273+
}
274+
275+
@media print {
276+
* {
277+
text-shadow: none !important;
278+
color: #000 !important;
279+
background: transparent !important;
280+
box-shadow: none !important;
281+
}
282+
a, a:visited {
283+
text-decoration: underline;
284+
}
285+
a[href]:after {
286+
content: " (" attr(href) ")";
287+
}
288+
a[href^="javascript:"]:after, a[href^="#"]:after {
289+
content: "";
290+
}
291+
pre, blockquote {
292+
border: 1px solid #999;
293+
page-break-inside: avoid;
294+
}
295+
@page {
296+
margin: 2cm .5cm;
297+
}
298+
p, h2, h3 {
299+
orphans: 3;
300+
widows: 3;
301+
}
302+
h2, h3 {
303+
page-break-after: avoid;
304+
}
305+
table {
306+
border-collapse: collapse !important;
307+
}
308+
table td, table th {
309+
background-color: #fff !important;
310+
}
311+
}

doc/lib.css

Lines changed: 0 additions & 8 deletions
This file was deleted.

doc/manual.css

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)