ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cfmaps/cfarch2html
(Generate patch)

Comparing cfmaps/cfarch2html (file contents):
Revision 1.14 by root, Wed Feb 14 02:33:46 2007 UTC vs.
Revision 1.18 by root, Sun Oct 14 01:24:15 2007 UTC

15# 15#
16# You should have received a copy of the GNU General Public License 16# You should have received a copy of the GNU General Public License
17# along with gvpe; if not, write to the Free Software 17# along with gvpe; if not, write to the Free Software
18# Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18# Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 19
20our $VERSION = '1.052'; 20our $VERSION = '2.001';
21 21
22use Crossfire 1.0;
22use Storable; 23use Storable;
23
24my $LIBDIR = $ENV{CROSSFIRE_LIBDIR}
25 or die "\$CROSSFIRE_LIBDIR must be set\n";
26
27my $arch;
28 24
29sub escape_html($) { 25sub escape_html($) {
30 local $_ = shift; 26 local $_ = shift;
31 s/([<>&])/sprintf "&#%d;", ord $1/ge; 27 s/([<>&])/sprintf "&#%d;", ord $1/ge;
32 $_ 28 $_
33} 29}
34
35$arch = Storable::retrieve "$LIBDIR/archetypes.pst";
36 30
37system "rm", -rf => "a"; 31system "rm", -rf => "a";
38mkdir "a", 0777; 32mkdir "a", 0777;
39 33
40sub print_arch { 34sub print_arch {
41 my ($a) = @_; 35 my ($a) = @_;
42 print "<ul>"; 36 print "<ul>";
43 for (sort keys %$a) { 37 for (sort keys %$a) {
44 next if $_ eq "_name"; 38 next if $_ eq "_name";
39 next if $_ eq "_atype";
45 my $v = escape_html $a->{$_}; 40 my $v = escape_html $a->{$_};
46 41
47 print "<li>"; 42 print "<li>";
48 if ($_ eq "more") { 43 if ($_ eq "more") {
49 print "more =>\n"; 44 print "more =>\n";
50 print_arch ($a->{more}); 45 print_arch ($a->{more});
51 } elsif ($_ eq "other_arch") { 46 } elsif ($_ eq "other_arch") {
52 print "$_ => <a href='#$a->{$_}'>$v</a>\n"; 47 print "$_ => <a href='$a->{$_}'>$v</a>\n";
53 } elsif ($_ eq "msg" || $_ eq "lore") { 48 } elsif ($_ eq "msg" || $_ eq "lore") {
54 print "$_ =><p class='m'>$v</p>"; 49 print "$_ =><p class='m'>$v</p>";
55 } else { 50 } else {
56 print "$_ => $v\n"; 51 print "$_ => $v\n";
57 } 52 }
58 print "</li>"; 53 print "</li>";
59 } 54 }
60 print "</ul>"; 55 print "</ul>";
61} 56}
62 57
58Crossfire::load_archetypes;
59
63for my $name (sort keys %$arch) { 60for my $name (sort keys %ARCH) {
64 open my $fh, ">:utf8", "a/$name.xhtml" 61 open my $fh, ">:utf8", "a/$name.xhtml"
65 or die "a/$name.xhtml: $!"; 62 or die "a/$name.xhtml: $!";
66 63
67 select $fh; 64 select $fh;
68 65
69 print "<?xml version='1.0' encoding='utf-8'?>", 66 print "<?xml version='1.0' encoding='utf-8'?>",
70 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">', 67 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
71 "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>", 68 "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>",
72 "<head>", 69 "<head>",
73 "<title>Crossfire Archetype '$name'</title>", 70 "<title>Deliantra Archetype '$name'</title>",
74 "<link rel='stylesheet' type='text/css' media='all' href='/common.css'/>", 71 "<link rel='stylesheet' type='text/css' media='all' href='/common.css'/>",
75 "</head>", 72 "</head>",
76 "<body>", 73 "<body>",
77 "<h1>Crossfire Archetype '$name'</h1>"; 74 "<h1>Deliantra Archetype '$name'</h1>";
78 75
79 print_arch $arch->{$name}; 76 print_arch $ARCH{$name};
80 77
81 print "<p class='footer'>created by <a href='http://software.schmorp.de/pkg/cfmaps'>cfarch2html</a> version $VERSION</p>", 78 print "<p class='footer'>created by <a href='http://software.schmorp.de/pkg/cfmaps'>cfarch2html</a> version $VERSION</p>",
82 "</body></html>"; 79 "</body></html>";
83 80
84 close $fh; 81 close $fh;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines