-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocument-schema
executable file
·56 lines (48 loc) · 1.71 KB
/
document-schema
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
# Copyright (C) 2013 Columbia University in the City of New York and others.
#
# Please see the AUTHORS file in the main source directory for a full list
# of contributors.
#
# This file is part of TerraFERMA.
#
# TerraFERMA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# TerraFERMA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with TerraFERMA. If not, see <http://www.gnu.org/licenses/>.
if [ $# -lt 1 ]; then
echo "Usage: $0 schema.rng [output-directory]" >&2
exit 1
fi
if ! which saxonb-xslt > /dev/null; then
echo "Error: cannot locate saxonb-xslt, a dependency of this script." >&2
echo "Please install saxonb-xslt."
exit 1
fi
if [[ "$2" = /* ]]; then
outputdir=$2
else
outputdir=$PWD/$2
fi
if [[ "$(dirname $0)" = /* ]]; then
filedir=$(dirname $0)
else
filedir=$PWD/$(dirname $0)
fi
schemadir=$(dirname $1)
schemafile=$(basename $1)
cd $schemadir
cp /usr/share/spud/spud_base.rng .
cp $filedir/schema-doc.xsl .
saxonb-xslt -ext:on -xsl:schema-doc.xsl -s:$schemafile docurl=https://github.com/terraferma/terraferma/wiki/Documentation issueurl=https://github.com/terraferma/terraferma/issues basedir=$outputdir
rm spud_base.rng
rm schema-doc.xsl
cd - >& /dev/null