aboutsummaryrefslogtreecommitdiff
path: root/doc/generateSettingsLanguageDocs.sh
blob: ac0a3d8d4eb7ab367cc0cafe6ff8b3a9eaf254a1 (plain)
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
#!/bin/bash

XSLT_TOOL=

which xsltproc > /dev/null
if [ "$?" -ne "0" ] ; then
  which xmlstarlet > /dev/null
  if [ "$?" -ne "0" ] ; then
    echo "No XSLT tool found. Try installing either 'xsltproc' or 'xmlstarlet'"
    # Let's return 0 for now although this is an error case so "make" doesn't stop here
    exit 0
  else
    XSLT_TOOL=xmlstarlet
  fi
else
  XSLT_TOOL=xsltproc
fi

# Change to the directory of the script
cd `dirname "$0"`

OUTPUT=./html/settingslanguageschema.html
if [ "$1" != "" ]; then
  OUTPUT="$1/$OUTPUT"
fi

XSL=./rng-to-html.xsl
RELAXNG=../tools/settingslanguage/settings.rng

if [ "$XSLT_TOOL" = "xsltproc" ] ; then
  xsltproc --output $OUTPUT $XSL $RELAXNG
fi

if [ "$XSLT_TOOL" = "xmlstarlet" ] ; then
  xmlstarlet tr $XSL $RELAXNG > $OUTPUT
fi

# Return to the previous directory
cd - >/dev/null

exit 0