[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: Add interface for overridden instance keys (baced41c)
Joseph Wright
joseph.wright at morningstar2.co.uk
Thu Mar 10 15:32:12 CET 2022
Repository : https://github.com/latex3/latex2e
On branch : develop
Link : https://github.com/latex3/latex2e/commit/baced41cb257fb4f899e559cb7b018c1473b4d7d
>---------------------------------------------------------------
commit baced41cb257fb4f899e559cb7b018c1473b4d7d
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Tue Mar 8 19:03:59 2022 +0000
Add interface for overridden instance keys
>---------------------------------------------------------------
baced41cb257fb4f899e559cb7b018c1473b4d7d
required/latex-lab/latex-lab-prototype.dtx | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/required/latex-lab/latex-lab-prototype.dtx b/required/latex-lab/latex-lab-prototype.dtx
index b957ff5b..ee971bab 100644
--- a/required/latex-lab/latex-lab-prototype.dtx
+++ b/required/latex-lab/latex-lab-prototype.dtx
@@ -270,15 +270,19 @@
% calls instances directly, and this command should be used internally
% in document-level mark-up.
%
-% \begin{function}{\prototype_use_instance:nn}
+% \begin{function}{\prototype_use_instance:nn, \prototype_use_instance:nnn}
% \begin{syntax}
% \cs{prototype_use_instance:nn}
% ~~\Arg{object type} \Arg{instance} \meta{arguments}
+% \cs{prototype_use_instance:nn}n
+% ~~\Arg{object type} \Arg{instance} \Arg{overrides} \meta{arguments}
% \end{syntax}
% Uses an \meta{instance} of the \meta{object type}, which will require
% \meta{arguments} as determined by the number specified for the
% \meta{object type}. The \meta{instance} must have been declared
-% before it can be used, otherwise an error is raised.
+% before it can be used, otherwise an error is raised. The \texttt{nnn}
+% version allows for local overrides of the instance settings using the
+% additional keyval argument.
% \end{function}
%
% \begin{function}{\prototype_use_template:nnnn}
@@ -460,14 +464,29 @@
% \end{macro}
%
% \begin{macro}{\prototype_use_instance:nn}
+% \begin{macro}{\prototype_use_instance:nnn}
% Recover the values and insert the code.
% \begin{macrocode}
\cs_new_protected:Npn \prototype_use_instance:nn #1#2
+ { \prototype_use_instance:nnn {#1} {#2} { } }
+\cs_new_protected:Npn \prototype_use_instance:nnn #1#2#3
{
\tl_if_exist:cTF { l_@@_instance_ #1 _ #2 _template_tl }
{
\tl_set_eq:Nc \l_@@_assignments_tl
{ l_@@_instance_ #1 _ #2 _pars_tl }
+ \tl_if_blank:nF {#3}
+ {
+ \tl_set:Nx \l_@@_tmp_tl
+ {
+ prototype / #1 /
+ \tl_use:c { l_@@_instance_ #1 _ #2 _template_tl }
+ }
+ \exp_args:NNV \keys_precompile:Nnn
+ \l_@@_tmp_tl \l_@@_tmp_tl {#3}
+ \tl_put_right:NV \l_@@_assignments_tl
+ \l_@@_tmp_tl
+ }
\use:c
{
@@_template_ #1 _
@@ -479,6 +498,7 @@
}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \subsection{Messages}
%
More information about the latex3-commits
mailing list.