[latex3-commits] [git/LaTeX3-latex3-hyperref] testnewkeyval: color keys (5696898)

Ulrike Fischer fischer at troubleshooting-tex.de
Thu Jul 7 00:46:11 CEST 2022


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

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

commit 56968981cfaa53054383a005dd35b43009c05f97
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Thu Jul 7 00:46:11 2022 +0200

    color keys


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

56968981cfaa53054383a005dd35b43009c05f97
 hyperref.dtx | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 116 insertions(+), 18 deletions(-)

diff --git a/hyperref.dtx b/hyperref.dtx
index 48aea56..c6e0745 100644
--- a/hyperref.dtx
+++ b/hyperref.dtx
@@ -6326,6 +6326,8 @@
 % and with the other drivers.
 % We assume for now that the generic driver is used if |\DocumentMetadata| has been
 % used; this is perhaps not true.
+% TODO: decide about frenchlinks with new driver
+% TODO: check the key handling
 %    \begin{macrocode}
 \newcommand \Hy at activate@colorlinks
   {%
@@ -6362,6 +6364,25 @@
   \def\@pdfborder{0 0 0}%
   \let\@pdfborderstyle\ltx at empty
 }
+\define at key{Hyp}{ocgcolorlinks}[true]{%
+  \Hy at boolkey{ocgcolorlinks}{#1}%
+}
+\Hy at AtBeginDocument{%
+  \begingroup
+    \@ifundefined{OBJ at OCG@view}{%
+      \ifHy at ocgcolorlinks
+        \Hy at Warning{%
+          Driver does not support `ocgcolorlinks',\MessageBreak
+          using `colorlinks' instead%
+        }%
+      \fi
+    }{}%
+  \endgroup
+}
+\define at key{Hyp}{frenchlinks}[true]{%
+  \Hy at boolkey{frenchlinks}{#1}%
+}
+
 \ExplSyntaxOn
 \IfDocumentMetadataTF
  {
@@ -6377,6 +6398,14 @@
           \AtEndOfPackage {\keys_set:nn { hyp / setup }{colorlinks=false}}
         }
        ,colorlinks .default:n = true
+       ,hidelinks .code:n =
+        {
+          \AtEndOfPackage {\keys_set:nn { hyp / setup }{hidelinks}}
+        }
+       ,ocgcolorlinks .code:n =
+        {
+          \AtEndOfPackage {\keys_set:nn { hyp / setup }{ocgcolorlinks=#1}}
+        }
      }
  }
  {
@@ -6391,28 +6420,19 @@
        {
          \Hy at activate@plainlinks
        }
+      ,hidelinks .code:n
+        {
+          \Hy at activate@hidelinks
+        }
+      ,frenchlinks .code:n =
+        {
+          \Hy at activate@frenchlinks
+        }
+      ,ocgcolorlinks .legacy_if_set:n = {Hy at ocgcolorlinks}
     }
  }
 \ExplSyntaxOff
 
-\define at key{Hyp}{ocgcolorlinks}[true]{%
-  \Hy at boolkey{ocgcolorlinks}{#1}%
-}
-\Hy at AtBeginDocument{%
-  \begingroup
-    \@ifundefined{OBJ at OCG@view}{%
-      \ifHy at ocgcolorlinks
-        \Hy at Warning{%
-          Driver does not support `ocgcolorlinks',\MessageBreak
-          using `colorlinks' instead%
-        }%
-      \fi
-    }{}%
-  \endgroup
-}
-\define at key{Hyp}{frenchlinks}[true]{%
-  \Hy at boolkey{frenchlinks}{#1}%
-}
 %    \end{macrocode}
 %
 % \section{Bookmarking}
@@ -6443,6 +6463,12 @@
 \define at key{Hyp}{bookmarksopen}[true]{%
   \Hy at boolkey{bookmarksopen}{#1}%
 }
+\DeclareKeys
+  {
+    ,bookmarks .legacy_if_set:n = Hy at bookmarks
+    ,bookmarks .usage:n =load
+    ,bookmarksopen .legacy_if_set:n = Hy at bookmarksopen
+  }
 %    \end{macrocode}
 %
 %    The depth of the outlines is controlled by option
@@ -6488,6 +6514,40 @@
     \fi
   \endgroup
 }
+
+\DeclareKeys
+ {
+   bookmarksdepth .code:n =
+    {%
+       \begingroup
+        \edef\x{#1}%
+        \ifx\x\empty
+          \global\let\Hy at bookmarksdepth\c at tocdepth
+        \else
+          \@ifundefined{toclevel@\x}{%
+            \@onelevel at sanitize\x
+            \edef\y{\expandafter\@car\x\@nil}%
+            \ifcase 0\expandafter\ifx\y-1\fi
+                     \expandafter\ifnum\expandafter`\y>47 %
+                       \expandafter\ifnum\expandafter`\y<58 1\fi\fi\relax
+              \Hy at Warning{Unknown document division name (\x)}%
+            \else
+              \setbox\z@=\hbox{%
+                \count@=\x
+                \xdef\Hy at bookmarksdepth{\the\count@}%
+              }%
+            \fi
+          }{%
+            \setbox\z@=\hbox{%
+              \count@=\csname toclevel@\x\endcsname
+              \xdef\Hy at bookmarksdepth{\the\count@}%
+            }%
+          }%
+        \fi
+      \endgroup
+    }
+ }
+
 %    \end{macrocode}
 %
 % `bookmarksopenlevel' to specify the open level. From Heiko Oberdiek.
@@ -6496,11 +6556,24 @@
   \def\@bookmarksopenlevel{#1}%
 }
 \def\@bookmarksopenlevel{\maxdimen}
+
+\DeclareKeys
+ {
+   ,bookmarksopenlevel .tl_set:N = \@bookmarksopenlevel
+   ,bookmarksopenlevel .initial:n = \maxdimen
+ }
 % `bookmarkstype' to specify which `toc' file to mimic
 \define at key{Hyp}{bookmarkstype}{%
   \def\Hy at bookmarkstype{#1}%
 }
 \def\Hy at bookmarkstype{toc}
+
+\DeclareKeys
+ {
+   ,bookmarkstype .tl_set:N = \Hy at bookmarkstype
+   ,bookmarkstype .initial:n = toc
+ }
+
 %    \end{macrocode}
 % Richard Curnow <richard at curnow.demon.co.uk> suggested this
 % functionality. It adds section numbers etc to bookmarks.
@@ -6508,6 +6581,12 @@
 \define at key{Hyp}{bookmarksnumbered}[true]{%
   \Hy at boolkey{bookmarksnumbered}{#1}%
 }
+
+\DeclareKeys
+ {
+   ,bookmarkstype .legacy_if_set:n = Hy at bookmarksnumbered
+ }
+
 %    \end{macrocode}
 %
 %    Option CJKbookmarks enables the patch for
@@ -6516,6 +6595,11 @@
 \define at key{Hyp}{CJKbookmarks}[true]{%
   \Hy at boolkey{CJKbookmarks}{#1}%
 }
+\DeclareKeys
+ {
+   ,CJKbookmarks .legacy_if_set:n = Hy at CJKbookmarks
+ }
+
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -6527,6 +6611,7 @@
     \HyColor at HyperrefColor{##1}#1%
   }%
   \def#1{#3}%
+  \DeclareKeys{#2color .code:n= {\HyColor at HyperrefColor{##1}#1}}%
 }
 \Hy at temp{link}{red}
 \Hy at temp{anchor}{black}
@@ -6551,6 +6636,19 @@
   \HyColor at HyperrefColor{#1}\@menucolor
   \HyColor at HyperrefColor{#1}\@runcolor
 }
+\DeclareKeys
+  {
+    allcolors .code:n =
+     {%
+       \HyColor at HyperrefColor{#1}\@linkcolor
+       \HyColor at HyperrefColor{#1}\@anchorcolor
+       \HyColor at HyperrefColor{#1}\@citecolor
+       \HyColor at HyperrefColor{#1}\@filecolor
+       \HyColor at HyperrefColor{#1}\@urlcolor
+       \HyColor at HyperrefColor{#1}\@menucolor
+       \HyColor at HyperrefColor{#1}\@runcolor
+     }
+  }
 %    \end{macrocode}
 %
 %    \begin{macrocode}





More information about the latex3-commits mailing list.