[Scummvm-cvs-logs] CVS: scummvm/tools credits.pl,1.11,1.12 module.mk,1.1,1.2

Max Horn fingolfin at users.sourceforge.net
Sun Mar 27 10:48:09 CEST 2005


Update of /cvsroot/scummvm/scummvm/tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29894

Modified Files:
	credits.pl module.mk 
Log Message:
Add support for the .tex credits

Index: credits.pl
===================================================================
RCS file: /cvsroot/scummvm/scummvm/tools/credits.pl,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- credits.pl	27 Mar 2005 18:14:37 -0000	1.11
+++ credits.pl	27 Mar 2005 18:35:51 -0000	1.12
@@ -32,7 +32,7 @@
 	$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 @@
 	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 @@
 		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 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 @@
 		print "  </tgroup>\n";
 		print "  </informaltable>\n";
 		print "</appendix>\n";
-	} else {
+	} elsif ($mode eq "HTML") {
 		print "</table>\n";
 	}
 }
@@ -144,6 +166,9 @@
 	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 @@
 		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 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 @@
 		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 @@
 		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 @@
 		$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 @@
 	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 @@
 	} 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";

Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/tools/module.mk,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- module.mk	11 Jan 2005 22:02:05 -0000	1.1
+++ module.mk	27 Mar 2005 18:35:52 -0000	1.2
@@ -42,6 +42,7 @@
 	$(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





More information about the Scummvm-git-logs mailing list