diff options
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/credits.pl | 54 | ||||
| -rw-r--r-- | tools/module.mk | 1 | 
2 files changed, 45 insertions, 10 deletions
diff --git a/tools/credits.pl b/tools/credits.pl index 0646c8ab98..1eec5383b3 100755 --- a/tools/credits.pl +++ b/tools/credits.pl @@ -32,7 +32,7 @@ if ($#ARGV >= 0) {  	$mode = "CPP" if ($ARGV[0] eq "--cpp");		# credits.h (for use by about.cpp)  	$mode = "XML" if ($ARGV[0] eq "--xml");		# credits.xml (DocBook)  	$mode = "RTF" if ($ARGV[0] eq "--rtf");		# Credits.rtf (Mac OS X About box) -	#$mode = "TEX" if ($ARGV[0] eq "--tex");		# 10.tex (LaTeX) +	$mode = "TEX" if ($ARGV[0] eq "--tex");		# 10.tex (LaTeX)  }  if ($mode eq "") { @@ -92,11 +92,30 @@ sub html_entities_to_rtf {  	return $text;  } +# Convert HTML entities to TeX codes +sub html_entities_to_tex { +	my $text = shift; +	 +	$text =~ s/á/\\'a/g; +	$text =~ s/é/\\'e/g; +	$text =~ s/ø/{\\o}/g; +	$text =~ s/ł/l/g;		# TODO +	$text =~ s/ö/\\"o/g; + +	$text =~ s/&/\\&/g; +	 +	return $text; +} +  sub begin_credits {  	my $title = shift;  	if ($mode eq "TEXT") {  		#print html_entities_to_ascii($title)."\n"; +	} elsif ($mode eq "TEX") { +		print "% This file was generated by credits.pl. Do not edit by hand!\n"; +		print '\section{Credits}' . "\n"; +		print '\begin{itemize}' . "\n";  	} elsif ($mode eq "RTF") {  		print '{\rtf1\mac\ansicpg10000' . "\n";  		print '{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;}' . "\n"; @@ -116,7 +135,7 @@ sub begin_credits {  		print "  <colspec colname='name' colwidth='4cm'/>\n";  		print "  <colspec colname='job'/>\n";  		print "  <tbody>\n"; -	} else { +	} elsif ($mode eq "HTML") {  		print "<!-- This file was generated by credits.pl. Do not edit by hand! -->\n";  		print "<h1>$title</h1>\n";  		print "<table border='0' cellpadding='5' cellspacing='0' style='margin-left: 3em;'>\n"; @@ -125,6 +144,9 @@ sub begin_credits {  sub end_credits {  	if ($mode eq "TEXT") { +	} elsif ($mode eq "TEX") { +		print '\end{itemize}' . "\n"; +		print "\n";  	} elsif ($mode eq "RTF") {  		print "}\n";  	} elsif ($mode eq "CPP") { @@ -134,7 +156,7 @@ sub end_credits {  		print "  </tgroup>\n";  		print "  </informaltable>\n";  		print "</appendix>\n"; -	} else { +	} elsif ($mode eq "HTML") {  		print "</table>\n";  	}  } @@ -144,6 +166,9 @@ sub begin_section {  	if ($mode eq "TEXT") {  		$title = html_entities_to_ascii($title);  		print $title.":\n"; +	} elsif ($mode eq "TEX") { +		print '\item \textbf{' . html_entities_to_tex($title) . "}\\\\\n"; +		print '  \begin{tabular}[h]{p{4cm}l}' . "\n";  	} elsif ($mode eq "RTF") {  		$title = html_entities_to_rtf($title); @@ -158,7 +183,7 @@ sub begin_section {  		print "  <row><entry namest='start' nameend='job'>";  		print "<emphasis role='bold'>" . $title . ":</emphasis>";  		print "</entry></row>\n"; -	} else { +	} elsif ($mode eq "HTML") {  		print "<tr><td colspan=3><h2>$title:</h2></td></tr>\n";  	}  } @@ -166,13 +191,15 @@ sub begin_section {  sub end_section {  	if ($mode eq "TEXT") {  		print "\n"; +	} elsif ($mode eq "TEX") { +		print '  \end{tabular}' . "\n";  	} elsif ($mode eq "RTF") {  		print "\\\n";  	} elsif ($mode eq "CPP") {  		print '"\\\\L\\\\c0""",' . "\n";  	} elsif ($mode eq "XML") {  		print "  <row><entry namest='start' nameend='job'> </entry></row>\n\n"; -	} else { +	} elsif ($mode eq "HTML") {  		print "<tr><td colspan=3> </td></tr>\n";  	}  } @@ -193,6 +220,12 @@ sub add_person {  		my $inner_indent = $indent + $max_name_width + 3;  		my $multitab = " " x $inner_indent;  		print substr(wrap($multitab, $multitab, $desc), $inner_indent)."\n" +	} elsif ($mode eq "TEX") { +		$name = $nick if $name eq ""; +		$name = html_entities_to_tex($name); +		$desc = html_entities_to_tex($desc); + +		print "    $name & $desc\\\\\n";  	} elsif ($mode eq "RTF") {  		$name = $nick if $name eq "";  		$name = html_entities_to_rtf($name); @@ -206,9 +239,6 @@ sub add_person {  		print '\pard\li560\ql\qnatural' . "\n";  		# Italics  		print "\\i " . $desc . "\\i0\\\n"; -#		print $name . "\\\n"; -#		print "\\i\t" . $desc . "\\i0\\\n"; -##		print "\t" . $name . "\t- " . $desc . "\\\n";  	} elsif ($mode eq "CPP") {  		$name = $nick if $name eq "";  		$name = html_entities_to_ascii($name); @@ -227,7 +257,7 @@ sub add_person {  		$name = $nick if $name eq "";  		print "  <row><entry namest='name'>" . $name . "</entry>";  		print "<entry>" . $desc . "</entry></row>\n"; -	} else { +	} elsif ($mode eq "HTML") {  		$name = "???" if $name eq "";  		print "<tr>";  		print "<td>".$name."</td>"; @@ -246,6 +276,10 @@ sub add_paragraph {  	if ($mode eq "TEXT") {  		print wrap($tab, $tab, html_entities_to_ascii($text))."\n";  		print "\n"; +	} elsif ($mode eq "TEX") { +		print "\n"; +		print $text; +		print "\n";  	} elsif ($mode eq "RTF") {  		# Left align text  		print '\pard\ql\qnatural' . "\n"; @@ -261,7 +295,7 @@ sub add_paragraph {  	} elsif ($mode eq "XML") {  		print "  <row><entry namest='start' nameend='job'>" . $text . "</entry></row>\n";  		print "  <row><entry namest='start' nameend='job'> </entry></row>\n\n"; -	} else { +	} elsif ($mode eq "HTML") {  		print '<tr><td colspan="3">';  		print $text;  		print '</td></tr>'."\n"; diff --git a/tools/module.mk b/tools/module.mk index 9c5ddfb9f5..570b421fea 100644 --- a/tools/module.mk +++ b/tools/module.mk @@ -42,6 +42,7 @@ credits:  	$(srcdir)/tools/credits.pl --html > ../web/credits.inc  	$(srcdir)/tools/credits.pl --cpp > gui/credits.h  	$(srcdir)/tools/credits.pl --xml > ../docs/docbook/credits.xml +	$(srcdir)/tools/credits.pl --tex > doc/10.tex  md5scumm: tools/md5table$(EXEEXT)  	tools/md5table$(EXEEXT) --c++ < $(srcdir)/tools/scumm-md5.txt > scumm/scumm-md5.h  | 
