#! /usr/local/bin/perl -w # # anchor-lcase - convert all "name=" anchors into small letters. # also replace `_' with `-'. # # Copyright (C) 1999 Satoru Takabayashi # All rights reserved. # This is free software with ABSOLUTELY NO WARRANTY. # # You can redistribute it and/or modify it under the terms of # the GNU General Public License version 2. # use strict; my $content = join '', <>; $content =~ s/name="(.*?)"/"name=\"" . xx($1) . "\""/ge; $content =~ s/href="#(.*?)"/"href=\"#" . xx($1) . "\""/ge; print $content; sub xx { my ($tmp) = @_; $tmp =~ s/_/-/g; return lc($tmp); }