#!/bin/sh

"$TESTDIR/hghave" rst2html || exit 80
RST2HTML=`which rst2html 2> /dev/null || which rst2html.py`

HGENCODING=UTF-8
export HGENCODING

for PO in C $TESTDIR/../i18n/*.po; do
    LOCALE=`basename $PO .po`
    echo
    echo "% extracting documentation from $LOCALE"
    echo ".. -*- coding: utf-8 -*-" > gendoc-$LOCALE.txt
    echo "" >> gendoc-$LOCALE.txt
    LC_ALL=$LOCALE python $TESTDIR/../doc/gendoc.py >> gendoc-$LOCALE.txt || exit

    # We run rst2html over the file without adding "--halt warning" to
    # make it report all errors instead of stopping on the first one.
    echo "checking for parse errors with rst2html"
    $RST2HTML gendoc-$LOCALE.txt /dev/null
done
