File: render_mallard_docs.sh

package info (click to toggle)
orca 49.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 53,532 kB
  • sloc: python: 98,331; javascript: 281; sh: 64; xml: 27; makefile: 5
file content (46 lines) | stat: -rw-r--r-- 1,301 bytes parent folder | download | duplicates (4)
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
#!/bin/sh
#
# Renders the Mallard help files into HTML for publishing to a web site.
#
# Assumes that a previous script has put all the Mallard docs in _build/help/* where
# the * is the language name (C, es, ja, etc.).
#
# The rendered pages are put under public/ per the convention for GitLab pages.
#
# In the end this is created:
#
# public/
#   index.html      - landing page
#   help/           - Help pages in English (from the original help/C)
#   help/es         - Spanish help
#   help/ja         - Japanese help
#   help/...        - etc.

set -eux -o pipefail

OUTPUT_DIR=$(realpath public)

toplevel=$(pwd)

LANGLINKS=" "
mkdir -p $OUTPUT_DIR/help
for d in $toplevel/_build/help/*
do
  if [ -d "$d" ]; then
    lang=$(basename $d)
    cd $d
    echo "Generating help for $lang"
    if [ $lang == "C" ]; then
      yelp-build html -o $OUTPUT_DIR/help .
      # special case to avoid having "C" in the human-readable list of languages  
      LANGLINKS="${LANGLINKS}<a href='help/'>en</a> "
    else
      lang_output_dir=$OUTPUT_DIR/help/$lang
      mkdir $lang_output_dir
      yelp-build html -o $lang_output_dir . -p ../C
      LANGLINKS="${LANGLINKS}<a href='help/$lang/'>$lang</a> "
    fi
    cd $toplevel
  fi
done
echo "User manual for Orca: ${LANGLINKS}" > $OUTPUT_DIR/index.html