|
|
@ -1,39 +1,20 @@
|
|
|
|
#! /bin/bash
|
|
|
|
#!/bin/bash -eu
|
|
|
|
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
if [[ $# != 1 || ! -d $1 ]]; then
|
|
|
|
echo "Expected /includes/head.html file as 1st arg."
|
|
|
|
echo >&2 "Usage: $0 include_dir"
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ -z "$2" ]; then
|
|
|
|
|
|
|
|
echo "Expected /includes/nav.html file as 2nd arg."
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ -z "$3" ]; then
|
|
|
|
HEADER="$1/head.html"
|
|
|
|
echo "Expected /includes/footer.html file as 3rd arg."
|
|
|
|
NAV_BAR="$1/nav.html"
|
|
|
|
exit 1
|
|
|
|
FOOTER="$1/footer.html"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HEADER=$1
|
|
|
|
|
|
|
|
NAV_BAR=$2
|
|
|
|
|
|
|
|
FOOTER=$3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ ! -f $HEADER ]; then
|
|
|
|
for f in "${HEADER}"/{head,nav,footer}.html; do
|
|
|
|
echo $HEADER " does not exist"
|
|
|
|
if [[ ! -e "${f}" ]]; then
|
|
|
|
|
|
|
|
echo >&2 "Need ${f} to exist"
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
if [ ! -f $NAV_BAR ]; then
|
|
|
|
|
|
|
|
echo $NAV_BAR " does not exist"
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ ! -f $FOOTER ]; then
|
|
|
|
|
|
|
|
echo $FOOTER " does not exist"
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
perl -MFile::Slurp -pi -e 'BEGIN { $header = read_file("'$HEADER'") } s#<head>#<head>$header
|
|
|
|
perl -MFile::Slurp -pi -e 'BEGIN { $header = read_file("'$HEADER'") } s#<head>#<head>$header
|
|
|
|
<link rel="stylesheet" href="//matrix.org/docs/guides/css/docs_overrides.css">
|
|
|
|
<link rel="stylesheet" href="//matrix.org/docs/guides/css/docs_overrides.css">
|
|
|
|