[latex3-commits] [git/LaTeX3-latex3-hyperref] cleanup-patches: use NewDocumentCommand for ref commands (5c8e2cf)
Ulrike Fischer
fischer at troubleshooting-tex.de
Tue Apr 12 12:32:56 CEST 2022
Repository : https://github.com/latex3/hyperref
On branch : cleanup-patches
Link : https://github.com/latex3/hyperref/commit/5c8e2cfd1f6570e3f7e68137813dceaaf1bf8376
>---------------------------------------------------------------
commit 5c8e2cfd1f6570e3f7e68137813dceaaf1bf8376
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Tue Apr 12 12:32:56 2022 +0200
use NewDocumentCommand for ref commands
>---------------------------------------------------------------
5c8e2cfd1f6570e3f7e68137813dceaaf1bf8376
hyperref.dtx | 7 +++----
nameref.dtx | 21 +++++++++++++--------
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/hyperref.dtx b/hyperref.dtx
index 4d3e518..cac23eb 100644
--- a/hyperref.dtx
+++ b/hyperref.dtx
@@ -12638,10 +12638,9 @@
% \cs{leavevmode} is added to make package wrapfigure happy, if
% \cs{autoref} starts a paragraph.
% \begin{macrocode}
-\DeclareRobustCommand*{\autoref}{%
- \leavevmode
- \@ifstar{\HyRef at autoref\@gobbletwo}{\HyRef at autoref\hyper@@link}%
-}
+\NewDocumentCommand\autoref{s}
+ {\leavevmode
+ \IfBooleanTF{#1}{\HyRef at autoref\@gobbletwo}{\HyRef at autoref\hyper@@link}}
\def\HyRef at autoref#1#2{%
\begingroup
\Hy at safe@activestrue
diff --git a/nameref.dtx b/nameref.dtx
index ae22962..1c61f79 100644
--- a/nameref.dtx
+++ b/nameref.dtx
@@ -678,22 +678,26 @@
% \end{macrocode}
% \begin{macro}{\ref}
% \begin{macrocode}
- \DeclareRobustCommand{\ref}{\@ifstar\@refstar\T at ref}%
+ \DeclareDocumentCommand\ref{s}
+ {\IfBooleanTF{#1}{\@refstar}{\T at ref}}%
% \end{macrocode}
% \end{macro}
% \begin{macro}{\pageref}
% \begin{macrocode}
- \DeclareRobustCommand{\pageref}{\@ifstar\@pagerefstar\T at pageref}%
+ \DeclareDocumentCommand\pageref{s}
+ {\IfBooleanTF{#1}{\@pagerefstar}{\T at pageref}}%
% \end{macrocode}
% \end{macro}
% \begin{macro}{\Ref}
% \begin{macrocode}
- \DeclareRobustCommand*{\Ref}{%
- \@ifstar\@Refstar\T at Ref}%
-}
+ \DeclareDocumentCommand\Ref{s}
+ {\IfBooleanTF{#1}{\@Refstar}{\T at Ref}}%
% \end{macrocode}
% \end{macro}
% \begin{macrocode}
+}
+% \end{macrocode}
+% \begin{macrocode}
\DeclareHookRule{begindocument}{showkeys}{before}{nameref}
% \end{macrocode}
%
@@ -726,13 +730,14 @@
% \end{macrocode}
% \begin{macro}{\nameref}
% \begin{macrocode}
- \DeclareRobustCommand*{\nameref}{%
- \@ifstar\@namerefstar\T at nameref
- }%
+\NewDocumentCommand\nameref{s}
+ {\IfBooleanTF{#1}{\@namerefstar}{\T at nameref}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\Nameref}
% An extended form which gives title and page number.
+% Not really useful, quotes are english, and no starred version.
+% varioref can do that better. Remove??
% \begin{macrocode}
\def\Nameref#1{`\nameref{#1}' on page~\pageref{#1}}
% \end{macrocode}
More information about the latex3-commits
mailing list.