#! /bin/sh
cd `dirname $0`
lang=$1
if [ -n "$lang" ] ; then file="commands.$lang" ; else file="commands" ; lang="en"; fi;
echo "<p>
!! This file is automatically generated! Do not edit by hand."
if [ "$lang" = en ] ; then echo "
Each command takes one line.<p>
In the following table, <tt>[color]</tt>
may be either a color name, or 3 integers between 0 and 255, separated by commas,
for the values of red,green,blue.
<p>\$table_header
<caption>Drawing commands</caption>
\$table_hdtr<th colspan=5>Name and syntax
\$table_hdtr<th colspan=2>Synonymes
<th colspan=3>Meaning</th></tr><tr><td><td colspan=5>
" ; fi
if [ "$lang" = fr ] ; then echo "
Chaque commande prend une ligne.<p>
Dans la table suivante <tt>[color]</tt>
peut être un nom de couleur ou 3 entiers 0 entre 255, séparés par des virgules,
correspondant aux valeurs de rouge, vert ,bleu.
<p>\$table_header
<caption>Commandes</caption>
\$table_hdtr<th colspan=5>Nom et syntaxe
\$table_hdtr<th colspan=2>Synonymes
<th colspan=3>Signification</th></tr><tr><td><td colspan=5>
" ; fi
if [ "$lang" = cn ] ; then echo "
ÿÌõÃüÁîÕ¼Ò»ÐÐ.<p>
ÔÚϱíÖÐ, <tt>[É«²Ê]</tt>
¿ÉÒÔÊÇÉ«²ÊÃû, »ò3¸öÓöººÅ·Ö¸ôµÄ0µ½255µÄÕûÊý, ·Ö±ð´ú±íºìÂÌÀ¶ÈýÖÖÑÕÉ«.
<p>\$table_header
<caption>×÷ͼÃüÁî</caption>
\$table_hdtr<th colspan=5>Ãû³ÆÓëÓï·¨
\$table_hdtr<th colspan=2>ͬÒå´Ê
<th colspan=3>º¬Òå</th></tr><tr><td><td colspan=5>
" ; fi
awk 'BEGIN {a=10}
substr($0,1,1)==":" {a=0}
{a++}
a==1 {print "$table_tr<td colspan=5 nowrap><tt>"substr($0,2)"</tt></td></tr>"}
a==2 {print "$table_tr<td colspan=2><tt>"$0" </tt></td>"}
a==3 {print "<td colspan=3>"$0"</td></tr><tr><td colspan=5>"}
' $file
echo "\$table_end<p>"