Debian Codegraph @

ci/render_mallard_docs.sh

raw
1 #!/bin/sh
2 #
3 # Renders the Mallard help files into HTML for publishing to a web site.
4 #
5 # Assumes that a previous script has put all the Mallard docs in _build/help/* where
6 # the * is the language name (C, es, ja, etc.).
7 #
8 # The rendered pages are put under public/ per the convention for GitLab pages.
9 #
10 # In the end this is created:
11 #
12 # public/
13 # index.html - landing page
14 # help/ - Help pages in English (from the original help/C)
15 # help/es - Spanish help
16 # help/ja - Japanese help
17 # help/... - etc.
18
19 set -eux -o pipefail
20
21 OUTPUT_DIR=$(realpath public)
22
23 toplevel=$(pwd)
24
25 LANGLINKS=" "
26 mkdir -p $OUTPUT_DIR/help
27 for d in $toplevel/_build/help/*
28 do
29 if [ -d "$d" ]; then
30 lang=$(basename $d)
31 cd $d
32 echo "Generating help for $lang"
33 if [ $lang == "C" ]; then
34 yelp-build html -o $OUTPUT_DIR/help .
35 # special case to avoid having "C" in the human-readable list of languages
36 LANGLINKS="${LANGLINKS}<a href='help/'>en</a> "
37 else
38 lang_output_dir=$OUTPUT_DIR/help/$lang
39 mkdir $lang_output_dir
40 yelp-build html -o $lang_output_dir . -p ../C
41 LANGLINKS="${LANGLINKS}<a href='help/$lang/'>$lang</a> "
42 fi
43 cd $toplevel
44 fi
45 done
46 echo "User manual for Orca: ${LANGLINKS}" > $OUTPUT_DIR/index.html