[latex3-commits] [git/LaTeX3-latex3-latex2e] hotfix/gh441: Use \tl_if_empty:nTF to check for an empty hook (cd9b8f5e)

PhelypeOleinik phelype.oleinik at latex-project.org
Sat Dec 12 19:06:50 CET 2020


Repository : https://github.com/latex3/latex2e
On branch  : hotfix/gh441
Link       : https://github.com/latex3/latex2e/commit/cd9b8f5e0ebe9441afb6569ed0089aea330d5943

>---------------------------------------------------------------

commit cd9b8f5e0ebe9441afb6569ed0089aea330d5943
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Sat Dec 12 15:06:50 2020 -0300

    Use \tl_if_empty:nTF to check for an empty hook


>---------------------------------------------------------------

cd9b8f5e0ebe9441afb6569ed0089aea330d5943
 base/lthooks.dtx                         |  4 +-
 base/testfiles-lthooks/lthooks-010.tlg   | 30 ++---------
 base/testfiles-lthooks/lthooks-013.tlg   |  4 +-
 base/testfiles-lthooks/lthooks-019.tlg   | 20 +------
 base/testfiles-lthooks2/lthooks2-002.tlg | 16 ++----
 base/testfiles-lthooks2/lthooks2-006.tlg | 90 ++++----------------------------
 6 files changed, 22 insertions(+), 142 deletions(-)

diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 9554086c..708eb6ce 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -3405,7 +3405,8 @@
 %    \begin{macrocode}
     \hook_if_exist:nF {#1}
       { \@@_log_line:x { is~not~declared! } }
-    \@@_if_exist:nTF {#1}
+    \hook_if_empty:nTF {#1}
+      { #2 { The~hook~is~empty } }
       {
         \@@_log_line:x { Code~chunks: }
         \prop_if_empty:cTF { g_@@_#1_code_prop }
@@ -3501,7 +3502,6 @@
               }
           }
       }
-      { #2 { The~hook~is~empty. } }
   }
 %    \end{macrocode}
 %
diff --git a/base/testfiles-lthooks/lthooks-010.tlg b/base/testfiles-lthooks/lthooks-010.tlg
index 29fe40b9..b95c948b 100644
--- a/base/testfiles-lthooks/lthooks-010.tlg
+++ b/base/testfiles-lthooks/lthooks-010.tlg
@@ -104,26 +104,10 @@ l. ...\prop_show:c{g__hook_sffamily_code_prop}
 > Execution order (after applying rules):
 >     legacy, bar, baz, foo.
 -> The hook 'enddocument':
-> Code chunks:
->     ---
-> Document-level (top-level) code (executed last):
->     ---
-> Extra code for next invocation:
->     ---
-> Rules:
->     ---
-> Hook code pool empty.
+> The hook is empty.
 --- New hook after begin document ---
 -> The hook 'xxx':
-> Code chunks:
->     ---
-> Document-level (top-level) code (executed last):
->     ---
-> Extra code for next invocation:
->     ---
-> Rules:
->     ---
-> Hook code pool empty.
+> The hook is empty.
 -> The hook 'xxx':
 > Code chunks:
 >     foo -> \typeout {some foo code ...}
@@ -138,12 +122,4 @@ l. ...\prop_show:c{g__hook_sffamily_code_prop}
 some foo code ...
 some code ...
 -> The hook 'xxx':
-> Code chunks:
->     ---
-> Document-level (top-level) code (executed last):
->     ---
-> Extra code for next invocation:
->     ---
-> Rules:
->     ---
-> Hook code pool empty.
+> The hook is empty.
diff --git a/base/testfiles-lthooks/lthooks-013.tlg b/base/testfiles-lthooks/lthooks-013.tlg
index 8ebd74c9..6f00775d 100644
--- a/base/testfiles-lthooks/lthooks-013.tlg
+++ b/base/testfiles-lthooks/lthooks-013.tlg
@@ -49,12 +49,12 @@ Update code for hook 'file/foo' on input line ...:
 Update code for hook 'env/itemize/began' on input line ...:
 -> The hook 'env/itemize/began':
 > is not declared!
-> The hook is empty..
+> The hook is empty.
 **** Add to undeclared hook baz (top-level) on input line ... <- missing decl
 Update code for hook 'bar' on input line ...:
 -> The hook 'bar':
 > is not declared!
-> The hook is empty..
+> The hook is empty.
 Update code for hook 'begindocument' on input line ...:
 Update code for hook 'begindocument/before' on input line ...:
 Update code for hook 'begindocument/end' on input line ...:
diff --git a/base/testfiles-lthooks/lthooks-019.tlg b/base/testfiles-lthooks/lthooks-019.tlg
index 98c8bcc0..1384077f 100644
--- a/base/testfiles-lthooks/lthooks-019.tlg
+++ b/base/testfiles-lthooks/lthooks-019.tlg
@@ -321,26 +321,10 @@ Handled code for zz3
 >     zz3, zz4, zz2, zz1.
 Update code for hook 'Start' on input line ...:
 -> The hook 'Start':
-> Code chunks:
->     ---
-> Document-level (top-level) code (executed last):
->     ---
-> Extra code for next invocation:
->     ---
-> Rules:
->     ---
-> Hook code pool empty.
+> The hook is empty.
 Update code for hook 'Stop' on input line ...:
 -> The hook 'Stop':
-> Code chunks:
->     ---
-> Document-level (top-level) code (executed first):
->     ---
-> Extra code for next invocation:
->     ---
-> Rules:
->     ---
-> Hook code pool empty.
+> The hook is empty.
 **** Add to hook Start (one) on input line ... <- \typeout {begin A}
 **** Add to hook Start (one) on input line ... <- \typeout {begin B}
 **** Add to hook Start (one) on input line ... <- \typeout {begin C}
diff --git a/base/testfiles-lthooks2/lthooks2-002.tlg b/base/testfiles-lthooks2/lthooks2-002.tlg
index 2b570162..35bf3ea2 100644
--- a/base/testfiles-lthooks2/lthooks2-002.tlg
+++ b/base/testfiles-lthooks2/lthooks2-002.tlg
@@ -7,15 +7,7 @@ Package: etoolbox ....-..-.. v... e-TeX tools for LaTeX (JAW)
 **** Add to hook enddocument/end (top-level) on input line ... <- \typeout {in preamble}
 Update code for hook 'begindocument' on input line ...:
 -> The hook 'begindocument':
-> Code chunks:
->     ---
-> Document-level (top-level) code:
->     ---
-> Extra code for next invocation:
->     ---
-> Rules:
->     ---
-> Hook code pool empty.
+> The hook is empty.
 Update code for hook 'begindocument' on input line ...:
 Update code for hook 'begindocument/before' on input line ...:
 Update code for hook 'begindocument/end' on input line ...:
@@ -100,11 +92,11 @@ LaTeX Font Info:    ... okay on input line ....
 **** Add to hook enddocument/end (top-level) on input line ... <- \typeout {after preamble}
 Update code for hook 'enddocument/end' on input line ...:
 -> The hook 'enddocument':
-> The hook is empty..
+> The hook is empty.
 -> The hook 'enddocument/afterlastpage':
-> The hook is empty..
+> The hook is empty.
 -> The hook 'enddocument/afteraux':
-> The hook is empty..
+> The hook is empty.
 -> The hook 'enddocument/info':
 > Code chunks:
 >     kernel/filelist -> \@dofilelist 
diff --git a/base/testfiles-lthooks2/lthooks2-006.tlg b/base/testfiles-lthooks2/lthooks2-006.tlg
index 61098e4c..de054abf 100644
--- a/base/testfiles-lthooks2/lthooks2-006.tlg
+++ b/base/testfiles-lthooks2/lthooks2-006.tlg
@@ -29,15 +29,7 @@ Adding a rule:
 -------------------
 Now there are no code chunks:
 -> The hook 'some-hook-a':
-> Code chunks:
->     ---
-> Document-level (top-level) code:
->     ---
-> Extra code for next invocation:
->     ---
-> Rules:
->     ---
-> Hook code pool empty.
+> The hook is empty.
 -------------------
 my-package added CODE:
 -> The hook 'some-hook-b':
@@ -54,99 +46,35 @@ my-package added CODE:
 -------------------
 Adding a rule:
 -> The hook 'some-hook-a':
-> Code chunks:
->     ---
-> Document-level (top-level) code:
->     ---
-> Extra code for next invocation:
->     ---
-> Rules:
->     ---
-> Hook code pool empty.
+> The hook is empty.
 -------------------
 Now there are no code chunks:
 -> The hook 'some-hook-b':
 > is not declared!
-> Code chunks:
->     ---
-> Document-level (top-level) code:
->     ---
-> Extra code for next invocation:
->     ---
-> Rules:
->     ---
-> Hook not declared.
+> The hook is empty.
 -------------------
 No code:
 -> The hook 'some-hook-a':
-> Code chunks:
->     ---
-> Document-level (top-level) code:
->     ---
-> Extra code for next invocation:
->     ---
-> Rules:
->     ---
-> Hook code pool empty.
+> The hook is empty.
 -------------------
 Adding a rule:
 -> The hook 'some-hook-a':
-> Code chunks:
->     ---
-> Document-level (top-level) code:
->     ---
-> Extra code for next invocation:
->     ---
-> Rules:
->     ---
-> Hook code pool empty.
+> The hook is empty.
 -------------------
 Still no code:
 -> The hook 'some-hook-a':
-> Code chunks:
->     ---
-> Document-level (top-level) code:
->     ---
-> Extra code for next invocation:
->     ---
-> Rules:
->     ---
-> Hook code pool empty.
+> The hook is empty.
 -------------------
 No code:
 -> The hook 'some-hook-b':
 > is not declared!
-> Code chunks:
->     ---
-> Document-level (top-level) code:
->     ---
-> Extra code for next invocation:
->     ---
-> Rules:
->     ---
-> Hook not declared.
+> The hook is empty.
 -------------------
 Adding a rule:
 -> The hook 'some-hook-a':
-> Code chunks:
->     ---
-> Document-level (top-level) code:
->     ---
-> Extra code for next invocation:
->     ---
-> Rules:
->     ---
-> Hook code pool empty.
+> The hook is empty.
 -------------------
 Still no code:
 -> The hook 'some-hook-b':
 > is not declared!
-> Code chunks:
->     ---
-> Document-level (top-level) code:
->     ---
-> Extra code for next invocation:
->     ---
-> Rules:
->     ---
-> Hook not declared.
+> The hook is empty.





More information about the latex3-commits mailing list.