From a7538780c749168835167a8d30aa65779c89407a Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Mon, 18 Apr 2022 03:02:01 +0000
Subject: CTAN sync 202204180302

---
 support/TeX4ht/source/tex4ht-4ht.tex | 45 +++++++++++++++++++++++++++++++-----
 1 file changed, 39 insertions(+), 6 deletions(-)

(limited to 'support/TeX4ht/source/tex4ht-4ht.tex')

diff --git a/support/TeX4ht/source/tex4ht-4ht.tex b/support/TeX4ht/source/tex4ht-4ht.tex
index 86cf26ae1b..73fc7351a1 100644
--- a/support/TeX4ht/source/tex4ht-4ht.tex
+++ b/support/TeX4ht/source/tex4ht-4ht.tex
@@ -1,4 +1,4 @@
-% $Id: tex4ht-4ht.tex 1110 2022-04-13 14:59:07Z michal_h21 $
+% $Id: tex4ht-4ht.tex 1113 2022-04-17 10:39:05Z michal_h21 $
 % tex tex4ht-4ht   or   ht tex tex4ht-4ht
 %
 % Copyright 2009-2022 TeX Users Group    
@@ -1543,7 +1543,7 @@ name which is provided in the parameter of \''\cur:lbl'.
 \<cross ref\><<<
 \NewConfigure{@:currentlabel}[1]{\concat:config\a:@:currentlabel{#1}}
 \let\a:@:currentlabel|=\relax
-\def\cur:lbl#1{{\a:@:currentlabel 
+\def\cur:lbl#1{{\let\saved:currentlabel\:currentlabel\a:@:currentlabel 
   |<body of cur:lbl|>\expandafter}\:currentlabel}
 >>>
 
@@ -1554,7 +1554,8 @@ name which is provided in the parameter of \''\cur:lbl'.
 \else \def\:currentlabel{#1}%
    \edef\:currentlabel{\def\noexpand
                  \:currentlabel{\ifx\:currentlabel\empty
-         \ifx \:@currentlabel\:UnDef \@currentlabel
+         \ifx \:@currentlabel\:UnDef 
+         \ifx\saved:currentlabel \@currentlabel\@currentlabel\else\saved:currentlabel\fi
          \else \:@currentlabel \fi
       \else 
           \expandafter\ifx\csname #1:Count\endcsname\relax
@@ -1738,6 +1739,7 @@ Example \ref{E}
    |</edef /@currentlabel|>%
    \xdef\cur:th{|<haddr prefix|>\last:haddr}%
    |<get :currentlabel|>%
+   \xdef\:currentlabel{#2}%
    \edef\:SecAnchor{\cur:th\:currentlabel}%
  }
 >>>
@@ -1753,7 +1755,7 @@ of entries as \''\Alph'.
      XXI\or XXII\or XXIII\or XXIV\or XV\or XVI\else
      \expandafter\uppercase\expandafter{\romannumeral ##1}\fi}%
    \a:currentlabel
-   \edef\:temp{#2}\ifx \:temp\empty
+   \edef\:temp{\csname p@#1\expandafter\endcsname\csname the#1\endcsname}\ifx \:temp\empty
    \else \global\let\@currentlabel|=\:temp\fi
 \egroup
 >>>
@@ -5506,6 +5508,35 @@ The following fix is to hold hypertex from modifying the links in
 \catcode`\:=11
 >>>
 
+The following code was originally placed directly in hyperref.sty.
+We moved it here, so Hyperref don't need to contain specific
+TeX4ht code.
+
+\<config hyperref\><<<
+\def\T@pageref#1{%
+  \Hy@safe@activestrue%
+  \expandafter\@setref\csname r@#1\endcsname\@secondoffive{#1}%
+  \Hy@safe@activesfalse%
+}%
+\def\T@Ref#1{%
+  \Hy@safe@activestrue%
+  \let\olda:rEfLiNK\rEfLiNK%%
+  \def\rEfLiNK##1##2{\Link{##1}{}\edef\:ref:currentlabel{##2}\expandafter\MakeUppercase\:ref:currentlabel\EndLink}%
+  \expandafter\@setref\csname r@#1\endcsname\@firstoffive{#1}%
+  \let\rEfLiNK\olda:rEfLiNK%
+  \Hy@safe@activesfalse%
+}%
+\def\@Refstar#1{%
+  \Hy@safe@activestrue
+  \let\olda:rEfLiNK\rEfLiNK%%
+  \def\rEfLiNK##1##2{\Link{##1}{}\edef\:ref:currentlabel{##2}\expandafter\MakeUppercase\:ref:currentlabel\EndLink}%
+  \expandafter\@setref\csname r@#1\endcsname\@firstoffive{#1}%
+  \let\rEfLiNK\olda:rEfLiNK%
+  \Hy@safe@activesfalse
+}%
+
+>>>
+
 %%%%%%%%%%%%%%%%%%%%%%%%%
 \SubSection{Forms}
 %%%%%%%%%%%%%%%%%%%%%%
@@ -27074,8 +27105,10 @@ fragments.
   %\expandafter\ifx \csname HColor!#1\endcsname\relax
      \let\HColor=\relax
      |<xcolor from def|>%
-  \else
-     \csname HColor!#1\endcsname #2//%
+  \else%
+     \ifcsname HColor!#1\endcsname%
+       \csname HColor!#1\endcsname #2//%
+     \fi%
   \fi
 }
 \expandafter\def\csname c:HColor!gray:\endcsname{%
-- 
cgit v1.2.3

