[latex3-commits] [git/LaTeX3-latex3-pdfresources] reworking-annot: remove zref dependency and use l3ref-tmp.sty (cf0dc49)

Ulrike Fischer fischer at troubleshooting-tex.de
Sat Dec 26 22:29:47 CET 2020


Repository : https://github.com/latex3/pdfresources
On branch  : reworking-annot
Link       : https://github.com/latex3/pdfresources/commit/cf0dc49178d55b36911f2cee3832377dbade99a7

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

commit cf0dc49178d55b36911f2cee3832377dbade99a7
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sat Dec 26 22:29:47 2020 +0100

    remove zref dependency and use l3ref-tmp.sty


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

cf0dc49178d55b36911f2cee3832377dbade99a7
 hgeneric-experimental.def | 110 ++++++++++++++++------------------------------
 l3backend-pdf-extra.dtx   |  46 +++++++------------
 2 files changed, 53 insertions(+), 103 deletions(-)

diff --git a/hgeneric-experimental.def b/hgeneric-experimental.def
index a1768b4..fec2628 100644
--- a/hgeneric-experimental.def
+++ b/hgeneric-experimental.def
@@ -38,101 +38,65 @@
 %%   \Hy at EXPsetbordercolor
 %%   \hypupdateattribute
 \ProvidesFile{hgeneric-experimental.def}
-  [2020/12/03 v0.7 %
+  [2020/12/26 v0.71 %
   Hyperref driver for luaTeX]
 
 \RequirePackage{xparse,etoolbox,l3color}
 \chardef\Hy at VersionChecked=1 %don't check the version!
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \ExplSyntaxOn
-%% zref/l3xref switch
-% one of both must have been loaded as pdfmanagement is a requirement
-% this is not perfect but should work only xref is there for good.
+% Test is resource management is active ...
+\msg_new:nnn
+  { hyp }
+  { missing-resource-management }
+  { The~resource~management~is~required~for~this~hyperref~driver! }
 
-\cs_if_exist:NTF \xref_value:nn
+\bool_lazy_and:nnF
+  { \cs_if_exist_p:N \pdfmanagement_if_active_p: }{ \pdfmanagement_if_active_p: }
+  { \msg_error:nn { hyp}{ missing-resource-management}}
+
+% l3ref-tmp must have been loaded as pdfmanagement is a requirement
+\cs_new_protected:Npn \__hyp_ref_label:nn #1 #2 %label/attributes
   {
-    \cs_new_protected:Npn \__hyp_ref_label:nn #1 #2 %label/attributes
-      {
-        \@bsphack
-          \xref_label:nn{#1}{#2}
-        \@esphack
-      }
-    \cs_generate_variant:Nn \__hyp_ref_label:nn {en}
-    \cs_new_protected:Npn \__hyp_ref_check:nn #1 #2 %label/attribute
-      {
-        \tl_if_exist:cF { g__xref_label_ \tl_to_str:n {#1} _ \tl_to_str:n {#2} _tl }
-          {
-            \protect\G at refundefinedtrue
-            \@latex at warning
-              {
-                Reference~`\tl_to_str:n {#1}'~with~attribute~`\tl_to_str:n {#2}'~
-                on~page~\thepage~\space undefined
-              }
-          }
-      }
-    \cs_generate_variant:Nn \__hyp_ref_check:nn {en}
-    \prg_new_conditional:Npnn \__hyp_ref_if_exist:nn #1#2 { p , T , TF }  % #1 #2 %label/attribute
+    \@bsphack
+      \ref_label:nn{#1}{#2}
+    \@esphack
+  }
+\cs_generate_variant:Nn \__hyp_ref_label:nn {en}
+\cs_new_protected:Npn \__hyp_ref_check:nn #1 #2 %label/attribute
+  {
+    \tl_if_exist:cF { g__ref_label_ \tl_to_str:n {#1} _ \tl_to_str:n {#2} _tl }
       {
-        \tl_if_exist:cTF { g__xref_label_ \tl_to_str:n {#1} _ \tl_to_str:n {#2} _tl }
-          {
-            \prg_return_true:
-          }
+        \protect\G at refundefinedtrue
+        \@latex at warning
           {
-            \prg_return_false:
+            Reference~`\tl_to_str:n {#1}'~with~attribute~`\tl_to_str:n {#2}'~
+            on~page~\thepage~\space undefined
           }
       }
-    \prg_generate_conditional_variant:Nnn \__hyp_ref_if_exist:nn  {en} { p , T , TF }
-    \cs_new:Npn \__hyp_ref_value:nn #1 #2
-     {
-        \xref_value:nn{#1}{#2}
-     }
-    \cs_generate_variant:Nn \__hyp_ref_value:nn {en}
   }
-  { %zref
-    \RequirePackage{zref-abspage} %move to backend ...
-    \cs_new_protected:Npn \__hyp_ref_label:nn #1 #2 %label/attributes
+\cs_generate_variant:Nn \__hyp_ref_check:nn {en}
+\prg_new_conditional:Npnn \__hyp_ref_if_exist:nn #1#2 { p , T , TF }  % #1 #2 %label/attribute
+  {
+    \tl_if_exist:cTF { g__ref_label_ \tl_to_str:n {#1} _ \tl_to_str:n {#2} _tl }
       {
-        \zref at labelbyprops{\tl_to_str:n {#1}}{#2}
+        \prg_return_true:
       }
-    \cs_generate_variant:Nn \__hyp_ref_label:nn {en}
-    \cs_new_protected:Npn \__hyp_ref_check:nn #1 #2
-     {
-       \zref at refused {\exp_not:n{#1}}
-     }
-   \cs_generate_variant:Nn \__hyp_ref_check:nn {en}
-   \prg_new_conditional:Npnn \__hyp_ref_if_exist:nn #1#2 { p , T , TF }  % #1 #2 %label/attribute
       {
-        \zref at ifrefundefined{\tl_to_str:n {#1}}
-         {\prg_return_false:}
-         {
-           \zref at ifrefcontainsprop{\tl_to_str:n {#1}}{\tl_to_str:n {#2}}
-            {
-              \prg_return_true:
-            }
-            {
-              \prg_return_false:
-            }
-         }
+        \prg_return_false:
       }
-   \prg_generate_conditional_variant:Nnn \__hyp_ref_if_exist:nn  {en} { p , T , TF }
-   \cs_new:Npn \__hyp_ref_value:nn #1 #2
-     {
-       \zref at extract{\tl_to_str:n {#1}}{\tl_to_str:n {#2}}
-     }
-   \cs_generate_variant:Nn \__hyp_ref_value:nn {en}
+  }
+\prg_generate_conditional_variant:Nnn \__hyp_ref_if_exist:nn  {en} { p , T , TF }
+\cs_new:Npn \__hyp_ref_value:nn #1 #2
+ {
+    \ref_value:nn{#1}{#2}
  }
+\cs_generate_variant:Nn \__hyp_ref_value:nn {en}
+
 %% messages, should later (with more drivers) go somewhere more generic ...
 \prop_gput:Nnn \g_msg_module_name_prop { hyp }{ hyperref }
 
 \cs_new:Npn \__hyp_clist_display:n #1 {*~#1\\}
-\msg_new:nnn
-  { hyp }
-  { missing-resource-management }
-  { The~resource~management~is~required~for~this~hyperref~driver! }
-
-\bool_lazy_and:nnF
-  { \cs_if_exist_p:N \pdfmanagement_if_active_p: }{ \pdfmanagement_if_active_p: }
-  { \msg_error:nn { hyp}{ missing-resource-management}}
 
 \msg_new:nnn
   { hyp }
diff --git a/l3backend-pdf-extra.dtx b/l3backend-pdf-extra.dtx
index ed24620..4b2d4f6 100644
--- a/l3backend-pdf-extra.dtx
+++ b/l3backend-pdf-extra.dtx
@@ -55,42 +55,28 @@
 % \begin{implementation}
 %
 % \section{\pkg{l3backend-pdf-extra} Implementation}
-% \subsection{some zref/xref code, needs to be replaced later}
-% If l3xref exists we use, else we fall back to zref.
+% \subsection{Crossreferences}
+% This uses the temporary l3ref-tmp.sty. It will
+% will be replaced by kernel code later.
 % It is only need to get a reference for the absolute page counter.
 % This uses the counter from the
 % new lthooks/ltshipout package.
 %    \begin{macrocode}
 %<@@=pdf>
 %<*drivers>
-\IfFileExists{l3xref.sty}
- { \@firstoftwo }{ \@secondoftwo }%
- {%
-   \RequirePackage{l3xref}
-   \cs_generate_variant:Nn \xref_label:nn {en}
-   \cs_generate_variant:Nn \xref_value:nn {en}
-   \cs_new_protected:Npn \@@_backend_ref_label:nn #1 #2
-     {
-        \@bsphack
-        \xref_label:nn{#1}{abspage}
-        \@esphack
-     }
-   \cs_new:Npn \@@_backend_ref_value:nn #1 #2
-     {
-        \xref_value:nn{#1}{#2}
-     }
- }
- {
-   \RequirePackage{zref-abspage}
-   \cs_new_protected:Npn \@@_backend_ref_label:nn #1 #2
-     {
-         \zref at labelbyprops {\tl_to_str:n {#1}} {#2}
-     }
-    \cs_new:Npn \@@_backend_ref_value:nn #1 #2
-     {
-        \zref at extract {\tl_to_str:n {#1}}{\tl_to_str:n {#2}}
-     }
- }
+\RequirePackage{l3ref-tmp}
+\cs_generate_variant:Nn \ref_label:nn {en}
+\cs_generate_variant:Nn \ref_value:nn {en}
+\cs_new_protected:Npn \@@_backend_ref_label:nn #1 #2
+  {
+     \@bsphack
+     \ref_label:nn{#1}{abspage}
+     \@esphack
+  }
+\cs_new:Npn \@@_backend_ref_value:nn #1 #2
+  {
+     \ref_value:nn{#1}{#2}
+  }
 \cs_generate_variant:Nn \@@_backend_ref_label:nn {en}
 \cs_generate_variant:Nn \@@_backend_ref_value:nn {en}
 %</drivers>





More information about the latex3-commits mailing list.