From 00ce1f873ca68d3d8126c77126e1de7f43a24ef6 Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Tue, 29 Oct 2024 05:19:23 +0800 Subject: [PATCH 1/3] Skip mapping over undeclared `\g__hook__code_prop` (#1513) --- base/changes.txt | 4 ++++ base/lthooks.dtx | 27 ++++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/base/changes.txt b/base/changes.txt index c5708c81a..69d5470e5 100644 --- a/base/changes.txt +++ b/base/changes.txt @@ -6,6 +6,10 @@ to completeness or accuracy and it contains some references to files that are not part of the distribution. ================================================================================ +2024-10-29 Yukai Chou + * lthooks.dtx (subsection{Setting rules for hooks code}): + Skip mapping over undeclared \g__hook__code_prop (gh/1513). + 2024-10-27 Marcel Krüger * lttagging.dtx Change tagging sockets with two arguments to drop the first argument diff --git a/base/lthooks.dtx b/base/lthooks.dtx index c37e01e6a..abf3a9a49 100644 --- a/base/lthooks.dtx +++ b/base/lthooks.dtx @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{lthooks.dtx} - [2024/10/21 v1.1j LaTeX Kernel (hooks)] + [2024/10/29 v1.1k LaTeX Kernel (hooks)] % \iffalse % \documentclass{l3doc} @@ -6174,6 +6174,8 @@ } % \end{macrocode} % +% \changes{v1.1k}{2024/10/29} +% {Skip mapping over undeclared \cs{g_@@_\meta{hook}_code_prop} (gh/1513)} % \begin{macrocode} \@@_if_usable:nF {#1} { \@@_log_line:x { The~hook~is~not~declared. } } @@ -6183,7 +6185,9 @@ { #2 { The~hook~is~empty } } { \@@_log_line:x { Code~chunks: } - \prop_if_empty:cTF { g_@@_#1_code_prop } + \bool_lazy_or:nnTF + { ! \prop_if_exist_p:c { g_@@_#1_code_prop } } + { \prop_if_empty_p:c { g_@@_#1_code_prop } } { \@@_log_line_indent:x { --- } } { \prop_map_inline:cn { g_@@_#1_code_prop } @@ -6445,19 +6449,24 @@ % |#2|${}={}$\meta{label_1}\verb=|=\meta{label_2}, % and |#3|${}={}$\meta{hook} (the latter may be the argument |#1| to % \cs{@@_list_rules:nn}, or \texttt{??} if it is a default rule). +% \changes{v1.1k}{2024/10/29} +% {Skip mapping over undeclared \cs{g_@@_\meta{hook}_code_prop} (gh/1513)} % \begin{macrocode} \cs_new_protected:Npn \@@_list_rules:nn #1 #2 { - \cs_set_protected:Npn \@@_tmp:w ##1 ##2 ##3 {#2} - \prop_map_inline:cn { g_@@_#1_code_prop } + \prop_if_exist:cT { g_@@_#1_code_prop } { + \cs_set_protected:Npn \@@_tmp:w ##1 ##2 ##3 {#2} \prop_map_inline:cn { g_@@_#1_code_prop } { - \@@_if_label_case:nnnnn {##1} {####1} - { \prop_map_break: } - { \@@_list_one_rule:nnn {##1} {####1} } - { \@@_list_one_rule:nnn {####1} {##1} } - {#1} + \prop_map_inline:cn { g_@@_#1_code_prop } + { + \@@_if_label_case:nnnnn {##1} {####1} + { \prop_map_break: } + { \@@_list_one_rule:nnn {##1} {####1} } + { \@@_list_one_rule:nnn {####1} {##1} } + {#1} + } } } } From d0b58a278c97e48dd1e524636ce78520be1669ca Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Tue, 29 Oct 2024 05:29:43 +0800 Subject: [PATCH 2/3] add test github-1513 --- base/testfiles-lthooks/github-1513.lvt | 17 +++++++++++++++++ base/testfiles-lthooks/github-1513.tlg | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 base/testfiles-lthooks/github-1513.lvt create mode 100644 base/testfiles-lthooks/github-1513.tlg diff --git a/base/testfiles-lthooks/github-1513.lvt b/base/testfiles-lthooks/github-1513.lvt new file mode 100644 index 000000000..56ae0a28e --- /dev/null +++ b/base/testfiles-lthooks/github-1513.lvt @@ -0,0 +1,17 @@ + +\ExplSyntaxOn +\debug_on:n { check-declarations , deprecation } +\ExplSyntaxOff + +\documentclass{article} + +\input{regression-test} + + +\usepackage{amsmath} + +\START + +\ShowHook{package/amsmath/after} + +\END diff --git a/base/testfiles-lthooks/github-1513.tlg b/base/testfiles-lthooks/github-1513.tlg new file mode 100644 index 000000000..e2233e322 --- /dev/null +++ b/base/testfiles-lthooks/github-1513.tlg @@ -0,0 +1,16 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +-> The generic hook 'package/amsmath/after': +> The hook is not declared. +> Code chunks: +> --- +> Document-level (top-level) code: +> --- +> Extra code for next invocation: +> -> +> Rules: +> --- +> Execution order: +> Not set because the hook is undeclared. + } +l. ...\ShowHook{package/amsmath/after} From 82bd1a272c25768f460fbe862dd8bdcde3fc2648 Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Tue, 29 Oct 2024 06:27:28 +0800 Subject: [PATCH 3/3] switch to a package available to CI --- base/testfiles-lthooks/github-1513.lvt | 4 ++-- base/testfiles-lthooks/github-1513.tlg | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/base/testfiles-lthooks/github-1513.lvt b/base/testfiles-lthooks/github-1513.lvt index 56ae0a28e..095c92934 100644 --- a/base/testfiles-lthooks/github-1513.lvt +++ b/base/testfiles-lthooks/github-1513.lvt @@ -8,10 +8,10 @@ \input{regression-test} -\usepackage{amsmath} +\usepackage{tracefnt} \START -\ShowHook{package/amsmath/after} +\ShowHook{package/tracefnt/after} \END diff --git a/base/testfiles-lthooks/github-1513.tlg b/base/testfiles-lthooks/github-1513.tlg index e2233e322..f9223ccc7 100644 --- a/base/testfiles-lthooks/github-1513.tlg +++ b/base/testfiles-lthooks/github-1513.tlg @@ -1,6 +1,6 @@ This is a generated file for the l3build validation system. Don't change this file in any respect. --> The generic hook 'package/amsmath/after': +-> The generic hook 'package/tracefnt/after': > The hook is not declared. > Code chunks: > --- @@ -13,4 +13,4 @@ Don't change this file in any respect. > Execution order: > Not set because the hook is undeclared. } -l. ...\ShowHook{package/amsmath/after} +l. ...\ShowHook{package/tracefnt/after}