#!usr/bin/perl
my $initdir="l:/tsddir"; #absolutni cesta !!UPRAVIT!! ja to mam namontovane
my $kolik=83; #pocet clanku+1


chdir($initdir);
open  HTML,">absnew.html";

#hlavicka HTML
print HTML "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"> \n";
print HTML "<html>\n <head> \n	<title>Papers Accepted for Oral Presentation</title>\n </head>\n";
print HTML "<link rel=\"STYLESHEET\" type=\"text/css\" href=\"main.css\">\n";
print HTML "<body BGCOLOR=\"#dfd0d0\">\n";
print HTML "<center>\n<H1>Accepted Papers</H1>\n</center>\n";
print HTML "<img src=\"gif/micro.gif\" align=\"left\"><hr><br clear=\"all\">\n\n";

for ($i=1;$i<$kolik;$i++) #soubory dost natvrdo
	{
 		chdir($initdir);
		print "\n";
		print $i,"      ";
		my $fname;
		chdir($i) or next;
		$fname=$i.".tex";
		
		open (TEX,$fname) or next;
		print $fname;
		my $vstup="";
		while ($radek=<TEX>) {
		 chomp($radek);
		 if ($radek!~m/^%.*/) {  #komentare neberem
		 $vstup=$vstup." ".$radek; }
		 
		 }
	    close (TEX); 
		
		#odtexovani
		$vstup=~s/~/\&nbsp;/g; #mezery
		$vstup=~s/\\-//g; #deleni slov
		$vstup=~s/\\ldots/.../g; #ldots
		$vstup=~s/``/"/g; #uvozovky
		$vstup=~s/''/"/g; #uvozovky
		$vstup=~s/\\%/%/g; #procenta
		$vstup=~s/\\Dash/\&nbsp;-\&nbsp;/g; #pomlcka
		$vstup=~s/\\,/\&nbsp;/g; #mezirka
		
		$vstup=~s/{\\it(.*?)}/<i>$1<\/i>/g; #pokus o italiku (nemusi sedet zavorky)
		$vstup=~s/\\textsc{(.*?)}/ <i>$1<\/i> /g; #z toho je italika
		$vstup=~s/\\footnote{(.*?)}/ <i>($1)<\/i> /g; #poznamky pod carou jako itatika v zavorce
		$vstup=~s/\\emph{(.*?)}/ <b>$1<\/b> /g; #z toho je bold (HTML <em> je hnusny)
		
		
		$vstup=~s/{([\\'`a-zA-Z0-9,\.\/"]{0,5})}/-_$1_-/g; #zavorky kolem nula az peti znaku
									#kvuli diakritice
									
		
		
			
		
		
		$vstup=~m/\\titlerunning\s?{(.*?)}/; 
		print HTML $i,"\n";
		my $tmp=$1;
		$tmp=~s/-_/{/g; #zavorky vratime
		$tmp=~s/_-/}/g; #zavorky vratime
		print HTML "<h3>",$tmp,"</h3>\n";
		
		$vstup=~m/\\tocauthor\s?{(.*?)}/; 
		$tmp=$1;
		$tmp=~s/-_/{/g; #zavorky vratime
		$tmp=~s/_-/}/g; #zavorky vratime
		print HTML "<h5>",$tmp,"</h5>\n";
		
		
		$vstup=~m/\\begin\s?{abstract}(.*)\\end\s?{abstract}/;
		$tmp=$1;
		$tmp=~s/-_/{/g; #zavorky vratime
		$tmp=~s/_-/}/g; #zavorky vratime
		print HTML "<p class=\"abstr\">",$tmp,"<\/p>\n<hr>\n";
		
		
		
		
	}	

	
print HTML "</body>\n</html>\n";	
close HTML;
