#! /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.
</p>"
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>
"
drawing="Drawing commands"
synonym="Synonymes"
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>
"
drawing="Commandes"
synonym="Synonymes"
fi ;
if [ "$lang" = cn ] ; then echo "
ÿÌõÃüÁîÕ¼Ò»ÐÐ.<p>
ÔÚϱíÖÐ, <tt>[É«²Ê]</tt>
¿ÉÒÔÊÇÉ«²ÊÃû, »ò3¸öÓöººÅ·Ö¸ôµÄ0µ½255µÄÕûÊý, ·Ö±ð´ú±íºìÂÌÀ¶ÈýÖÖÑÕÉ«.
</p>
"
drawing="×÷ͼÃüÁî"
synonym="ͬÒå´Ê"
fi
echo "\$table_header
<caption>$drawing</caption>
\$table_hdtr<th colspan="5">\$wims_name_name - \$wims_name_Syntax</th>
\$table_hdtr<th colspan="2">$synonym</th>
<th colspan="3">\$wims_name_Meaning</th></tr>
"
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>"}
' $file
echo "\$table_end"