[latex3-commits] [git/LaTeX3-latex3-latex2e] hook-args: Guarantee only the required parameters are passed (810b5970)

PhelypeOleinik phelype.oleinik at latex-project.org
Sat Mar 11 03:06:36 CET 2023


Repository : https://github.com/latex3/latex2e
On branch  : hook-args
Link       : https://github.com/latex3/latex2e/commit/810b597010c662ad9468d0ceb6ea75361f447b34

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

commit 810b597010c662ad9468d0ceb6ea75361f447b34
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Wed Mar 8 22:37:27 2023 -0300

    Guarantee only the required parameters are passed


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

810b597010c662ad9468d0ceb6ea75361f447b34
 base/lthooks.dtx | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 04ee670f..f431b50a 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -2594,7 +2594,7 @@
         \exp_args:NNo \exp_args:No \@@_double_hashes:n
           {
             \cs:w @@#1~#2 \exp_last_unbraced:Ne \cs_end:
-              { \@@_braced_parameter:n {#2} }
+              { \@@_braced_cs_parameter:n { @@#1~#2 } }
           }
       }
       {
@@ -2666,6 +2666,23 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_tl_gset_auxi:nnn #1 #2 #3
   { \@@_tl_gset:cn {#3} { #1 #2 } }
+\cs_new:Npn \@@_braced_cs_parameter:n #1
+  {
+    \if_case:w \@@_cs_parameter_count:c {#1} \exp_stop_f:
+    \or: {##1}
+    \or: {##1} {##2}
+    \or: {##1} {##2} {##3}
+    \or: {##1} {##2} {##3} {##4}
+    \or: {##1} {##2} {##3} {##4} {##5}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6} {##7}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8}
+    \or: {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8} {##9}
+    \else:
+      \msg_expandable_error:nnn { latex2e } { should-not-happen }
+        { Invalid~parameter~spec. }
+    \fi:
+  }
 \cs_new:Npn \@@_braced_parameter:n #1
   {
     \exp_last_unbraced:Nf \@@_braced_loop:w





More information about the latex3-commits mailing list.