-
Notifications
You must be signed in to change notification settings - Fork 465
/
Copy pathdoc
executable file
·104 lines (95 loc) · 3.61 KB
/
doc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/env bash
#
# Copyright 2019 Timely Data, Inc. All rights reserved.
#
# doc — renders API documentation.
set -euo pipefail
cd "$(dirname "$0")/.."
# Use nightly until stable supports intra-Rustdoc links.
# https://github.com/rust-lang/rust/issues/43466
cargo +nightly doc
crates=$(cargo metadata --format-version=1 \
| jq -r -f misc/doc/crates.jq --arg pwd "$(pwd)")
# Create a nice homepage for the docs. It's awful that we have to copy the
# HTML template like this, but the upstream issue [0] that would resolve this is
# now five years old and doesn't look close to resolution.
# [0]: https://github.com/rust-lang/cargo/issues/739
cat > target/doc/index.html <<EOF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>materialize - Rust</title>
<link rel="stylesheet" type="text/css" href="normalize.css">
<link rel="stylesheet" type="text/css" href="rustdoc.css" id="mainThemeStyle">
<link rel="stylesheet" type="text/css" href="dark.css">
<link rel="stylesheet" type="text/css" href="light.css" id="themeStyle">
<script src="storage.js"></script>
<noscript>
<link rel="stylesheet" href="noscript.css">
</noscript>
<link rel="shortcut icon" href="favicon.ico">
<style type="text/css">
#crate-search {
background-image: url("down-arrow.svg");
}
</style>
</head>
<body class="rustdoc mod">
<!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]-->
<nav class="sidebar">
<div class="sidebar-menu">☰</div>
<a href='index.html'><img src='rust-logo.png' alt='logo' width='100'></a>
<p class='location'>Home</p>
<div class="sidebar-elems">
</div>
</nav>
<div class="theme-picker">
<button id="theme-picker" aria-label="Pick another theme!"><img src="brush.svg" width="18" alt="Pick another theme!"></button>
<div id="theme-choices"></div>
</div>
<script src="theme.js"></script>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<div>
<select id="crate-search">
<option value="All crates">All crates</option>
</select>
<input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search">
</div>
<a id="settings-menu" href="settings.html"><img src="wheel.svg" width="18" alt="Change settings"></a>
</div>
</form>
</nav>
<section id="main" class="content">
<h1 class='fqn'>
<span class='in-band'>Materialize documentation</span>
</h1>
<p>This is the home of Materialize's internal API documentation.</p>
<h2>Important crates</h2>
<table>
$crates
</table>
</section>
<section id="search" class="content hidden"></section>
<section class="footer"></section>
<script>
window.rootPath = "./";
window.currentCrate = "materialize";
</script>
<script src="aliases.js"></script>
<script src="main.js"></script>
<script defer src="search-index.js"></script>
</body>
</html>
EOF
# Make the logo link to the nice homepage we just created. Otherwise it just
# links to the root of whatever crate you happen to be looking at.
cat >> target/doc/main.js <<EOF
;
var el = document.querySelector("img[alt=logo]").parentNode;
if (el.href != "index.html") {
el.href = "../index.html";
}
EOF