my $first=0; my $firstSentence=0; open(INPUT,"<:encoding(utf-8)",$ARGV[0]); open(OUTPUT,">:encoding(utf-8)","TALISMANE-3208.xml"); print OUTPUT "\n"; print OUTPUT "\n"; my $type=""; while (my $ligne=) { next if ($ligne=~/^$/); if ($ligne =~/^\#\# (titre|description) : (.+)$/) { $type=$1; my $file=$2; chomp($file); $file=~s/ +$//; if ($first != 0) { #print OUTPUT "

\n"; print OUTPUT "\n" } else { $first++; } print OUTPUT "\n"; } if ($ligne=~/^([^\t]*) ([^\t]*) ([^\t]*) ([^\t]*) ([^\t]*) ([^\t]*) ([^\t]*) ([^\t]*) ([^\t]*) ([^\t]*)$/) { my $a1=$1; my $a2=$2; my $a3=$3; my $a4=$4; my $a5=$5; my $a6=$6; my $a7=$7; my $a8=$8; my $a9=$9; my $a10=$10; chomp($a1);chomp($a2);chomp($a3);chomp($a4);chomp($a5);chomp($a6);chomp($a7);chomp($a8);chomp($a9);chomp($a10); #print "<",$a2,">\n"; if ($a2=~/££debuttitre££/) { print OUTPUT "\n"; print OUTPUT "

\n"; $firstSentence=0; } elsif ($a2=~/££fintitre££/) { print OUTPUT "

\n"; print OUTPUT "
\n"; } elsif ($a2=~/££debutdescription££/) { print OUTPUT "\n"; print OUTPUT "

\n"; $firstSentence=0; } elsif ($a2=~/££findescription££/) { print OUTPUT "

\n"; print OUTPUT "
\n"; } else { $a1=~s/&/&/g; $a2=~s/&/&/g; $a3=~s/&/&/g; $a4=~s/&/&/g; $a5=~s/&/&/g; $a6=~s/&/&/g; $a7=~s/&/&/g; $a8=~s/&/&/g; $a9=~s/&/&/g; $a10=~s/&/&/g; if ($a1 == 1) { if ($firstSentence != 0) { print OUTPUT "

\n"; print OUTPUT "

\n"; } else { $firstSentence++; } #print OUTPUT "

\n"; } print OUTPUT "$a1$a2$a3$a4$a5$a6$a7$a8$a9$a10\n"; } } } close(INPUT); print OUTPUT "

\n"; print OUTPUT "
\n"; close(OUTPUT);