[latex3-commits] [git/LaTeX3-latex3-hyperref] testnewkeyval: WIP, switch to new keyval handler (fe32a1a)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Jun 21 14:48:19 CEST 2022


Repository : https://github.com/latex3/hyperref
On branch  : testnewkeyval
Link       : https://github.com/latex3/hyperref/commit/fe32a1a0b331bc2ac6417d0c6912f05527a6a1be

>---------------------------------------------------------------

commit fe32a1a0b331bc2ac6417d0c6912f05527a6a1be
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Jun 21 14:48:19 2022 +0200

    WIP, switch to new keyval handler


>---------------------------------------------------------------

fe32a1a0b331bc2ac6417d0c6912f05527a6a1be
 hyperref.dtx | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/hyperref.dtx b/hyperref.dtx
index e6f5b4f..177b401 100644
--- a/hyperref.dtx
+++ b/hyperref.dtx
@@ -4649,6 +4649,22 @@
 }
 \let\KV at Hyp@nolinks\KV at Hyp@draft
 %    \end{macrocode}
+% Implementation with the new key-value handler.
+% Unlike the hyperref code they are currently silent.
+% The `nolinks` option is ignored as it is not documented.
+%    \begin{macrocode}
+\DeclareKeys
+ {
+   ,implicit  .legacy_if_set:n = {Hy at implicit}
+   ,implicit  .usage = load
+   ,draft     .legacy_if_set:n = {Hy at draft}
+   ,draft     .usage = preamble
+   ,
+   ,final     .legacy_if_set_inverse:n = {Hy at draft}
+   ,final     .usage = preamble
+ }
+%    \end{macrocode}
+% These obsolete options are ignored with the new keyval-handler.
 %    \begin{macrocode}
 \def\Hy at ObsoletePaperOption#1{%
   \Hy at WarningNoLine{%
@@ -4710,6 +4726,39 @@
   \Hy at boolkey{verbose}{#1}%
 }
 %    \end{macrocode}
+% This implements the above keys with the new keyval handler.
+% |setpagesize| is ignored. This isn't a task for hyperref but should
+% be handled by the backend code.
+%    \begin{macrocode}
+\ExplSyntaxOn
+\DeclareKeys
+ {
+   ,linktoc   .choices:nn =
+     { none, section, page, all }
+     { \cs_set_eq:Nc \Hy at linktoc { Hy at linktoc@#1 } }
+   ,linktoc / unknown .code:n =
+     {
+       \Hy at Warning
+         {
+          Unexpected~value~`#1'~of\MessageBreak
+          option~`linktoc'~instead~of~`none',\MessageBreak
+          `section',~`page'~or~`all'
+         }
+     }
+   ,linktoc   .usage:n         = {preamble}
+   ,linktocpage .choice:
+   ,linktocpage / true .code:n =
+     { \cs_set_eq:NN \Hy at linktoc\Hy at linktoc@page }
+   ,linktocpage / false .code:n =
+     { \cs_set_eq:NN \Hy at linktoc\Hy at linktoc@section }
+   ,linktocpage .default:n = {true}
+   ,linktocpage .usage:n   = {preamble}
+   ,extension .tl_set:N        = \XR at ext
+   ,verbose   .legacy_if_set:n = {Hy at verbose}
+   ,debug     .legacy_if_set:n = {Hy at verbose}
+ }
+\ExplSyntaxOff
+%    \end{macrocode}
 % If we are going to PDF via HyperTeX |\special| commands,
 % the dvips (-z option)  processor does not know
 % the \emph{height} of a link, as it works solely on the
@@ -6785,6 +6834,7 @@
 %
 %    \begin{macrocode}
 \let\ReadBookmarks\relax
+\ProcessKeyOptions
 \ProcessKeyvalOptions{Hyp}
 %    \end{macrocode}
 %





More information about the latex3-commits mailing list.