[latex3-commits] [git/LaTeX3-latex3-latex2e] prototype: Correct implementation of instances (6db0d509)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Mar 8 17:30:03 CET 2022


Repository : https://github.com/latex3/latex2e
On branch  : prototype
Link       : https://github.com/latex3/latex2e/commit/6db0d50919162f971ede0535a9c56b864393e21c

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

commit 6db0d50919162f971ede0535a9c56b864393e21c
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Mar 8 16:30:03 2022 +0000

    Correct implementation of instances


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

6db0d50919162f971ede0535a9c56b864393e21c
 required/latex-lab/ltprototype.dtx | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/required/latex-lab/ltprototype.dtx b/required/latex-lab/ltprototype.dtx
index 56776152..2c59516d 100644
--- a/required/latex-lab/ltprototype.dtx
+++ b/required/latex-lab/ltprototype.dtx
@@ -236,7 +236,7 @@
 % \begin{function}{\prototype_declare_instance:nnnn}
 %   \begin{syntax}
 %     \cs{prototype_declare_instance:nnnn}
-%     ~~\Arg{object type} \Arg{instance} \Arg{template} \Arg{parameters}
+%     ~~\Arg{object type} \Arg{template} \Arg{instance} \Arg{parameters}
 %   \end{syntax}
 %   This function uses a \meta{template} for an \meta{object type}
 %   to create an \meta{instance}. The \meta{instance} will be set
@@ -250,7 +250,7 @@
 %   template would be a numbered section. The instance declaration might
 %   read:
 %   \begin{verbatim}
-%     \prototype_declare_instance:nnnn { sectioning } { section-num } { basic }
+%     \prototype_declare_instance:nnnn { sectioning } { basic } { section-num }
 %       {
 %         numbered      = true ,
 %         justification = center ,
@@ -434,9 +434,11 @@
   {
     \@@_declare_aux:nnnn {#1} {#2} {#4}
       {
-        \tl_clear_new:c { l_@@_instance_ #1 _ #3 _tl }
-        \tl_set_eq:cN { l_@@_instance_ #1 _ #3 _tl }
+        \tl_clear_new:c { l_@@_instance_ #1 _ #3 _pars_tl }
+        \tl_set_eq:cN { l_@@_instance_ #1 _ #3 _pars_tl }
           \l_@@_assignments_tl
+         \tl_clear_new:c { l_@@_instance_ #1 _ #3 _template_tl }
+         \tl_set:cn { l_@@_instance_ #1 _ #3 _template_tl } {#2}
       }
   }
 \cs_new_protected:Npn \@@_declare_aux:nnnn #1#2#3#4
@@ -462,11 +464,16 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \prototype_use_instance:nn #1#2
   {
-    \tl_if_exist:cTF { l_@@_instance_ #1 _ #2 _tl }
+    \tl_if_exist:cTF { l_@@_instance_ #1 _ #2 _template_tl }
       {
         \tl_set_eq:Nc \l_@@_assignments_tl
-          { l_@@_instance_ #1 _ #2 _tl }
-        \use:c { @@_template_ #1 _ #2 :w }
+          { l_@@_instance_ #1 _ #2 _pars_tl }
+        \use:c
+          {
+            @@_template_ #1 _
+            \tl_use:c { l_@@_instance_ #1 _ #2 _template_tl }
+            :w
+          }
       }
       { \msg_error:nnn { prototype } { unknown-instance } {#1} {#2} }
   }





More information about the latex3-commits mailing list.