From 1630a69007ed6b120266a22c985ff60a2e6c1527 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 1 Jul 2022 21:55:38 +0000 Subject: \hyperref undefined ref, tex4ht r1164 git-svn-id: svn://tug.org/texlive/trunk@63781 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/generic/tex4ht/ChangeLog | 6 ++++ .../source/generic/tex4ht/tex4ht-4ht.tex | 36 +++++++++++++++++++--- Master/texmf-dist/tex/generic/tex4ht/hyperref.4ht | 24 +++++++++++---- 3 files changed, 55 insertions(+), 11 deletions(-) diff --git a/Master/texmf-dist/source/generic/tex4ht/ChangeLog b/Master/texmf-dist/source/generic/tex4ht/ChangeLog index 5190ec89920..7f361c46d9b 100644 --- a/Master/texmf-dist/source/generic/tex4ht/ChangeLog +++ b/Master/texmf-dist/source/generic/tex4ht/ChangeLog @@ -1,3 +1,9 @@ +2022-07-01 Michal Hoftich + + * tex4ht-4ht.tex (hyperref.4ht): fixed handling of undefined + references in the \hyperref command. + https://tex.stackexchange.com/a/649552/2891 + 2022-06-30 Michal Hoftich * tex4ht-mathml.tex (mathml.4ht): retain text formatting inside diff --git a/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex b/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex index f99c6fbd42b..bd8a32515b1 100644 --- a/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex +++ b/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex @@ -1,4 +1,4 @@ -% $Id: tex4ht-4ht.tex 1161 2022-06-27 10:03:53Z michal_h21 $ +% $Id: tex4ht-4ht.tex 1164 2022-07-01 14:16:09Z michal_h21 $ % tex tex4ht-4ht or ht tex tex4ht-4ht % % Copyright 2009-2022 TeX Users Group @@ -5321,16 +5321,42 @@ which requires 5 fields instead of 2. % \Configure{ref}{}{}{}\ref{#1}}} \<<< -\def\label@hyperref[#1]#2{{% - \def\hyperrefLabel{#2}% - \Configure{ref} - {\Link}{\EndLink}{\Configure{ref}{}{}{}#2}\ref{#1}}} +| | | | \csname ReadBookmarks\endcsname >>> +% We don't use this code anymore +% \def\label@hyperref[#1]#2{{% +% \def\hyperrefLabel{#2}% +% \Configure{ref} +% {\Link}{\EndLink}{\Configure{ref}{}{}{}#2}\ref{#1}}} + +The \Verb+\hyperref[label]{title}+ command should print the +title when label is undefined. The older configuration printed +?? instead. This should fix this issue. +\Link{https://tex.stackexchange.com/a/649552/2891}{}More info\EndLink. + +\<<< +\def\label@@hyperref#1#2#3{% + \ifx#1\relax + \protect\G@refundefinedtrue + \@latex@warning{% + Hyper reference `#2' on page \thepage \space undefined% + }% + \begingroup + \hyperrefundefinedlink{#3}% + \endgroup + \else% + \def\hyperrefLabel{#3}% + \Configure{ref}% + {\Link}{\EndLink}{\Configure{ref}{}{}{}#3}\ref{#2}% + \fi +} +>>> + A \Verb+\def\@@hyperref#1#2#3{\Link[#2]{}{}#1\EndLink}+ got removed since it fails the second case below. diff --git a/Master/texmf-dist/tex/generic/tex4ht/hyperref.4ht b/Master/texmf-dist/tex/generic/tex4ht/hyperref.4ht index 257d1262269..96d12b8008e 100644 --- a/Master/texmf-dist/tex/generic/tex4ht/hyperref.4ht +++ b/Master/texmf-dist/tex/generic/tex4ht/hyperref.4ht @@ -1,4 +1,4 @@ -% hyperref.4ht (2022-04-14-13:38), generated from tex4ht-4ht.tex +% hyperref.4ht (2022-07-01-14:27), generated from tex4ht-4ht.tex % Copyright 1999-2009 Eitan M. Gurari % Copyright 2009-2022 TeX Users Group % @@ -17,7 +17,7 @@ % % If you modify this program, changing the % version identification would be appreciated. -\immediate\write-1{version 2022-04-14-13:38} +\immediate\write-1{version 2022-07-01-14:27} \csname end:hyperref\endcsname @@ -361,10 +361,22 @@ \endcsname{\let\hyper:normalise\def}% \expandafter\pend:def\csname href \endcsname{\let\hyper:normalise\def}% \pend:defI\T@ref{\edef\RefArg{##1}}} -\def\label@hyperref[#1]#2{{% - \def\hyperrefLabel{#2}% - \Configure{ref} - {\Link}{\EndLink}{\Configure{ref}{}{}{}#2}\ref{#1}}} +\def\label@@hyperref#1#2#3{% + \ifx#1\relax + \protect\G@refundefinedtrue + \@latex@warning{% + Hyper reference `#2' on page \thepage \space undefined% + }% + \begingroup + \hyperrefundefinedlink{#3}% + \endgroup + \else% + \def\hyperrefLabel{#3}% + \Configure{ref}% + {\Link}{\EndLink}{\Configure{ref}{}{}{}#3}\ref{#2}% + \fi +} + \Configure{@newlabel}{\@onelevel@sanitize\@currentlabelname} \append:def\protect:wrtoc{\def\ref{\protect\o:ref}} -- cgit v1.2.3