-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathep2dracor
executable file
·58 lines (47 loc) · 1.01 KB
/
ep2dracor
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
56
57
58
#!/bin/sh
usage () {
cat <<EOF
Transform EarlyPrint source file(s) to DraCor TEI.
Usage: $0 source-file [source-file ...]
OPTIONS:
-h, --help show this message
EOF
}
# options parsing inspired by
# https://medium.com/@Drew_Stokes/bash-argument-parsing-54f3b81a6a8f
ALL=""
PARAMS=""
while (( "$#" )); do
case "$1" in
-h|--help)
usage
exit 0
;;
-v|--verbose)
VERBOSE=yes
shift
;;
-*|--*=) # unsupported flags
echo "Error: Unsupported flag $1" >&2
exit 1
;;
*) # preserve positional arguments
PARAMS="$PARAMS $1"
shift
;;
esac
done
# set positional arguments in their proper place
eval set -- "$PARAMS"
XSLT="ep2dracor.xsl"
OUT="tei"
for source in $@; do
name=$(basename $source .xml)
json=''
jsonfile="./meta/speakers/$name.json"
if [ -f $jsonfile ]; then
json="speakersjson=$jsonfile"
fi
saxon -xsl:$XSLT -s:$source outputdirectory=$OUT $json
done
xmlformat -f format.conf -i $(git ls-files -m -o $OUT)