blob: a018fec33be0a59ed15c50af13e3893ec2068a9d (
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
|
#!/usr/bin/env sh
# One tool, one document: the answer to "how do I run this by hand?".
#
# sh pipeline/one.sh <tool> <file> [lang]
#
# where <tool> is one of
#
# read-d read-g ocda-read, the library's reader of every form; takes its
# modes after the file: one.sh read-d <file> en --tree
# dump-d dump-g the library's canonical dump of the whole model
# agree-d agree-g the library's two loaders against each other
# text-d text-g the writers. Each takes a .ssp, a .ocda.db or a
# md-d md-g .sisupod and is not told which.
# html-d html-g
# epub-d epub-g these two write a file, so they take --out
# typst-d typst-g
#
# and <file> is a .ssp, a .ocda.db or a .sisupod. Output goes to stdout except
# for the epub and the typst, which name a file.
set -e
. "$(dirname "$0")/config.sh"
tool=${1:?usage: one.sh <tool> <file> [lang]}
file=${2:?usage: one.sh <tool> <file> [lang]}
lang=${3:-}
case $tool in
read-d) shift; exec "$OCDA_LIB/dlang/result/bin/ocda-read" "$@" ;;
read-g) shift; exec "$OCDA_LIB/gleam/result/bin/ocda-read" "$@" ;;
dump-d) exec "$OCDA_LIB/dlang/result/bin/ocda-dump" "$file" $lang ;;
dump-g) exec "$OCDA_LIB/gleam/result/bin/ocda-lib" dump "$file" $lang ;;
agree-d) exec "$OCDA_LIB/dlang/result/bin/ocda-agree" "$file" $lang ;;
agree-g) exec "$OCDA_LIB/gleam/result/bin/ocda-lib" agree "$file" $lang ;;
*-d) exec "$WRITERS/dlang/result/bin/ocda-write" "--${tool%-d}" "$file" $lang ;;
*-g) exec "$WRITERS/gleam/result/bin/ocda-write" "--${tool%-g}" "$file" $lang ;;
*) echo "one.sh: unknown tool $tool" >&2; exit 2 ;;
esac
|