Skip to content

add static site generator #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/*.rs.bk
.#*
/public
/target
Cargo.lock
15 changes: 15 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "showcase"
version = "0.1.0"
authors = ["Jorge Aparicio <[email protected]>"]
edition = "2018"

[dependencies]
tera = "0.11.20"
serde_derive = "1.0.80"
serde = "1.0.80"
serde_yaml = "0.8.8"
maplit = "1.0.1"
failure = "0.1.3"
exitfailure = "0.5.1"
fs_extra = "1.1.0"
21 changes: 21 additions & 0 deletions LICENSE-NEDERBURG
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Appernetic

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ This project is developed and maintained by the [Resources team][team].

This project is distributed under the following licenses:

- [`css/main.css`] is a partial re-implementation (derivative work) of the
[NEDERBURG Hugo theme], which is licensed under the MIT License. A copy of the
NEDERBURG license can be found at [LICENSE-NEDERBURG].

[`css/main.css`]: ./css/main.css
[NEDERBURG Hugo theme]: https://github.com/appernetic/hugo-nederburg-theme
[LICENSE-NEDERBURG]: ./LICENSE-NEDERBURG

- [`css/reset.css`] is licensed under the MIT License.

[`css/reset.css`]: ./css/reset.css

- The code samples and free-standing Cargo projects contained within this
directory are licensed under the terms of both the [MIT License] and the
[Apache License v2.0].
Expand Down
14 changes: 12 additions & 2 deletions ci/after-success.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
set -euxo pipefail

main() {
true
mkdir ghp-import
curl -Ls https://github.com/davisp/ghp-import/archive/master.tar.gz |
tar --strip-components 1 -C ghp-import -xz

./ghp-import/ghp_import.py book

# NOTE(+x) don't print $GH_TOKEN to the console!
set +x
git push -fq https://[email protected]/$TRAVIS_REPO_SLUG.git gh-pages && echo OK
}

main
if [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ]; then
main
fi
2 changes: 1 addition & 1 deletion ci/install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set -euxo pipefail

main() {
true
pip install linkchecker --user
}

main
4 changes: 3 additions & 1 deletion ci/script.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
set -euxo pipefail

main() {
true
cargo run

linkchecker public
}

main
268 changes: 268 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
/* A partial re-implementation (derivative work) of the NEDERBURG Hugo theme (https://themes.gohugo.io/hugo-nederburg-theme/) */
/* NEDERBURG is licensed under the MIT License. A copy of its license can be found at: */
/* - https://github.com/rust-embedded/showcase/blob/master/LICENSE-NEDERBURG */
/* - https://github.com/appernetic/hugo-nederburg-theme/blob/master/LICENSE */

html {
background-color: #2f3360;
text-align: center;
}

a {
text-decoration: none;
}

main a {
color: #000;
color: rgba(0, 0, 0, 0.75);
}

main a:hover {
color: rgba(0, 0, 0, 1);
}

body > header {
padding-top: 1.5em;
padding-bottom: 1.5em;

color: #fff;
color: rgba(255, 255, 255, 0.75);

position: relative;
}

body > header a {
color: #fff;
color: rgba(255, 255, 255, 0.75);
}

body > header a:hover {
color: #fff;
}

.menu {
font-weight: 700;

text-transform: uppercase;
}

.menu ul li {
list-style: none;
}

/* Mobile */
li a {
display: block;
}

.menu li {
border-bottom: 1px solid white;
padding-top: 1em;
padding-bottom: 1em;
}

.menu li:last-child {
border-bottom: none;
}

/* Desktop */
@media only screen and (min-width: 800px) {
.menu {
font-size: 0.9em;
line-height: 2;
text-align: right;

position: absolute;
top: 1.5em;
right: 0;
}

.menu li {
border-bottom: none;
display: inline;
}

li a {
display: inline;
}

.menu li + li:before {
content: '/';
margin-left: 0.5em;
margin-right: 0.5em;
}
}

.menu > span {
margin-left: 0.5em;
margin-right: 0.5em;
}

.title {
text-align: left;
}

.title > a {
font-size: 1.5em;
font-weight: 700;
text-transform: uppercase;
}

.title > p {
line-height: 1.5;
}

body {
font-family: 'Fira Sans', sans-serif;
font-size: 16px;

/* Centered with some margin on the sides */
margin: 0 auto;
max-width: 1280px;
width: 90%;
}

main header {
font-size: 2em;
font-weight: 700;

text-transform: uppercase;
}

article {
margin-bottom: 1.5em;
}

.vcenter {
background-color: #eaecf2;
color: #000;
color: rgba(0, 0, 0, 0.75);

padding-left: 5%;
padding-right: 5%;

/* MAGIC to make padding not affect width */
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;

/* Vertically center contents */
display: flex;
justify-content: center;
}

.vcenter > section {
align-self: center;
}

.author {
margin-top: 0.5em;
}

.author > span {
font-weight: 700;
}

.description {
line-height: 1.5;

margin-top: 1.5em;
margin-bottom: 1.5em;
}

section > footer {
font-size: 0.9em;
font-weight: 700;

text-transform: uppercase;
}

figure {
/* Need by the `a > span` rule below */
position: relative;
}

/* https://stackoverflow.com/questions/796087/make-a-div-into-a-link */
a > span {
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
z-index: 1;
}

/* Mobile: use the full width for the image and the text */
figure {
background-size: cover;
background-position: 50%;
/* NOTE force the image to have a 4:3 aspect ratio */
padding-bottom: 75%;
width: 100%;
}

.video {
position: relative;
width: 100%;
/* NOTE aspect ratio */
padding-bottom: 75%;
}

video {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
}

.vcenter {
width: 100%;
}

section > header {
padding-top: 1em;
}

section > footer {
padding-bottom: 2em;
}

/* Desktop: place the figure and the text side-by-side */
@media only screen and (min-width: 900px) {
figure {
width: 50%;
/* NOTE aspect ratio */
padding-bottom: 37.5%;
}

.video {
width: 50%;
/* NOTE aspect ratio */
padding-bottom: 37.5%;
}

.vcenter {
width: 50%;
}

/* Undo padding; we'll inherit some margin from the image height */
section > header {
padding-top: 0;
}

section > footer {
padding-bottom: 0;
}

article {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}

/* Odd items: Swap text-image order */
.odd > .vcenter {
order: -1;
}
}
Loading