Skip to content

Commit 53a7e01

Browse files
committed
Improve naming
1 parent 35380b5 commit 53a7e01

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

lib/LaTeXML/Engine/TeX_Box.pool.ltxml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -527,32 +527,32 @@ sub adjustBoxColor {
527527
my $color = $font && $font->getColor;
528528
my $bgcolor = $font && $font->getBackground;
529529
if(($color && !Black->equals($color)) || ($bgcolor && !White->equals($bgcolor))){
530-
return adjustBoxColor_rec($color, $bgcolor, {}, $box); }
530+
return _color_adjust($color, $bgcolor, {}, $box); }
531531
return $box; }
532532

533-
sub adjustBoxColor_rec {
533+
sub _color_adjust {
534534
no warnings 'recursion';
535-
my ($fg, $bg, $cache, $box) = @_;
536-
return $box unless $box;
537-
return $$cache{$box} if $$cache{$box}; # Nested, possibly circular, structures
538-
my $type = ref $box;
539-
my $adj = $box;
535+
my ($fg, $bg, $cache, $object) = @_;
536+
return $object unless $object;
537+
return $$cache{$object} if $$cache{$object}; # Nested, possibly circular, structures
538+
my $type = ref $object;
539+
my $adj = $object;
540540
if($type eq 'ARRAY'){
541-
$adj = [map { adjustBoxColor_rec($fg, $bg, $cache, $_); } @$box]; }
541+
$adj = [map { _color_adjust($fg, $bg, $cache, $_); } @$object]; }
542542
elsif($type eq 'HASH'){
543-
$adj = {map { $_=>adjustBoxColor_rec($fg, $bg, $cache, $$box{$_}); } keys %$box}; }
543+
$adj = {map { $_=>_color_adjust($fg, $bg, $cache, $$object{$_}); } keys %$object}; }
544544
# NASTY access to internal structure; but worth a whole API for this one hack???
545545
elsif ($type =~ /^LaTeXML::Core::(?:Box|List|Whatsit|Alignment)$/) { # blessed hashes!
546-
$$cache{$box} = $adj = bless {%$box}, $type; # Cache BEFORE recursion!
547-
map { $$adj{$_} = adjustBoxColor_rec($fg, $bg, $cache, $$box{$_}); } keys %$box; }
546+
$$cache{$object} = $adj = bless {%$object}, $type; # Cache BEFORE recursion!
547+
map { $$adj{$_} = _color_adjust($fg, $bg, $cache, $$object{$_}); } keys %$object; }
548548
elsif($type eq 'LaTeXML::Common::Font'){
549549
# Replace "default" color & background color by the requested $fg,$bg.
550550
# We'll use eq (of refs) hoping that detects inherited defaults,
551551
# rather than explicitly assigned black or white colors.
552-
$adj = $box;
553-
$adj = $adj->merge(color => $fg) if Black eq ($box->getColor || Black);
554-
$adj = $adj->merge(background => $bg) if White eq ($box->getBackground || White); }
555-
$$cache{$box} = $adj;
552+
$adj = $object;
553+
$adj = $adj->merge(color => $fg) if Black eq ($object->getColor || Black);
554+
$adj = $adj->merge(background => $bg) if White eq ($object->getBackground || White); }
555+
$$cache{$object} = $adj;
556556
return $adj; }
557557

558558
DefPrimitive('\box Number', sub {

0 commit comments

Comments
 (0)