Skip to content

Commit

Permalink
fix: base url added to book
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra committed May 16, 2020
1 parent f6cc715 commit 335f930
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
1 change: 1 addition & 0 deletions book/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/book
/theme/highlight.js
/theme/head.hbs
29 changes: 23 additions & 6 deletions book/ci/build
Original file line number Diff line number Diff line change
@@ -1,22 +1,39 @@
#!/bin/bash

set -euo pipefail
set -eo pipefail

pushd ./book

# First build our custom highlight.js
./ci/build-highlight-js
# If there is a BASE_URL defined insert that into the head section of the
# book
if [[ ! -z "$BASE_URL" ]]; then
echo "Inserting BASE_URL: $BASE_URL"
echo "<base href=\"$BASE_URL\" />" > theme/head.hbs
else
echo "not using BASE_URL"
fi

# Check if mdbook is installed, otherwise download the binaries
mdbook="mdbook"
if ! [ -x "$(command -v $mdbook)" ]; then
# Ensure cargo is installed
if ! [ -x "$(command -v cargo)" ]; then
# Install rust & cargo
curl https://sh.rustup.rs -sSf | sh -s -- -y
# We have to source the installation
source $HOME/.cargo/env
fi

# Install mdBook from source
echo "Installing mdbook.."
curl -sL https://github.com/rust-lang-nursery/mdBook/releases/download/v0.3.1/mdbook-v0.3.1-x86_64-unknown-linux-gnu.tar.gz | tar zxv
mdbook="./mdbook"
cargo install --git https://github.com/rust-lang/mdBook.git mdbook
fi

# First build our custom highlight.js
./ci/build-highlight-js

# Actually build the book
echo 'Building book..'
$mdbook build

popd
popd
3 changes: 3 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
from = "/v0.2/*"
to = "https://release-v0-2.docs.mun-lang.org/:splat"
status = 200

[context."release/v0.2"]
environment = { BASE_URL = "/v0.2/" }

0 comments on commit 335f930

Please sign in to comment.