You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
#!/bin/sh
|
|
|
|
set -Eeuo pipefail
|
|
trap cleanup SIGINT SIGTERM ERR EXIT
|
|
|
|
function cleanup() {
|
|
trap - SIGINT SIGTERM ERR EXIT
|
|
|
|
# On exit, remove any symbolic link in content/french that points
|
|
# to content/english
|
|
find content/french -type l -print0 | while IFS= read -r -d $'\0' filename; do
|
|
if realpath "$filename" | grep -E "^$PWD/" > /dev/null; then
|
|
rm -f "$filename"
|
|
fi
|
|
done
|
|
}
|
|
|
|
# First, try to find page bundles. In that case, link the directory
|
|
(cd content/english && find * -type f -name 'index.md') | while read file; do
|
|
if [ ! -e "content/french/$file" ]; then
|
|
d="$(dirname $file)"
|
|
ln -s ../../../content/english/$d content/french/$d
|
|
fi
|
|
done
|
|
|
|
# Then, find the regular pages and link the files directly.
|
|
(cd content/english && find * -type f -name '*.md') | while read file; do
|
|
if [ ! -e "content/french/$file" ]; then
|
|
ln -s ../../../content/english/$file content/french/$file
|
|
fi
|
|
done
|
|
|
|
# Remove dangling links
|
|
find content/french -xtype l -exec rm -f {} \;
|
|
|
|
hugo gen chromastyles --style=borland > static/css/chroma.css
|
|
hugo "$@"
|
|
|