Merge pull request #176 from matrix-org/daniel/gendoc

Tweaks to spec generation for matrix.org
This commit is contained in:
Oddvar Lovaas 2015-11-23 10:28:51 +00:00
commit 24356d864e

View file

@ -1,41 +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 fi
if [ -z "$2" ]; then HEADER="$1/head.html"
echo "Expected /includes/nav.html file as 2nd arg." NAV_BAR="$1/nav.html"
FOOTER="$1/footer.html"
for f in "$1"/{head,nav,footer}.html; do
if [[ ! -e "${f}" ]]; then
echo >&2 "Need ${f} to exist"
exit 1 exit 1
fi fi
done
if [ -z "$3" ]; then
echo "Expected /includes/footer.html file as 3rd arg."
exit 1
fi
HEADER=$1
NAV_BAR=$2
FOOTER=$3
if [ ! -f $HEADER ]; then
echo $HEADER " does not exist"
exit 1
fi
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
python gendoc.py
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">