make_str_index_entry(): New function. Similar to make_index_entry(), but

includes the string in the returned value instead of the dummy
	filler character.

add_idx():  Override the latex2html function of the same name; this gets
	the anchor properly embedded in the <dt> element, so the index
	works in Grail too.
This commit is contained in:
Fred Drake 1997-12-03 19:44:27 +00:00
parent ab76af3d65
commit f2d7e5528d

View File

@ -95,4 +95,105 @@ sub process_command {
$ref_contents;
}
sub top_navigation_panel {
# Now add a few buttons with a space between them
"<DIV CLASS=navigation>\n" .
"$NEXT $UP $PREVIOUS $CONTENTS $INDEX $CUSTOM_BUTTONS" .
"<BR>\n" . # Line break
# If ``next'' section exists, add its title to the navigation panel
($NEXT_TITLE ? "<B> Next:</B> $NEXT_TITLE\n" : undef) .
# Similarly with the ``up'' title ...
($UP_TITLE ? "<B>Up:</B> $UP_TITLE\n" : undef) .
# ... and the ``previous'' title
($PREVIOUS_TITLE ? "<B> Previous:</B> $PREVIOUS_TITLE\n" : undef) .
# Line Break, horizontal rule (3-d dividing line) and new paragraph
"<BR><HR><P></DIV>\n"
}
sub bot_navigation_panel {
# Start with a horizontal rule (3-d dividing line)
"\n<DIV CLASS=navigation><HR>".
# Now add a few buttons with a space between them
"$NEXT $UP $PREVIOUS $CONTENTS $INDEX $CUSTOM_BUTTONS" .
"<BR>\n" . # Line break
# If ``next'' section exists, add its title to the navigation panel
($NEXT_TITLE ? "<B> Next:</B> $NEXT_TITLE\n" : undef) .
# Similarly with the ``up'' title ...
($UP_TITLE ? "<B>Up:</B> $UP_TITLE\n" : undef) .
# ... and the ``previous'' title
($PREVIOUS_TITLE ? "<B> Previous:</B> $PREVIOUS_TITLE\n" : undef) .
"</DIV>\n"
}
# similar to make_index_entry(), but includes the string in the result
# instead of the dummy filler.
#
sub make_str_index_entry {
local($br_id,$str) = @_;
# If TITLE is not yet available (i.e the \index command is in the title
# of the current section), use $ref_before.
$TITLE = $ref_before unless $TITLE;
# Save the reference
local($nstr) = "$str###" . ++$global{'max_id'}; # Make unique
$index{$nstr} .= &make_half_href("$CURRENT_FILE#$br_id");
"<a name=\"$br_id\">$str<\/a>";
}
sub add_idx {
print "\nDoing the index ...";
local($key, $str, @keys, $index, $level, $count,
@previous, @current);
@keys = keys %index;
@keys = sort keysort @keys;
$level = 0;
foreach $key (@keys) {
@current = split(/!/, $key);
$count = 0;
while ($current[$count] eq $previous[$count]) {
$count++;
}
while ($count > $level) {
$index .= "<dl compact>\n";
$level++;
}
while ($count < $level) {
$index .= "</dl>\n";
$level--;
}
foreach $term (@current[$count .. $#current-1]) {
# need to "step in" a little
$index .= "<dt>" . $term . "\n<dl compact>\n";
$level++;
}
$str = $current[$#current];
$str =~ s/\#\#\#\d+$//o; # Remove the unique id's
$index .= #$index{$key} .
# If it's the same string don't start a new line
(&index_key_eq(join('',@current), join('',@previous)) ?
", $index{$key}<strong>" . $cross_ref_visible_mark . "</strong></a>\n" :
"<dt>$index{$key}<strong>" . $str . "</strong></a>\n");
@previous = @current;
}
while ($count < $level) {
$index .= "</dl>\n";
$level--;
}
s/$idx_mark/<dl compact>$index<\/dl>/o;
}
1; # This must be the last line