mkdos, a script to create DOS versions...

...of all the text files distributed with the game: the various
translations of the MANUAL, the changelog, the license information in
COPYING, the instructions in INSTALL, and the README.  Changes
sequences of lines to DOS-style single paragraphs, and attempts to
preserve displayed text and tables.  The resulting files should be
ready to be shipped with the Windows package, and for most people
these files will be shown in NotePad when double-clicked.
This commit is contained in:
András Salamon 2005-10-23 17:15:45 +00:00
parent d3f71fa607
commit d53c05e3a2

58
utils/mkdos Executable file
View file

@ -0,0 +1,58 @@
#!/usr/bin/perl
# mkdos
# make DOS-style versions of text files shipped with release
# the list below needs to be updated when new text files are added!
# this is a helper script for the Battle for Wesnoth project
# see http://www.wesnoth.org/
# this script is distributed on the same terms as Battle for Wesnoth itself
# format of each line: original-name dosified-name
%files = qw(
COPYING COPYING.txt
INSTALL INSTALL.txt
MANUAL MANUAL.txt
MANUAL.brazilian MANUAL-pt_BR.txt
MANUAL.catalan MANUAL-ca.txt
MANUAL.czech MANUAL-cs.txt
MANUAL.danish MANUAL-da.txt
MANUAL.french MANUAL-fr.txt
MANUAL.german MANUAL-de.txt
MANUAL.hungarian MANUAL-hu.txt
MANUAL.italian MANUAL-it.txt
MANUAL.norwegian MANUAL-no.txt
MANUAL.polish MANUAL-pl.txt
MANUAL.russian MANUAL-ru.txt
MANUAL.spanish MANUAL-es.txt
MANUAL.swedish MANUAL-sv.txt
MANUAL.turkish MANUAL-tr.txt
README README.txt
changelog changelog.txt
);
READFILE:
foreach $f ( keys %files ) {
unless (open(IN, "$f")) {
warn "cannot read $f, skipping";
next READFILE
}
unless (open(OUT, ">".$files{$f})) {
warn "cannot create $files{$f}, skipping";
next READFILE
}
while (<IN>) {
if (/ / or /^[- |]/) {
s/\n$/\r\n/;
} elsif (/^$/) {
s/^\n$/\r\n\r\n/;
} else {
s/\n$/ /;
}
#s/^\s*$//;
#s/^$/\r\n\r\n/;
print OUT;
}
close IN;
close OUT;
}