Ticket #8956: credits.pl.patch
File credits.pl.patch, 6.6 KB (added by , 16 years ago) |
---|
-
credits.pl
old new 6 6 # - The AUTHORS file 7 7 # - The gui/credits.h header file 8 8 # - The credits.xml file, part of the DocBook manual 9 # - Finally, credits. inc, from the website9 # - Finally, credits.xml, for use on the website (different format than the DocBook one) 10 10 # And maybe in the future, also "doc/10.tex", the LaTeX version of the README. 11 11 # Although that might soon be obsolete, if the manual evolves enough. 12 12 # … … 33 33 34 34 if ($#ARGV >= 0) { 35 35 $mode = "TEXT" if ($ARGV[0] eq "--text"); # AUTHORS file 36 $mode = " HTML" if ($ARGV[0] eq "--html"); # credits.inc(for use on the website)36 $mode = "XML-WEB" if ($ARGV[0] eq "--xml-website"); # credits.xml (for use on the website) 37 37 $mode = "CPP" if ($ARGV[0] eq "--cpp"); # credits.h (for use by about.cpp) 38 $mode = "XML " if ($ARGV[0] eq "--xml"); # credits.xml (DocBook)38 $mode = "XML-DOC" if ($ARGV[0] eq "--xml-docbook"); # credits.xml (DocBook) 39 39 $mode = "RTF" if ($ARGV[0] eq "--rtf"); # Credits.rtf (Mac OS X About box) 40 40 $mode = "TEX" if ($ARGV[0] eq "--tex"); # 10.tex (LaTeX) 41 41 } 42 42 43 43 if ($mode eq "") { 44 print STDERR "Usage: $0 [--text | -- html | --cpp | --xml| --rtf]\n";45 print STDERR " Just pass --text / -- html / --cpp / --xml/ --rtf as parameter, and credits.pl\n";44 print STDERR "Usage: $0 [--text | --xml-website | --cpp | --xml-docbook | --rtf]\n"; 45 print STDERR " Just pass --text / --xml-website / --cpp / --xml-docbook / --rtf as parameter, and credits.pl\n"; 46 46 print STDERR " will print out the corresponding version of the credits to stdout.\n"; 47 47 exit 1; 48 48 } … … 178 178 } elsif ($mode eq "CPP") { 179 179 print "// This file was generated by credits.pl. Do not edit by hand!\n"; 180 180 print "static const char *credits[] = {\n"; 181 } elsif ($mode eq "XML ") {181 } elsif ($mode eq "XML-DOC") { 182 182 print "<?xml version='1.0'?>\n"; 183 183 print "<!-- This file was generated by credits.pl. Do not edit by hand! -->\n"; 184 184 print "<!DOCTYPE appendix PUBLIC '-//OASIS//DTD DocBook XML V4.2//EN'\n"; … … 191 191 print " <colspec colname='name' colwidth='4cm'/>\n"; 192 192 print " <colspec colname='job'/>\n"; 193 193 print " <tbody>\n"; 194 } elsif ($mode eq "HTML") { 194 } elsif ($mode eq "XML-WEB") { 195 print "<?xml version='1.0'?>\n"; 195 196 print "<!-- This file was generated by credits.pl. Do not edit by hand! -->\n"; 197 print "<credits>\n"; 196 198 } 197 199 } 198 200 … … 205 207 print "}\n"; 206 208 } elsif ($mode eq "CPP") { 207 209 print "};\n"; 208 } elsif ($mode eq "XML ") {210 } elsif ($mode eq "XML-DOC") { 209 211 print " </tbody>\n"; 210 212 print " </tgroup>\n"; 211 213 print " </informaltable>\n"; 212 214 print "</appendix>\n"; 213 } elsif ($mode eq " HTML") {214 print " \n";215 } elsif ($mode eq "XML-WEB") { 216 print "</credits>\n"; 215 217 } 216 218 } 217 219 … … 270 272 $title = html_entities_to_cpp($title); 271 273 print '"C1""'.$title.'",' . "\n"; 272 274 } 273 } elsif ($mode eq "XML ") {275 } elsif ($mode eq "XML-DOC") { 274 276 print " <row><entry namest='start' nameend='job'>"; 275 277 print "<emphasis role='bold'>" . $title . ":</emphasis>"; 276 278 print "</entry></row>\n"; 277 } elsif ($mode eq " HTML") {279 } elsif ($mode eq "XML-WEB") { 278 280 if ($section_level eq 0) { 279 print "<div class='par-item'><div class='par-head'>$title</div><div class='par-content'> \n"; 281 print "\t<section>\n"; 282 print "\t\t<title>" . $title . "</title>\n"; 280 283 } elsif ($section_level eq 1) { 281 print "<div class='par-subhead'>$title</div>\n"; 282 print "<div class='par-subhead-dots'> </div>\n"; 283 print "<div class='par-subhead-content'>\n" 284 print "\t\t<subsection>\n"; 285 print "\t\t\t<title>" . $title . "</title>\n"; 284 286 } else { 285 print "<span style='font-weight: bold'>$title:</span>\n"; 287 #print "\t\t\t<group>" . $title . "</group>\n"; 288 #print "\t\t\t\t<name>" . $title . "</name>\n"; 286 289 } 287 290 } 288 291 289 292 # Implicit start of person list on section level 2 290 293 if ($section_level >= 2) { 291 begin_persons( );294 begin_persons($title); 292 295 } 293 296 @section_count[$section_level]++; 294 297 $section_level++; … … 311 314 # nothing 312 315 } elsif ($mode eq "CPP") { 313 316 print '"",' . "\n"; 314 } elsif ($mode eq "XML ") {317 } elsif ($mode eq "XML-DOC") { 315 318 print " <row><entry namest='start' nameend='job'> </entry></row>\n\n"; 316 } elsif ($mode eq " HTML") {319 } elsif ($mode eq "XML-WEB") { 317 320 if ($section_level eq 0) { 318 print " </div></div>\n";321 print "\t</section>\n"; 319 322 } elsif ($section_level eq 1) { 320 print "</div>\n"; 323 print "\t\t</subsection>\n"; 324 } else { 325 #print "\t\t\t</group>\n"; 321 326 } 322 327 } 323 328 } 324 329 325 330 sub begin_persons { 326 if ($mode eq "HTML") { 327 print "<table style='margin-left:2em; margin-bottom: 1em'>\n"; 331 my $title = shift; 332 if ($mode eq "XML-WEB") { 333 print "\t\t\t<group>\n"; 334 print "\t\t\t\t<name>" . $title . "</name>\n"; 335 #print "\t\t\t\t<persons>\n"; 328 336 } elsif ($mode eq "TEX") { 329 337 print '\item \begin{tabular}[h]{p{0.3\linewidth}p{0.6\linewidth}}' . "\n"; 330 338 } … … 337 345 print ' \end{tabular}' . "\n"; 338 346 } elsif ($mode eq "RTF") { 339 347 # nothing 340 } elsif ($mode eq "HTML") { 341 print "</table>\n"; 348 } elsif ($mode eq "XML-WEB") { 349 #print "\t\t\t\t</persons>\n"; 350 print "\t\t\t</group>\n"; 342 351 } 343 352 } 344 353 … … 396 405 $desc = html_entities_to_cpp($desc); 397 406 print '"C2""'.$desc.'",' . "\n"; 398 407 } 399 } elsif ($mode eq "XML ") {408 } elsif ($mode eq "XML-DOC") { 400 409 $name = $nick if $name eq ""; 401 410 print " <row><entry namest='name'>" . $name . "</entry>"; 402 411 print "<entry>" . $desc . "</entry></row>\n"; 403 } elsif ($mode eq " HTML") {412 } elsif ($mode eq "XML-WEB") { 404 413 $name = "???" if $name eq ""; 405 print "<tr>"; 406 print "<td style='width:13em; padding:2px;'>".$name."</td>"; 407 if ($nick ne "") { 408 print "<td style='width:10em; text-align: left;' class='news-author'>".$nick."</td>"; 409 } else { 410 print "<td></td>"; 411 } 412 print "<td>".$desc."</td>\n"; 414 print "\t\t\t\t<person>\n"; 415 print "\t\t\t\t\t<name>" . $name . "</name>\n"; 416 print "\t\t\t\t\t<alias>" . $nick . "</alias>\n"; 417 print "\t\t\t\t\t<description>" . $desc . "</description>\n"; 418 print "\t\t\t\t</person>\n"; 413 419 } 414 415 416 420 } 417 421 418 422 sub add_paragraph { … … 437 441 my $line_end = '",'; 438 442 print $line_start . $text . $line_end . "\n"; 439 443 print $line_start . $line_end . "\n"; 440 } elsif ($mode eq "XML ") {444 } elsif ($mode eq "XML-DOC") { 441 445 print " <row><entry namest='start' nameend='job'>" . $text . "</entry></row>\n"; 442 446 print " <row><entry namest='start' nameend='job'> </entry></row>\n\n"; 443 } elsif ($mode eq "HTML") { 444 print "<p style='margin-left:2em; margin-bottom: 1em'>"; 445 print $text; 446 print "</p>\n"; 447 } elsif ($mode eq "XML-WEB") { 448 print "\t\t<paragraph>" . $text . "</paragraph>\n"; 447 449 } 448 450 } 449 451