#!/usr/bin/perl
use XML::DT ;
my $filename = shift;

my @aut=();

%handler=(
    '-outputenc' => 'ISO-8859-1',
#    '-default'   => sub{"<$q>$c</$q>"},
     'RANDLIST' => sub{"\\begin{itemize}$c\\end{itemize}"},
     'AFFIL' => sub{""},
     'TITLE' => sub{
                  if(inctxt('SECTION')){"\\section{$c}"}
               elsif(inctxt('SUBSEC1')){"\\subsection{$c}"}
               else                    {"\\title{$c}"}
            },
     'GCAPAPER' => sub{"\\documentclass{article}
\\usepackage[latin1]{inputenc}
\\usepackage{t1enc}
\\bibliographystyle{plain}
\\begin{document}
        $c
\\end{document}\n"},
     'PARA' => sub{"$c\n\n"},
     'ADDRESS' => sub{"\\thanks{$c}"},
     'PUB' => sub{"} $c"},
     'FNAME' => sub{" $c"},
     'EMAIL' => sub{"(\\texttt{$c}) "},
     'FRONT' => sub{"$c\n"},
     'REAR' => sub{"$c"},
     'BIB' => sub{"$c"},
     'BODY' => sub{"$c"},
     'AUTHOR' => sub{ $c =~ s/[\n\s]+/ /g; push @aut, $c ; ""},
     'ABSTRACT' => sub{
        "\\author{" . 
        join ("\\and", @aut).
        "}\\maketitle\\begin{abstract}$c\\end{abstract}"},
     'CODE.BLOCK' => sub{"\\begin{verbatim}\n$c\\end{verbatim}\n"},
     'XREF' => sub{"\\cite{$v{REFLOC}}"},
     'SECTION' => sub{"$c"},
     'LI' => sub{"\\item $c"},
     'SUBSEC1' => sub{"$c"},
     'BIBLIOG' => sub{"\n\\begin{thebibliography}{1}\n$c\n\\end{thebibliography}\n"},
     'HIGHLIGHT' => sub{" \\emph{$c} "},
     'BIO' => sub{""},
     'SURNAME' => sub{" $c "},
     'CODE' => sub{"\\verb!$c!"},
     'BIBITEM' => sub{"\n\\bibitem{$c"},
);
print dt($filename,%handler); 
