Skip to content

Commit dcd281e

Browse files
authored
Merge pull request #5 from rust-embedded/template
add static site generator
2 parents e5a3717 + c18f38b commit dcd281e

File tree

12 files changed

+633
-4
lines changed

12 files changed

+633
-4
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**/*.rs.bk
2+
.#*
3+
/public
4+
/target
5+
Cargo.lock

Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "showcase"
3+
version = "0.1.0"
4+
authors = ["Jorge Aparicio <[email protected]>"]
5+
edition = "2018"
6+
7+
[dependencies]
8+
tera = "0.11.20"
9+
serde_derive = "1.0.80"
10+
serde = "1.0.80"
11+
serde_yaml = "0.8.8"
12+
maplit = "1.0.1"
13+
failure = "0.1.3"
14+
exitfailure = "0.5.1"
15+
fs_extra = "1.1.0"

LICENSE-NEDERBURG

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Appernetic
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ This project is developed and maintained by the [Resources team][team].
88

99
This project is distributed under the following licenses:
1010

11+
- [`css/main.css`] is a partial re-implementation (derivative work) of the
12+
[NEDERBURG Hugo theme], which is licensed under the MIT License. A copy of the
13+
NEDERBURG license can be found at [LICENSE-NEDERBURG].
14+
15+
[`css/main.css`]: ./css/main.css
16+
[NEDERBURG Hugo theme]: https://github.com/appernetic/hugo-nederburg-theme
17+
[LICENSE-NEDERBURG]: ./LICENSE-NEDERBURG
18+
19+
- [`css/reset.css`] is licensed under the MIT License.
20+
21+
[`css/reset.css`]: ./css/reset.css
22+
1123
- The code samples and free-standing Cargo projects contained within this
1224
directory are licensed under the terms of both the [MIT License] and the
1325
[Apache License v2.0].

ci/after-success.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
set -euxo pipefail
22

33
main() {
4-
true
4+
mkdir ghp-import
5+
curl -Ls https://github.com/davisp/ghp-import/archive/master.tar.gz |
6+
tar --strip-components 1 -C ghp-import -xz
7+
8+
./ghp-import/ghp_import.py book
9+
10+
# NOTE(+x) don't print $GH_TOKEN to the console!
11+
set +x
12+
git push -fq https://$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git gh-pages && echo OK
513
}
614

7-
main
15+
if [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ]; then
16+
main
17+
fi

ci/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
set -euxo pipefail
22

33
main() {
4-
true
4+
pip install linkchecker --user
55
}
66

77
main

ci/script.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
set -euxo pipefail
22

33
main() {
4-
true
4+
cargo run
5+
6+
linkchecker public
57
}
68

79
main

css/main.css

Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
/* A partial re-implementation (derivative work) of the NEDERBURG Hugo theme (https://themes.gohugo.io/hugo-nederburg-theme/) */
2+
/* NEDERBURG is licensed under the MIT License. A copy of its license can be found at: */
3+
/* - https://github.com/rust-embedded/showcase/blob/master/LICENSE-NEDERBURG */
4+
/* - https://github.com/appernetic/hugo-nederburg-theme/blob/master/LICENSE */
5+
6+
html {
7+
background-color: #2f3360;
8+
text-align: center;
9+
}
10+
11+
a {
12+
text-decoration: none;
13+
}
14+
15+
main a {
16+
color: #000;
17+
color: rgba(0, 0, 0, 0.75);
18+
}
19+
20+
main a:hover {
21+
color: rgba(0, 0, 0, 1);
22+
}
23+
24+
body > header {
25+
padding-top: 1.5em;
26+
padding-bottom: 1.5em;
27+
28+
color: #fff;
29+
color: rgba(255, 255, 255, 0.75);
30+
31+
position: relative;
32+
}
33+
34+
body > header a {
35+
color: #fff;
36+
color: rgba(255, 255, 255, 0.75);
37+
}
38+
39+
body > header a:hover {
40+
color: #fff;
41+
}
42+
43+
.menu {
44+
font-weight: 700;
45+
46+
text-transform: uppercase;
47+
}
48+
49+
.menu ul li {
50+
list-style: none;
51+
}
52+
53+
/* Mobile */
54+
li a {
55+
display: block;
56+
}
57+
58+
.menu li {
59+
border-bottom: 1px solid white;
60+
padding-top: 1em;
61+
padding-bottom: 1em;
62+
}
63+
64+
.menu li:last-child {
65+
border-bottom: none;
66+
}
67+
68+
/* Desktop */
69+
@media only screen and (min-width: 800px) {
70+
.menu {
71+
font-size: 0.9em;
72+
line-height: 2;
73+
text-align: right;
74+
75+
position: absolute;
76+
top: 1.5em;
77+
right: 0;
78+
}
79+
80+
.menu li {
81+
border-bottom: none;
82+
display: inline;
83+
}
84+
85+
li a {
86+
display: inline;
87+
}
88+
89+
.menu li + li:before {
90+
content: '/';
91+
margin-left: 0.5em;
92+
margin-right: 0.5em;
93+
}
94+
}
95+
96+
.menu > span {
97+
margin-left: 0.5em;
98+
margin-right: 0.5em;
99+
}
100+
101+
.title {
102+
text-align: left;
103+
}
104+
105+
.title > a {
106+
font-size: 1.5em;
107+
font-weight: 700;
108+
text-transform: uppercase;
109+
}
110+
111+
.title > p {
112+
line-height: 1.5;
113+
}
114+
115+
body {
116+
font-family: 'Fira Sans', sans-serif;
117+
font-size: 16px;
118+
119+
/* Centered with some margin on the sides */
120+
margin: 0 auto;
121+
max-width: 1280px;
122+
width: 90%;
123+
}
124+
125+
main header {
126+
font-size: 2em;
127+
font-weight: 700;
128+
129+
text-transform: uppercase;
130+
}
131+
132+
article {
133+
margin-bottom: 1.5em;
134+
}
135+
136+
.vcenter {
137+
background-color: #eaecf2;
138+
color: #000;
139+
color: rgba(0, 0, 0, 0.75);
140+
141+
padding-left: 5%;
142+
padding-right: 5%;
143+
144+
/* MAGIC to make padding not affect width */
145+
-webkit-box-sizing: border-box;
146+
-moz-box-sizing: border-box;
147+
box-sizing: border-box;
148+
149+
/* Vertically center contents */
150+
display: flex;
151+
justify-content: center;
152+
}
153+
154+
.vcenter > section {
155+
align-self: center;
156+
}
157+
158+
.author {
159+
margin-top: 0.5em;
160+
}
161+
162+
.author > span {
163+
font-weight: 700;
164+
}
165+
166+
.description {
167+
line-height: 1.5;
168+
169+
margin-top: 1.5em;
170+
margin-bottom: 1.5em;
171+
}
172+
173+
section > footer {
174+
font-size: 0.9em;
175+
font-weight: 700;
176+
177+
text-transform: uppercase;
178+
}
179+
180+
figure {
181+
/* Need by the `a > span` rule below */
182+
position: relative;
183+
}
184+
185+
/* https://stackoverflow.com/questions/796087/make-a-div-into-a-link */
186+
a > span {
187+
height: 100%;
188+
left: 0;
189+
position: absolute;
190+
top: 0;
191+
width: 100%;
192+
z-index: 1;
193+
}
194+
195+
/* Mobile: use the full width for the image and the text */
196+
figure {
197+
background-size: cover;
198+
background-position: 50%;
199+
/* NOTE force the image to have a 4:3 aspect ratio */
200+
padding-bottom: 75%;
201+
width: 100%;
202+
}
203+
204+
.video {
205+
position: relative;
206+
width: 100%;
207+
/* NOTE aspect ratio */
208+
padding-bottom: 75%;
209+
}
210+
211+
video {
212+
position: absolute;
213+
top: 0;
214+
left: 0;
215+
height: 100%;
216+
width: 100%;
217+
}
218+
219+
.vcenter {
220+
width: 100%;
221+
}
222+
223+
section > header {
224+
padding-top: 1em;
225+
}
226+
227+
section > footer {
228+
padding-bottom: 2em;
229+
}
230+
231+
/* Desktop: place the figure and the text side-by-side */
232+
@media only screen and (min-width: 900px) {
233+
figure {
234+
width: 50%;
235+
/* NOTE aspect ratio */
236+
padding-bottom: 37.5%;
237+
}
238+
239+
.video {
240+
width: 50%;
241+
/* NOTE aspect ratio */
242+
padding-bottom: 37.5%;
243+
}
244+
245+
.vcenter {
246+
width: 50%;
247+
}
248+
249+
/* Undo padding; we'll inherit some margin from the image height */
250+
section > header {
251+
padding-top: 0;
252+
}
253+
254+
section > footer {
255+
padding-bottom: 0;
256+
}
257+
258+
article {
259+
display: flex;
260+
flex-direction: row;
261+
flex-wrap: wrap;
262+
}
263+
264+
/* Odd items: Swap text-image order */
265+
.odd > .vcenter {
266+
order: -1;
267+
}
268+
}

0 commit comments

Comments
 (0)