--- cfmaps/cfmap2html 2005/11/18 06:57:35 1.3
+++ cfmaps/cfmap2html 2007/02/14 03:00:33 1.26
@@ -1,5 +1,24 @@
#!/opt/bin/perl
+# cfmap2html - convert crossfire maps to html
+# Copyright (C) 2005,2007 Marc Lehmann
+#
+# CFMAP2HTML is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with cfmaps; if not, write to the Free Software
+# Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+our $VERSION = '1.212';
+
use Storable;
my $LIBDIR = $ENV{CROSSFIRE_LIBDIR}
@@ -9,8 +28,6 @@
my $arch;
-umask 022;
-
sub escape_html($) {
local $_ = shift;
s/([<>&])/sprintf "%d;", ord $1/ge;
@@ -18,131 +35,157 @@
}
for my $path (@ARGV) {
- print "$path\n";
+ (my $base = $path) =~ s/\.map//;
+# print STDERR "$path\n";
- if (!-e "$path.png"
- || !-e "$path.pst"
- || -M "$path.pst" > -M $path
- || -M "$path.png" > -M $path) {
+ if (!-e "$base.png"
+ || !-e "$base.pst"
+ || -M "$base.pst" > -M $path
+ || -M "$base.png" > -M $path) {
# regenerate png and metainfo
system "cfmap2png", $path;
};
- $arch ||= Storable::retrieve "$LIBDIR/archetypes.pst";
- my $meta = Storable::retrieve "$path.pst";
-
- open my $fh, ">:utf8", "$path.html"
- or die "$path.html: $!";
-
- select $fh;
-
- my $W = $meta->{width} * $T;
- my $H = $meta->{height} * $T;
-
- my (@path) = split /\//, $path;
-
- print "",
- "",
- "",
- "$path",
- "",
- "",
- "";
-
- print "