#!/usr/bin/env perl ### NOTE: This script is deprecated. It has moved to ### https://github.com/plume-lib/html-tools # This program takes as arguments a .png file for a "favicon" and a set of # .html files. It makes each HTML file use the given favicon. A favicon # is a favorites icon, which is intended to appear in the address bar of # your browser when you browse to the given page. # # Usage: # html-add-favicon atT.png `find . -iname '*.html'` # # Both the .png and the .html filenames should be relative (not absolute), # as in the given example. # Also see the add-favicon script in plume-lib, which has a similar effect. use strict; use English; $WARNING = 1; use File::Basename; if (scalar(@ARGV) < 2) { die "Not enough arguments"; } my $ico_file = shift(@ARGV); if ($ico_file !~ /\.png$/) { die "Only handles .png icon files"; } my $plbin = dirname(__FILE__); for my $arg (@ARGV) { my $linkdir = dirname($arg); $linkdir =~ s/^\.(\/|$)//; # Replace each directory component with "..". $linkdir =~ s/[^\/]+/../g; if ($linkdir ne "") { $linkdir .= "/"; } my $headtext = ""; # This is ugly, but it handles two capitalizations of "". `$plbin/preplace '(]*>\n)?' '$headtext\n' $arg`; `$plbin/preplace '(]*>\n)?' '$headtext\n' $arg`; }