#!/usr/bin/perl -W use strict; #Gaim Theme Viewer - builds a HTML page to see the smileys from a Gaim theme #(C) 2003 John B. Silvestri - silvestrij@users.sourceforge.net #Created 18 January 2003 #Last modified 26 January 2003 # #Run this program from the folder containing the smileys #e.g. from ~/.gaim/smileys/exhaustive # #Licensed under the GNU GPL (http://www.gnu.org/licenses/gpl.txt) #This program 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. open(THEME,"theme") or die "No 'theme' file found, perhaps you are not in the desired theme's folder?\n"; open(OUT,">","index.html") or die "Cannot create index.html file: $!"; my ($name,$auth,$desc,$icon); for (my $i=0;$i<4;$i++){ my @keyval=split( /\=/, <THEME>); my $key=$keyval[0]; my $val=$keyval[1]; chomp $val; if ($key=~/Name/){$name=$val;} elsif ($key=~/Author/){$auth=$val;} elsif ($key=~/Description/){$desc=$val;} elsif ($key=~/Icon/){$icon=$val;} #For now, do nothing - wait for table version } print OUT "<html><head><title>Gaim Theme Viewer - $name</title></head><body>\n"; print OUT "<h1><img src=\"$icon\"> $name</h1>\n"; print OUT "<h2>$desc</h2>\n"; print OUT "<h2>by $auth</h2>\n"; LINEREAD: while(<THEME>){ next LINEREAD if /^#/; next LINEREAD if /^\s*$/; if (/^\[(.*)\]\n$/){ print OUT "<h3>$1</h3>\n"; }else{ my @parts=split(/\s+/); my $img=shift @parts; if ($img eq "!"){ $img=shift @parts;} print OUT "<img src=\"${img}\" /> "; print OUT join " ", @parts; print OUT "<br />\n"; } }#end LINEREAD print OUT "</body></html>\n";