[latex3-commits] [git/LaTeX3-latex3-latex2e] ltcmdhooks: add .lvt for the examples used in the documentation (564426e5)

Frank Mittelbach frank.mittelbach at latex-project.org
Mon Apr 19 11:20:58 CEST 2021


Repository : https://github.com/latex3/latex2e
On branch  : ltcmdhooks
Link       : https://github.com/latex3/latex2e/commit/564426e5a855a79c4bba6cd1e8593081d8a800a8

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

commit 564426e5a855a79c4bba6cd1e8593081d8a800a8
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Mon Apr 19 11:20:58 2021 +0200

    add .lvt for the examples used in the documentation


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

564426e5a855a79c4bba6cd1e8593081d8a800a8
 base/testfiles-lthooks/lthooks-doc-examples.lvt |  56 +++++++++++
 base/testfiles-lthooks/lthooks-doc-examples.tlg | 119 ++++++++++++++++++++++++
 base/update-lthooks-tests.sh                    |   1 +
 3 files changed, 176 insertions(+)

diff --git a/base/testfiles-lthooks/lthooks-doc-examples.lvt b/base/testfiles-lthooks/lthooks-doc-examples.lvt
new file mode 100644
index 00000000..759b37fd
--- /dev/null
+++ b/base/testfiles-lthooks/lthooks-doc-examples.lvt
@@ -0,0 +1,56 @@
+% for getting the examples in the code really ...
+
+\RequirePackage[enable-debug]{expl3}
+\ExplSyntaxOn
+\debug_on:n { check-declarations , deprecation }
+\ExplSyntaxOff
+
+\documentclass{article}
+
+\input{regression-test}
+
+\DebugHooksOn
+
+\START
+
+\NewHook{example-hook}
+\AddToHook{example-hook}{[code from 'top-level']}
+\AddToHook{example-hook}[foo]{[code from package 'foo']}
+\AddToHook{example-hook}[bar]{[from package 'bar']}
+\AddToHook{example-hook}[baz]{[package 'baz' is here]}
+\AddToHookNext{example-hook}{[one-time code]}
+\DeclareHookRule{example-hook}{baz}{before}{foo}
+\DeclareDefaultHookRule{bar}{after}{baz}
+\ShowHook{example-hook}
+
+
+\typeout{============================================}
+
+\NewHook{myhook}
+\AddToHook{myhook}[packageA]{\typeout{A}}
+\AddToHook{myhook}[packageB]{\typeout{B}}
+\AddToHook{myhook}[packageC]{\typeout{C}}
+\ShowHook{myhook}
+
+
+\typeout{============================================}
+
+\DeclareHookRule{myhook}{packageA}{before}{packageB}
+\ShowHook{myhook}
+
+
+\typeout{============================================}
+
+\AddToHook{env/quote/before}[package-1]{\begin{itshape}}
+\AddToHook{env/quote/after} [package-1]{\end{itshape}}
+\AddToHook{env/quote/before}[package-too]{\begin{color}{blue}}
+\AddToHook{env/quote/after} [package-too]{\end{color}}
+\ShowHook{env/quote/after}
+
+
+\typeout{============================================}
+
+
+\typeout{!!!! If this test changes the documentation needs updating !!!!}
+
+\END
diff --git a/base/testfiles-lthooks/lthooks-doc-examples.tlg b/base/testfiles-lthooks/lthooks-doc-examples.tlg
new file mode 100644
index 00000000..fd5b169f
--- /dev/null
+++ b/base/testfiles-lthooks/lthooks-doc-examples.tlg
@@ -0,0 +1,119 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+**** Add to hook example-hook (top-level) on input line ... <- [code from 'top-level']
+**** Add to hook example-hook (foo) on input line ... <- [code from package 'foo']
+**** Add to hook example-hook (bar) on input line ... <- [from package 'bar']
+**** Add to hook example-hook (baz) on input line ... <- [package 'baz' is here]
+Update code for hook 'example-hook' on input line ...:
+  normal rule foo|baz: > found
+ default rule baz|bar: < found
+Code labels for sorting:
+ foo, bar and baz
+Data structure for label rules:
+ foo = 1 -> 
+ bar = 1 -> 
+ baz = 0 -> foo -> bar
+Handled code for baz
+Handled code for foo
+Handled code for bar
+-> The hook 'example-hook':
+> Code chunks:
+>     foo -> [code from package 'foo']
+>     bar -> [from package 'bar']
+>     baz -> [package 'baz' is here]
+> Document-level (top-level) code (executed last):
+>     -> [code from 'top-level']
+> Extra code for next invocation:
+>     -> [one-time code]
+> Rules:
+>     foo|baz with relation >
+>     baz|bar with default relation <
+> Execution order (after applying rules):
+>     baz, foo, bar.
+<recently read> }
+l. ...\ShowHook{example-hook}
+============================================
+**** Add to hook myhook (packageA) on input line ... <- \typeout {A}
+**** Add to hook myhook (packageB) on input line ... <- \typeout {B}
+**** Add to hook myhook (packageC) on input line ... <- \typeout {C}
+Update code for hook 'myhook' on input line ...:
+Code labels for sorting:
+ packageA, packageB and packageC
+Data structure for label rules:
+ packageA = 0 -> 
+ packageB = 0 -> 
+ packageC = 0 -> 
+Handled code for packageA
+Handled code for packageB
+Handled code for packageC
+-> The hook 'myhook':
+> Code chunks:
+>     packageA -> \typeout {A}
+>     packageB -> \typeout {B}
+>     packageC -> \typeout {C}
+> Document-level (top-level) code (executed last):
+>     ---
+> Extra code for next invocation:
+>     ---
+> Rules:
+>     ---
+> Execution order:
+>     packageA, packageB, packageC.
+<recently read> }
+l. ...\ShowHook{myhook}
+============================================
+Update code for hook 'myhook' on input line ...:
+  normal rule packageB|packageA: > found
+Code labels for sorting:
+ packageA, packageB and packageC
+Data structure for label rules:
+ packageA = 0 -> packageB
+ packageB = 1 -> 
+ packageC = 0 -> 
+Handled code for packageA
+Handled code for packageC
+Handled code for packageB
+-> The hook 'myhook':
+> Code chunks:
+>     packageA -> \typeout {A}
+>     packageB -> \typeout {B}
+>     packageC -> \typeout {C}
+> Document-level (top-level) code (executed last):
+>     ---
+> Extra code for next invocation:
+>     ---
+> Rules:
+>     packageB|packageA with relation >
+> Execution order (after applying rules):
+>     packageA, packageC, packageB.
+<recently read> }
+l. ...\ShowHook{myhook}
+============================================
+**** Add to hook env/quote/before (package-1) on input line ... <- \begin {itshape}
+**** Add to hook env/quote/after (package-1) on input line ... <- \end {itshape}
+**** Add to hook env/quote/before (package-too) on input line ... <- \begin {color}{blue}
+**** Add to hook env/quote/after (package-too) on input line ... <- \end {color}
+Update code for hook 'env/quote/after' on input line ...:
+Code labels for sorting:
+ package-1 and package-too
+Data structure for label rules:
+ package-1 = 0 -> 
+ package-too = 0 -> 
+Handled code for package-1
+Handled code for package-too
+-> The hook 'env/quote/after':
+> Code chunks:
+>     package-1 -> \end {itshape}
+>     package-too -> \end {color}
+> Document-level (top-level) code (executed first):
+>     ---
+> Extra code for next invocation:
+>     ---
+> Rules:
+>     ---
+> Execution order (after reversal):
+>     package-too, package-1.
+<recently read> }
+l. ...\ShowHook{env/quote/after}
+============================================
+!!!! If this test changes the documentation needs updating !!!!
diff --git a/base/update-lthooks-tests.sh b/base/update-lthooks-tests.sh
index 13a1dd3e..bb1fffdf 100644
--- a/base/update-lthooks-tests.sh
+++ b/base/update-lthooks-tests.sh
@@ -82,6 +82,7 @@ l3build save -cconfig-lthooks \
    lthooks-errors \
    lthooks-etoolbox \
    lthooks-legacy \
+   lthooks-doc-examples \
    shipout-000 \
    shipout-002 \
    shipout-004 \





More information about the latex3-commits mailing list.