[l2h] Avoiding title collisions when using $LONG_TITLES
Julius Smith
l2h@w3k.org
Mon, 05 Aug 2002 12:48:52 -0700
If you set $LONG_TITLES in your ~/.latex2html-init file, you may have
encountered the awful problem of file-name collisions. For example, if two
chapters of a document contain sections entitled "Introduction", only the
last one will "exist", and navigation to "Introduction" in the first
chapter will proceed to that section of the later chapter. This is of
course extremely confusing to the reader.
Below is a simple method of avoiding this problem by overriding the
&make_name() subroutine in your init file. This is also where you can
remove the 32-character file-name length limit to provide nicer looking
generated section URLs (when they are not intended to be typed manually or
accessed in ancient browsers).
In ~/.latex2html-init :
my %title_seen = ();
sub make_name {
...
if ($title) {
#ensure no more than 32 characters, including .html extension
#jos $title =~ s/^(.{1,27}).*$/$1/;
while ($title_seen{$title}) {
$title .= '_I';
}
$title_seen{$title}++;
++$OUT_NODE;
join("", ${PREFIX}, $title, $EXTN);
} else {
# Remove 0's from the end of $packed_curr_sec_id
...
}