summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-07-01 21:55:38 +0000
committerKarl Berry <karl@freefriends.org>2022-07-01 21:55:38 +0000
commit1630a69007ed6b120266a22c985ff60a2e6c1527 (patch)
tree5773911042c9bd2d8550b8b8185931124831ecd3
parent72f4237b5d89fb01d7c56ab1c8dbcb70f9db17da (diff)
\hyperref undefined ref, tex4ht r1164
git-svn-id: svn://tug.org/texlive/trunk@63781 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/source/generic/tex4ht/ChangeLog6
-rw-r--r--Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex36
-rw-r--r--Master/texmf-dist/tex/generic/tex4ht/hyperref.4ht24
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 <michal.h21@gmail.com>
+
+ * 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 <michal.h21@gmail.com>
* 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}}}
\<config hyperref\><<<
-\def\label@hyperref[#1]#2{{%
- \def\hyperrefLabel{#2}%
- \Configure{ref}
- {\Link}{\EndLink}{\Configure{ref}{}{}{}#2}\ref{#1}}}
+|<label@@hyperref|>
|<autoref references|>
|<restore pre hyperref|>
|<nameref.sty NOT HERE|>
\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.
+
+\<label@@hyperref\><<<
+\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}}