From 8164c2be3b4849a9c77e44b9659a3de8af010bd7 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Mon, 13 Dec 2021 03:02:58 +0000
Subject: CTAN sync 202112130302

---
 support/TeX4ht/source/tex4ht-4ht.tex | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 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 2482de9526..617f60e9fa 100644
--- a/support/TeX4ht/source/tex4ht-4ht.tex
+++ b/support/TeX4ht/source/tex4ht-4ht.tex
@@ -1,4 +1,4 @@
-% $Id: tex4ht-4ht.tex 1025 2021-12-08 13:40:02Z michal_h21 $
+% $Id: tex4ht-4ht.tex 1027 2021-12-10 23:22:54Z michal_h21 $
 % tex tex4ht-4ht   or   ht tex tex4ht-4ht
 %
 % Copyright 2009-2021 TeX Users Group    
@@ -5004,15 +5004,19 @@ We can load nameref from the early hook file
 |<load nameref in hyperref hooks|>
 >>> \AddFile{9}{hyperref-hooks}
 
-This code introduces various issues with BibLaTeX. I've tried
-to remove it, which fixed BibLaTeX issues, but broke Nameref.
-So I reintroduce it, and will try to resolve BibLaTeX issues
-in a different way.
+We need to load Nameref here, otherwise lot of documents
+that use Hyperref fails. This caused issues with BibLaTeX,
+as both Nameref, BibLaTeX and TeX4ht redefine ifthenelse command.
+
+So we load explicitly the Ifthen package, let Nameref redefine it,
+and then revert to it's original definition before applying of
+TeX4ht hooks.
 
 \<load nameref in hyperref hooks\><<<
 \:AtEndOfPackage{%
 \@ifpackageloaded{nameref}{}
 {%
+   \RequirePackage{ifthen}% 
    \let\sv:label\label
    \RequirePackage{nameref}%
    \let\label\sv:label
@@ -13136,12 +13140,22 @@ The need to initialize   \''\@svsechd' arises in
 % Copyright (C) |CopyYear.1997.      Eitan M. Gurari         %
 |<TeX4ht copyright|>
 
+   |<fix nameref ifthen|>
    |<fix ifthen|>
    |<ifthen.sty shared config|>
 \Hinput{ifthen}
 \endinput
 >>>        \AddFile{7}{ifthen}
 
+Nameref redefines ifthenelse command, but it clashes with BibLaTeX,
+so we revert back to the original version.
+
+\<fix nameref ifthen\><<<
+\@ifpackageloaded{nameref}{%
+\let\ifthenelse\NROrg@ifthenelse%
+}{}
+>>>
+
 \<fix ifthen\><<<
 \long\def\:tempc{% 
    \let\sv:begingroup\begingroup
-- 
cgit v1.2.3

