diff options
Diffstat (limited to 'devtools/credits.pl')
-rwxr-xr-x | devtools/credits.pl | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/devtools/credits.pl b/devtools/credits.pl index 59ebb51a07..b1c084515e 100755 --- a/devtools/credits.pl +++ b/devtools/credits.pl @@ -36,11 +36,12 @@ if ($#ARGV >= 0) { $mode = "CPP" if ($ARGV[0] eq "--cpp"); # credits.h (for use by about.cpp) $mode = "XML-DOC" if ($ARGV[0] eq "--xml-docbook"); # credits.xml (DocBook) $mode = "RTF" if ($ARGV[0] eq "--rtf"); # Credits.rtf (Mac OS X About box) + $mode = "STRONGHELP" if ($ARGV[0] eq "--stronghelp"); # AUTHORS (RISC OS StrongHelp manual) } if ($mode eq "") { - print STDERR "Usage: $0 [--text | --xml-website | --cpp | --xml-docbook | --rtf]\n"; - print STDERR " Just pass --text / --xml-website / --cpp / --xml-docbook / --rtf as parameter, and credits.pl\n"; + print STDERR "Usage: $0 [--text | --xml-website | --cpp | --xml-docbook | --rtf | --stronghelp]\n"; + print STDERR " Just pass --text / --xml-website / --cpp / --xml-docbook / --rtf / --stronghelp as parameter, and credits.pl\n"; print STDERR " will print out the corresponding version of the credits to stdout.\n"; exit 1; } @@ -106,6 +107,36 @@ sub html_entities_to_ascii { return $text; } +# Convert HTML entities to ISO/IEC 8859-1 for the StrongHelp manual +sub html_entities_to_iso8859_1 { + my $text = shift; + + $text =~ s/á/\xE1/g; + $text =~ s/é/\xE9/g; + $text =~ s/í/\xED/g; + $text =~ s/ì/\xEC/g; + $text =~ s/ó/\xF3/g; + $text =~ s/ø/\xF8/g; + $text =~ s/ú/\xFA/g; + $text =~ s/ą/a/g; + $text =~ s/Ł/L/g; + $text =~ s/ł/l/g; + $text =~ s/ś/s/g; + $text =~ s/Ľ/L/g; + $text =~ s/Š/S/g; + $text =~ s/å/\xE5/g; + $text =~ s/ñ/\xF1/g; + + $text =~ s/ä/\xE4/g; + $text =~ s/ë/\xEB/g; + $text =~ s/ü/\xFC/g; + $text =~ s/ö/\xF6/g; + + $text =~ s/&/&/g; + + return $text; +} + # Convert HTML entities to C++ characters sub html_entities_to_cpp { my $text = shift; @@ -219,6 +250,9 @@ sub begin_credits { print "<?xml version='1.0'?>\n"; print "<!-- This file was generated by credits.pl. Do not edit by hand! -->\n"; print "<credits>\n"; + } elsif ($mode eq "STRONGHELP") { + print "ScummVM - AUTHORS\n"; + print "# This file was generated by credits.pl. Do not edit by hand!\n"; } } @@ -314,6 +348,9 @@ sub begin_section { #print "\t\t\t<group>" . $title . "</group>\n"; #print "\t\t\t\t<name>" . $title . "</name>\n"; } + } elsif ($mode eq "STRONGHELP") { + $title = html_entities_to_iso8859_1($title); + print "#fH" . ($section_level + 1) . ":" . $title."\n"; } # Implicit start of person list on section level 2 @@ -369,6 +406,8 @@ sub end_persons { } elsif ($mode eq "XML-WEB") { #print "\t\t\t\t</persons>\n"; print "\t\t\t</group>\n"; + } elsif ($mode eq "STRONGHELP") { + print "\n"; } } @@ -443,6 +482,15 @@ sub add_person { print "\t\t\t\t\t<alias>" . $nick . "</alias>\n"; print "\t\t\t\t\t<description>" . $desc . "</description>\n"; print "\t\t\t\t</person>\n"; + } elsif ($mode eq "STRONGHELP") { + my $min_name_width = length $desc > 0 ? $max_name_width : 0; + $name = $nick if $name eq ""; + $name = html_entities_to_iso8859_1($name); + $desc = html_entities_to_iso8859_1($desc); + + $tab = " " x ($section_level * 2 + 1); + print $tab . "{*}" . $name . "{*}"; + print "\t" . $desc . "\n"; } } @@ -471,6 +519,12 @@ sub add_paragraph { print " <row><entry namest='start' nameend='job'> </entry></row>\n\n"; } elsif ($mode eq "XML-WEB") { print "\t\t<paragraph>" . $text . "</paragraph>\n"; + } elsif ($mode eq "STRONGHELP") { + $text = html_entities_to_iso8859_1($text); + print "#Wrap On\n"; + $tab = " " x ($section_level * 2 + 1); + print $text . "\n"; + print "#Wrap\n\n"; } } |