Skip to content

Commit

Permalink
Avoid regex if possible checking for \AssignTemplateKeys
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Jan 23, 2025
1 parent adaa21f commit 9e537e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions base/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ not part of the distribution.
Correct catcode of space/tab in v-type arg
Adjust handling of catcodes for letters in v-type arg

2025-01-20 Joseph Wright <[email protected]>
* lttemplates.dtx
Speed up set up of template code

2025-01-15 Joseph Wright <[email protected]>
* ltkeys.dtx
Parse global options only once per package (gh/1619)
Expand Down
12 changes: 10 additions & 2 deletions base/lttemplates.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,7 @@
% \subsection{Implementation part of template declaration}
%
% \begin{macro}{\@@_declare_template_code:nnnnn}
% \changes{2025-01-20}{v1.0e}{Speed up test for \cs{AssignTemplateKeys}}
% \begin{macro}{\@@_declare_template_code:nnnn}
% The main function for implementing a template starts with a couple of
% simple checks to make sure that there are no obvious mistakes: the
Expand All @@ -1450,8 +1451,15 @@
\@@_if_keys_exist:nnT {#1} {#2}
{
\@@_store_key_implementation:nnn {#1} {#2} {#4}
\regex_match:nnTF { \c { AssignTemplateKeys } } {#5}
{ \@@_declare_template_code:nnnn {#1} {#2} {#3} {#5} }
\str_if_in:nnTF {#5} { AssignTemplateKeys }
{
\regex_match:nnTF { \c { AssignTemplateKeys } } {#5}
{ \@@_declare_template_code:nnnn {#1} {#2} {#3} {#5} }
{
\@@_declare_template_code:nnnn
{#1} {#2} {#3} { \AssignTemplateKeys #5 }
}
}
{
\@@_declare_template_code:nnnn
{#1} {#2} {#3} { \AssignTemplateKeys #5 }
Expand Down

0 comments on commit 9e537e1

Please sign in to comment.