[latex3-commits] [git/LaTeX3-latex3-latex3] main: Reset bool after restricting templates (fixes #1155) (0e1520637)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Dec 13 13:56:14 CET 2022


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/0e15206371ea462e2f659c783b9109343c232bac

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

commit 0e15206371ea462e2f659c783b9109343c232bac
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Dec 13 12:56:14 2022 +0000

    Reset bool after restricting templates (fixes #1155)


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

0e15206371ea462e2f659c783b9109343c232bac
 l3packages/CHANGELOG.md                         |  4 ++
 l3packages/xtemplate/testfiles/xtemplate006.lvt | 52 +++++++++++++++++++++++++
 l3packages/xtemplate/testfiles/xtemplate006.tlg | 28 +++++++++++++
 l3packages/xtemplate/xtemplate.dtx              |  3 +-
 4 files changed, 86 insertions(+), 1 deletion(-)

diff --git a/l3packages/CHANGELOG.md b/l3packages/CHANGELOG.md
index 4c063d13b..9626748d8 100644
--- a/l3packages/CHANGELOG.md
+++ b/l3packages/CHANGELOG.md
@@ -7,6 +7,10 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Fixed
+- Template editing following restricted template setting
+  (issue [\#1155](https://github.com/latex3/latex3/issues/1155))
+
 ## [2022-06-22]
 
 ### Changed
diff --git a/l3packages/xtemplate/testfiles/xtemplate006.lvt b/l3packages/xtemplate/testfiles/xtemplate006.lvt
new file mode 100644
index 000000000..2a6627a09
--- /dev/null
+++ b/l3packages/xtemplate/testfiles/xtemplate006.lvt
@@ -0,0 +1,52 @@
+%
+% Copyright (C) 2022 LaTeX Project
+%
+
+\documentclass{minimal}
+\input{regression-test}
+\RequirePackage[enable-debug]{expl3}
+\ExplSyntaxOn
+\debug_on:n { check-declarations , deprecation , log-functions }
+\ExplSyntaxOff
+\RequirePackage{xtemplate}
+
+\begin{document}
+\START
+\AUTHOR{Joseph Wright}
+
+\ExplSyntaxOn
+
+\OMIT
+  \DeclareObjectType { word } { 2 }
+  \DeclareTemplateInterface { word } { ONE } { 2 }
+    { 
+      x : tokenlist = X,
+      y : tokenlist
+     }
+  \DeclareTemplateCode { word } { ONE } { 2 }
+    { 
+      x = global \g_x_tl ,
+      y = global \g_y_tl
+    }
+    { 
+      \AssignTemplateKeys 
+      \tl_show:N \g_x_tl
+      \tl_show:N \g_y_tl
+    }
+  \DeclareRestrictedTemplate { word } { ONE } { TWO } { x = A }
+  \DeclareInstance { word } { one } { ONE } { y = Y}
+\TIMO
+\ExplSyntaxOff
+
+\UseInstance{word}{one} \rightarrow , 
+
+\EditInstance{word}{one}{y=Z}
+\UseInstance{word}{one}\Rightarrow {??}
+
+\DeclareInstance{word}{two}{TWO}{y=B}
+\UseInstance{word}{two}\rightarrow ,
+
+\EditInstance{word}{two}{y=C}
+\UseInstance{word}{two}\Rightarrow {??}
+
+\END
diff --git a/l3packages/xtemplate/testfiles/xtemplate006.tlg b/l3packages/xtemplate/testfiles/xtemplate006.tlg
new file mode 100644
index 000000000..c058ed1b8
--- /dev/null
+++ b/l3packages/xtemplate/testfiles/xtemplate006.tlg
@@ -0,0 +1,28 @@
+This is a generated file for the LaTeX (2e + expl3) validation system.
+Don't change this file in any respect.
+Author: Joseph Wright
+> \g_x_tl=X.
+<recently read> }
+l. ...\UseInstance{word}{one} \rightarrow ,
+> \g_y_tl=Y.
+<recently read> }
+l. ...\UseInstance{word}{one} \rightarrow ,
+> \g_x_tl=X.
+<recently read> }
+l. ...\UseInstance{word}{one}\Rightarrow {??}
+> \g_y_tl=Z.
+<recently read> }
+l. ...\UseInstance{word}{one}\Rightarrow {??}
+Defining \template values > word//two on line ...
+> \g_x_tl=A.
+<recently read> }
+l. ...\UseInstance{word}{two}\rightarrow ,
+> \g_y_tl=B.
+<recently read> }
+l. ...\UseInstance{word}{two}\rightarrow ,
+> \g_x_tl=A.
+<recently read> }
+l. ...\UseInstance{word}{two}\Rightarrow {??}
+> \g_y_tl=C.
+<recently read> }
+l. ...\UseInstance{word}{two}\Rightarrow {??}
diff --git a/l3packages/xtemplate/xtemplate.dtx b/l3packages/xtemplate/xtemplate.dtx
index afd33bf38..1732d32e1 100644
--- a/l3packages/xtemplate/xtemplate.dtx
+++ b/l3packages/xtemplate/xtemplate.dtx
@@ -5,7 +5,7 @@
 % Copyright (C) 1999 Frank Mittelbach, Chris Rowley, David Carlisle
 %           (C) 2004-2010 Frank Mittelbach, The LaTeX Project
 %           (C) 2011-2022 The LaTeX Project
-%
+%\
 % It may be distributed and/or modified under the conditions of the
 % LaTeX Project Public License (LPPL), either version 1.3c of this
 % license or (at your option) any later version.  The latest version
@@ -1830,6 +1830,7 @@
         \@@_set_template_eq:nn { #1 / #3 } { #1 / #2 }
         \bool_set_true:N \l_@@_restrict_bool
         \@@_edit_defaults_aux:nnn {#1} {#3} {#4}
+        \bool_set_false:N \l_@@_restrict_bool
       }
   }
 %    \end{macrocode}





More information about the latex3-commits mailing list.