#!/usr/bin/perl
#
# Sebastian Rahtz, 21/02/1996
# customization: TP --
#
# Read "repere" output from hyperref and generate pdfmark
# bookmark entries
#
$slash="/";
while (<>) {

 # Remove polish diacritics and strange stuff ***
 # polish customization added by TP ***
 s/\~/ /g;        s/\|/ /g;       s/\\//g;    #s/\{\}//g; 
 s/\\Stress//g;   s/\\stress//g;  s/\\noindent//g; 
 s/\\tt|\\it|\\bf|\\rm//g;

 s/±/a/g;   s/æ/c/g;   s/ê/e/g;   s/³/l/g;   s/ñ/n/g; 
 s/ó/o/g;   s/¶/s/g;   s/¼/z/g;   s/¿/z/g; 

 s/A/A/g;   s/Æ/C/g;   s/Ê/E/g;   s/£/L/g;   s/Ñ/N/g; s/Ó/O/g;
 s/¦/S/g;   s/¬/Z/g;   s/¯/Z/g; 
 # end of diacritics and strange stuff ---

 ($id,$title) = /\{(.*)\}\{(.*)\}/;
 $titles{$id}=$title;
  
 $_ = $id; # Added by --tp--
 $level = tr/\./\./;

 $curids[$level]=$id;
 $thisone=$curids[$level-1];
 $realcounts{$thisone}++;
 push(@ids,$id);
}
foreach $x (@ids)
{
 $count=$realcounts{$x};
 print "\\pdfoutline ";
 print "goto name {$x}";
 if ($count > 0) { print " count -$count "; }
 print "{$titles{$x}}\n";
}
;
