[latex3-commits] [latex3/latex2e] lab-review-01: use hooks with args for addcontentsline (e842d985)

github at latex-project.org github at latex-project.org
Wed May 24 12:05:13 CEST 2023


Repository : https://github.com/latex3/latex2e
On branch  : lab-review-01
Link       : https://github.com/latex3/latex2e/commit/e842d985a9187909978b9dda9e8e2525e0102a12

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

commit e842d985a9187909978b9dda9e8e2525e0102a12
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Wed May 24 12:05:13 2023 +0200

    use hooks with args for addcontentsline


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

e842d985a9187909978b9dda9e8e2525e0102a12
 required/latex-lab/latex-lab-toc-hyperref-changes.dtx |  9 ++++-----
 required/latex-lab/latex-lab-toc-kernel-changes.dtx   | 11 ++++-------
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/required/latex-lab/latex-lab-toc-hyperref-changes.dtx b/required/latex-lab/latex-lab-toc-hyperref-changes.dtx
index 0b532c6a..266fa290 100644
--- a/required/latex-lab/latex-lab-toc-hyperref-changes.dtx
+++ b/required/latex-lab/latex-lab-toc-hyperref-changes.dtx
@@ -136,13 +136,12 @@
              } % none
            }
        }
-    \AddToHook{cmd/addcontentsline/before}[hyp]
+    \AddToHookWithArguments{cmd/addcontentsline/before}[hyp]
      {%
-       \ExpandArgs{ooo}
        \Hy at addcontentsline@addbookmark
-         {\addcontentsline at arg@one}
-         {\addcontentsline at arg@two}
-         {\addcontentsline at arg@three}%
+         {#1}
+         {#2}
+         {#3}%
      }   
    }    
 \ExplSyntaxOff
diff --git a/required/latex-lab/latex-lab-toc-kernel-changes.dtx b/required/latex-lab/latex-lab-toc-kernel-changes.dtx
index 3a46b453..a4abb060 100644
--- a/required/latex-lab/latex-lab-toc-kernel-changes.dtx
+++ b/required/latex-lab/latex-lab-toc-kernel-changes.dtx
@@ -181,15 +181,12 @@
 % \cs{addcontentsline} should always write the unique counter representation
 % \cs{@currentHref} so that we can create the |/Ref| key. At the same time
 % we need a hook, so that hyperref can add its bookmarks code. The generic hook
-% would be ok, but we need the arguments, so we store them first.
+% is ok. We only declare it and add until the merge.
 %
 %    \begin{macrocode}
-\NewHook{cmd/addcontentsline/before}
-\def\addcontentsline#1#2#3{% toc extension, type, tag
-    \def\addcontentsline at arg@one{#1}% name??
-    \def\addcontentsline at arg@two{#2}%
-    \def\addcontentsline at arg@three{#3}%
-    \UseHook{cmd/addcontentsline/before}%
+\NewHookWithArguments{cmd/addcontentsline/before}{3}
+\def\addcontentsline#1#2#3{% #1=toc extension, #2= heading type, tag
+    \UseHookWithArguments{cmd/addcontentsline/before}{3}{#1}{#2}{#3}%
     \addtocontents{#1}{%
       \protect\contentsline{#2}{#3}{\thepage}{\@currentHref}\protected at file@percent
     }}





More information about the latex3-commits mailing list.