debiandoc-sgml/debian/test-debiandoc-sgml

112 lines
3.9 KiB
Bash
Executable File

#!/bin/bash
function create_source()
{
echo -n '<!doctype debiandoc public "-//DebianDoc//DTD DebianDoc//EN">
<debiandoc>
<book id="Debiandoc-example">
<title>Debiandoc example</title>
<author>
<name>Osamu Aoki</name>
<email>osamu@debian.org</email>
</author>
<version>Version 1.00 August 2007</version>
<abstract>
This provides a simple example of a debiandoc-sgml document. For testing conversion result.
</abstract>
<copyright>
<copyrightsummary>
Copyright &copy; 2002 by Osamu Aoki <email>osamu@debian.org</>
</copyrightsummary>
<p>
<url id="http://www.gnu.org/copyleft/gpl.html"
name="This document may used under the terms of the GNU General Public License version 2 or higher.">
</copyright>
<toc sect1> <!-- list section to sect1 -->
<chapt>'
LC_ALL=$LOCALE sed -n "s/^.*'footnotes'.*'\(.*\)'.*$/\1/p" <./tools/lib/Locale/$LOCALE/HTML
echo '<p>
<sect>Funny characters
<p>
TEST CHAPT footnotes.
<p>
Following is Latex for'
echo $LOCALE
echo '<example>'
cat ./tools/lib/Locale/$LOCALE/LaTeX
echo '</example>
<p>
Following is HTML for'
echo $LOCALE
echo '<example>'
cat ./tools/lib/Locale/$LOCALE/HTML
echo -n '</example>
<chapt>XX'
LC_ALL=$LOCALE sed -n "s/.*'comments'.*'\(.*\)'.*/\1/p" <./tools/lib/Locale/$LOCALE/HTML
echo -n '<p>
TEST CHAPT comments.
<chapt>XX'
LC_ALL=$LOCALE sed -n "s/.*'next'.*'\(.*\)'.*/\1/p" <./tools/lib/Locale/$LOCALE/HTML
echo -n '<p>
TEST CHAPT next.
<chapt>XX'
LC_ALL=$LOCALE sed -n "s/.*'previous'.*'\(.*\)'.*/\1/p" <./tools/lib/Locale/$LOCALE/HTML
echo '<p>
TEST CHAPT previous.
</book>
</debiandoc>'
}
function test_debiandoc_all ()
{
OPTS="-v"
#OPTS=""
PATHLOCALE="tools/lib/Locale"
debiandoc2html -X $PATHLOCALE -l $LOCALE test-$LOCALE.sgml 2>&1 && echo "GOOD: html ALL for $LOCALE" || \
( debiandoc2html -X $PATHLOCALE -l $LOCALE test.sgml 2>&1 && echo "FAIR: html only ASCII for $LOCALE" ) || \
echo "FAIL: html ANY ***** for $LOCALE *****"
debiandoc2text -X $PATHLOCALE -l $LOCALE test-$LOCALE.sgml 2>&1 && echo "GOOD: text ALL for $LOCALE" || \
( debiandoc2text -X $PATHLOCALE -l $LOCALE test.sgml 2>&1 && echo "FAIR: text only ASCII for $LOCALE" ) || \
echo "FAIL: text ANY ***** for $LOCALE *****"
debiandoc2latexps $OPTS -X $PATHLOCALE -l $LOCALE test-$LOCALE.sgml 2>&1 && echo "GOOD: latexps ALL for $LOCALE" || \
( debiandoc2latexps $OPTS -X $PATHLOCALE -l $LOCALE test.sgml 2>&1 && echo "FAIR: latexps only ASCII for $LOCALE" ) || \
echo "FAIL: latexps ANY ***** for $LOCALE *****"
debiandoc2latexpdf $OPTS -X $PATHLOCALE -l $LOCALE test-$LOCALE.sgml 2>&1 && echo "GOOD: latexpdf ALL for $LOCALE" || \
( debiandoc2latexpdf $OPTS -X $PATHLOCALE -l $LOCALE test.sgml 2>&1 && echo "FAIR: latexpdf only ASCII for $LOCALE" ) || \
echo "FAIL: latexpdf ANY ***** for $LOCALE *****"
debiandoc2latex -X $PATHLOCALE -l $LOCALE test-$LOCALE.sgml 2>&1 && echo "GOOD: latex ALL for $LOCALE" || \
( debiandoc2latex -X $PATHLOCALE -l $LOCALE test.sgml 2>&1 && echo "FAIR: latex only ASCII for $LOCALE" ) || \
echo "FAIL: latex ANY ***** for $LOCALE *****"
}
##############################
LOCALE=en_US.UTF-8
create_source >test.sgml
echo "$# parameters with $1"
if [ $# -gt 0 ]; then
LOCALE=$1
create_source >test-$LOCALE.sgml
test_debiandoc_all
else
for i in $(cd tools/lib/Locale>/dev/null; ls -1d ??_??.*); do
LOCALE=$i
echo "----------------- LOCALE - $LOCALE --------------------------"
create_source >test-$LOCALE.sgml
test_debiandoc_all
done
fi