Skip to content
Snippets Groups Projects
Verified Commit e4bc603a authored by Rok Štular's avatar Rok Štular
Browse files

feat(build): Add a banner to the draft book deployment

parent 5231ff18
No related branches found
No related tags found
2 merge requests!80check toc purge,!78feat(build): Add a banner to the draft book deployment
Pipeline #207227 passed
......@@ -3,20 +3,21 @@ author: MUDE Teachers and the Student Army
logo: _static/MUDE_Logo-small.png
execute:
execute_notebooks: 'off'
execute_notebooks: "off"
sphinx:
config:
# Bibliography style
bibtex_reference_style: author_year
extra_extensions:
- sphinx_inline_tabs
- sphinx_grasple
- sphinx.ext.imgconverter
- sphinx_inline_tabs
- sphinx_grasple
- sphinx.ext.imgconverter
bibtex_bibfiles:
- _bibliography/references_pd.bib
launch_buttons:
thebe: true
draft_banner: '⚠️This is a draft website. The most recent published version can be found <a href="https://mude.citg.tudelft.nl/book/intro.html">here</a>.⚠️'
......@@ -4,12 +4,22 @@ set -euo pipefail
START_SERVER=${1:-false}
PAGE_ROOT=${2:-"/"}
USE_TOC_BLACKLIST=${3:-false}
IS_PUBLISH_DEPLOYMENT=${3:-false}
# Pre-process the book using the blacklist comment
if [ "$USE_TOC_BLACKLIST" = true ]; then
echo "Using TOC blacklist"
# Pre-process the book
if [ "$IS_PUBLISH_DEPLOYMENT" = true ]; then
echo "Using publish deployment strategy"
# Remove chapters from the book which are not to be published
sed --in-place=".bak" '/# START REMOVE-FROM-PUBLISH/,/# END REMOVE-FROM-PUBLISH/{//!d}' book/_toc.yml
else
echo "Using draft deployment strategy"
# Add a banner which identifies the book as a draft
if ! command -v yq &> /dev/null; then
echo "yq could not be found, the banner will not be added"
else
cp book/_config.yml book/_config.yml.bak
yq -i '.html.announcement = .draft_banner' book/_config.yml
fi
fi
# Build the jupyter book, everything else is post-processing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment