#!/usr/bin/env sh # One tool, one document: the answer to "how do I run this by hand?". # # sh pipeline/one.sh [lang] # # where 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 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 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 [lang]} file=${2:?usage: one.sh [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