Skip to content

Commit

Permalink
Add interface for overridden instance keys
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Mar 8, 2022
1 parent d189725 commit dbdd041
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions required/latex-lab/latex-lab-prototype.dtx
Expand Up @@ -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}
Expand Down Expand Up @@ -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 _
Expand All @@ -479,6 +498,7 @@
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Messages}
%
Expand Down

0 comments on commit dbdd041

Please sign in to comment.