[latex3-commits] [git/LaTeX3-latex3-latex3] main: Addd \SetTemplateKeys (d3394d2f7)
Joseph Wright
joseph.wright at morningstar2.co.uk
Mon May 30 14:04:23 CEST 2022
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/d3394d2f78a0697ed6dbf3bdfdff809fa40c315e
>---------------------------------------------------------------
commit d3394d2f78a0697ed6dbf3bdfdff809fa40c315e
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Mon May 30 13:04:23 2022 +0100
Addd \SetTemplateKeys
>---------------------------------------------------------------
d3394d2f78a0697ed6dbf3bdfdff809fa40c315e
l3packages/CHANGELOG.md | 4 +++-
l3packages/xtemplate/xtemplate.dtx | 23 ++++++++++++++++++-----
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/l3packages/CHANGELOG.md b/l3packages/CHANGELOG.md
index ef57aeb7c..fb614b5fb 100644
--- a/l3packages/CHANGELOG.md
+++ b/l3packages/CHANGELOG.md
@@ -7,8 +7,10 @@ this project uses date-based 'snapshot' version identifiers.
## [Unreleased]
+## Added
+- `\SetTemplateKeys` for _ad hoc_ adjustment of template values
+
### Changed
-- Allow for _ad hoc_ adjustment of template values
- Make `\AssignTemplateKeys` optional
### Removed
diff --git a/l3packages/xtemplate/xtemplate.dtx b/l3packages/xtemplate/xtemplate.dtx
index caea60d1c..656506f89 100644
--- a/l3packages/xtemplate/xtemplate.dtx
+++ b/l3packages/xtemplate/xtemplate.dtx
@@ -579,10 +579,15 @@
%
% \section{\emph{Ad hoc} adjustment of templates}
%
-% At point of use it may be useful to apply changed to individual instances.
-% This is supported as each template key is made available for adjustment using
-% the \texttt{keys} module under the path
-% \texttt{template/\meta{object}/\meta{template}}.
+% \begin{function}{\SetTemplateKeys}
+% \begin{syntax}
+% \cs{SetTemplateKeys} \Arg{object type} \Arg{template} \Arg{keyvals}
+% \end{syntax}
+% At point of use it may be useful to apply changed to individual instances.
+% This is supported as each template key is made available for adjustment
+% using \cs{SetTemplateKeys}.
+% \end{function}
+%
% For example, after
% \begin{verbatim}
% \DeclareObjectType{MyObj}{0}
@@ -599,7 +604,7 @@
% \end{verbatim}
% the template keys could be adjusted in an \emph{ad hoc} fashion using
% \begin{verbatim}
-% \keys_set:nn { template / MyObj /TemplateA }
+% \SetTemplateKeys{MyObj}{TemplateA}
% {
% akey = OtherTokens ,
% bkey = \AltFunc:nn
@@ -2886,6 +2891,14 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\SetTemplateKeys}
+% A friendly wrapper
+% \begin{macrocode}
+\cs_new_protected:Npn \SetTemplateKeys #1#2#3
+ { \keys_set:nn { template / #1 / #2 } {#3} }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macrocode}
\cs_new_eq:NN \ShowTemplateKeytypes \ShowTemplateInterface
% \end{macrocode}
More information about the latex3-commits
mailing list.