From 06ccb361c346a4ee64d740cdd993f3bdde52172f Mon Sep 17 00:00:00 2001 From: deyan Date: Thu, 24 Oct 2024 09:22:50 -0400 Subject: [PATCH] scoped \href arguments to avoid leaking color --- lib/LaTeXML/Package/hyperref.sty.ltxml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/LaTeXML/Package/hyperref.sty.ltxml b/lib/LaTeXML/Package/hyperref.sty.ltxml index 820339cec..422d9b8f0 100644 --- a/lib/LaTeXML/Package/hyperref.sty.ltxml +++ b/lib/LaTeXML/Package/hyperref.sty.ltxml @@ -186,7 +186,9 @@ DefMacro('\url', '\begingroup\lx@hyper@url\url', locked => 1); DefConstructor('\lx@hyper@url@ Undigested {}{} Semiverbatim {}', "?#isMath(#5)" # Allow this to work in Math! . " (#5)", - properties => sub { (href => ComposeURL(LookupValue('BASE_URL'), $_[4]), + beforeDigest => \&LaTeXML::Core::Stomach::bgroup, + afterDigest => \&LaTeXML::Core::Stomach::egroup, + properties => sub { (href => ComposeURL(LookupValue('BASE_URL'), $_[4]), class => sub { my $c = ToString($_[1]); $c =~ s/^\\//; 'ltx_' . $c; }); }, sizer => '#5', reversion => '#1#2#4#3'); @@ -205,7 +207,9 @@ DefMacro('\hyperref', '\@ifnextchar[\hyperref@@ii\hyperref@@iv'); # 2 argument form DefConstructor('\hyperref@@ii OptionalSemiverbatim {}', "#2", - properties => sub { (label => CleanLabel($_[1])); }); + beforeDigest => \&LaTeXML::Core::Stomach::bgroup, + afterDigest => \&LaTeXML::Core::Stomach::egroup, + properties => sub { (label => CleanLabel($_[1])); }); # 4 argument form DefConstructor('\hyperref@@iv Semiverbatim Semiverbatim Semiverbatim Semiverbatim', "#4",