Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d18722b

Browse files
committed
Do not cache <img> tags for navigation icons as agressively; this fixes
bug #127151.
1 parent 7ee67a1 commit d18722b

1 file changed

Lines changed: 36 additions & 31 deletions

File tree

Doc/perl/l2hinit.perl

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -107,39 +107,39 @@ sub make_nav_sectref {
107107
return '';
108108
}
109109

110-
sub make_my_icon {
111-
my($name, $text) = @_;
110+
@my_icon_tags = ();
111+
$my_icon_tags{'next'} = 'Next Page';
112+
$my_icon_tags{'next_page'} = 'Next Page';
113+
$my_icon_tags{'previous'} = 'Previous Page';
114+
$my_icon_tags{'previous_page'} = 'Previous Page';
115+
$my_icon_tags{'up'} = 'Up One Level';
116+
$my_icon_tags{'contents'} = 'Contents';
117+
$my_icon_tags{'index'} = 'Index';
118+
$my_icon_tags{'modules'} = 'Module Index';
119+
120+
sub get_my_icon {
121+
my $name = @_[0];
122+
my $text = $my_icon_tags{$name};
123+
if ($text eq '') {
124+
$name = 'blank';
125+
}
112126
my $iconserver = ($ICONSERVER eq '.') ? '' : "$ICONSERVER/";
113-
return "<img src=\"$iconserver$name.$IMAGE_TYPE\" border=\"0\""
127+
return "<img src=\"$iconserver$name.$IMAGE_TYPE\"\n border=\"0\""
114128
. " height=\"32\"\n alt=\"$text\" width=\"32\">";
115129
}
116130

117-
$BLANK_ICON = make_my_icon('blank', '');
118-
119-
@my_icons = ();
120-
$my_icons{'next_page_inactive'} = $BLANK_ICON;
121-
$my_icons{'previous_page_inactive'} = $BLANK_ICON;
122-
$my_icons{'up_page_inactive'} = $BLANK_ICON;
123-
$x = make_my_icon('next', 'Next Page');
124-
$my_icons{'next_page'} = $x;
125-
$my_icons{'next'} = $x;
126-
$x = make_my_icon('previous', 'Previous Page');
127-
$my_icons{'previous_page'} = $x;
128-
$my_icons{'previous'} = $x;
129-
$my_icons{'up'} = make_my_icon('up', 'Up One Level');
130-
$my_icons{'contents'} = make_my_icon('contents', 'Contents');
131-
$my_icons{'index'} = make_my_icon('index', 'Index');
132-
$my_icons{'modules'} = make_my_icon('modules', 'Module Index');
133-
134-
135131
sub use_my_icon {
136132
my $s = @_[0];
137-
$s =~ s/\<tex2html_([a-z_]+)_visible_mark\>/$my_icons{$1}/;
133+
if ($s =~ /\<tex2html_([a-z_]+)_visible_mark\>/) {
134+
my $r = get_my_icon($1);
135+
$s =~ s/\<tex2html_[a-z_]+_visible_mark\>/$r/;
136+
}
138137
return $s;
139138
}
140139

141140
sub make_nav_panel {
142141
my $s;
142+
my $BLANK_ICON = get_my_icon('blank');
143143
$NEXT = $NEXT_TITLE ? use_my_icon("$NEXT") : $BLANK_ICON;
144144
$UP = $UP_TITLE ? use_my_icon("$UP") : $BLANK_ICON;
145145
$PREVIOUS = $PREVIOUS_TITLE ? use_my_icon("$PREVIOUS") : $BLANK_ICON;
@@ -208,22 +208,25 @@ sub add_link {
208208
my($icon, $current_file, @link) = @_;
209209
my($dummy, $file, $title) = split($delim,
210210
$section_info{join(' ',@link)});
211-
$icon =~ s/\<tex2html_([_a-z]+)_visible_mark\>/$my_icons{$1}/;
211+
if ($icon =~ /\<tex2html_([_a-z]+)_visible_mark\>/) {
212+
my $r = get_my_icon($1);
213+
$icon =~ s/\<tex2html_[_a-z]+_visible_mark\>/$r/;
214+
}
212215
if ($title && ($file ne $current_file)) {
213216
$title = purify($title);
214217
$title = get_first_words($title, $WORDS_IN_NAVIGATION_PANEL_TITLES);
215218
return (make_href($file, $icon), make_href($file, "$title"))
216219
}
217-
elsif ($icon eq $my_icons{"up"} && $EXTERNAL_UP_LINK) {
220+
elsif ($icon eq get_my_icon('up') && $EXTERNAL_UP_LINK) {
218221
return (make_href($EXTERNAL_UP_LINK, $icon),
219222
make_href($EXTERNAL_UP_LINK, "$EXTERNAL_UP_TITLE"))
220223
}
221-
elsif ($icon eq $my_icons{"previous"}
224+
elsif ($icon eq get_my_icon('previous')
222225
&& $EXTERNAL_PREV_LINK && $EXTERNAL_PREV_TITLE) {
223226
return (make_href($EXTERNAL_PREV_LINK, $icon),
224227
make_href($EXTERNAL_PREV_LINK, "$EXTERNAL_PREV_TITLE"))
225228
}
226-
elsif ($icon eq $my_icons{"next"}
229+
elsif ($icon eq get_my_icon('next')
227230
&& $EXTERNAL_DOWN_LINK && $EXTERNAL_DOWN_TITLE) {
228231
return (make_href($EXTERNAL_DOWN_LINK, $icon),
229232
make_href($EXTERNAL_DOWN_LINK, "$EXTERNAL_DOWN_TITLE"))
@@ -233,7 +236,10 @@ sub add_link {
233236

234237
sub add_special_link {
235238
my($icon, $file, $current_file) = @_;
236-
$icon =~ s/\<tex2html_([_a-z]+)_visible_mark\>/$my_icons{$1}/;
239+
if ($icon =~ /\<tex2html_([_a-z]+)_visible_mark\>/) {
240+
my $r = get_my_icon($1);
241+
$icon =~ s/\<tex2html_[_a-z]+_visible_mark\>/$r/;
242+
}
237243
return (($file && ($file ne $current_file))
238244
? make_href($file, $icon)
239245
: undef)
@@ -320,8 +326,7 @@ sub add_module_idx {
320326
}
321327
close(MODIDXFILE);
322328
if (!$allthesame) {
323-
$prefix = <<PLAT_DISCUSS;
324-
329+
$prefix .= <<PLAT_DISCUSS;
325330
326331
<p> Some module names are followed by an annotation indicating what
327332
platform they are available on.</p>
@@ -462,11 +467,11 @@ sub add_bbl_and_idx_dummy_commands {
462467
s/$rx/\\textohtmlmoduleindex \1 \\textohtmlindex \2/o;
463468
# Add a button to the navigation areas:
464469
$CUSTOM_BUTTONS .= ('<a href="modindex.html" title="Module Index">'
465-
. $my_icons{'modules'}
470+
. get_my_icon('modules')
466471
. '</a>');
467472
}
468473
else {
469-
$CUSTOM_BUTTONS .= $BLANK_ICON;
474+
$CUSTOM_BUTTONS .= get_my_icon('blank');
470475
$global{'max_id'} = $id; # not sure why....
471476
s/([\\]begin\s*$O\d+$C\s*theindex)/\\textohtmlindex $1/o;
472477
s/[\\]printindex/\\textohtmlindex /o;

0 commit comments

Comments
 (0)