Skip to content

Commit 01cfe4f

Browse files
committed
add static site generator
content is to be entered in data.yml closes #2
1 parent e5a3717 commit 01cfe4f

File tree

11 files changed

+599
-4
lines changed

11 files changed

+599
-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

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
language: rust
2+
# TODO switch to stable (i.e. remove this line) when 1.31 is out
3+
rust: beta
24

35
install:
46
- bash ci/install.sh

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"

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

0 commit comments

Comments
 (0)