[latex3-commits] [git/LaTeX3-latex3-latex2e] gh963: Show 2e environments as environments (8267001d)
PhelypeOleinik
phelype.oleinik at latex-project.org
Mon Nov 28 06:05:58 CET 2022
Repository : https://github.com/latex3/latex2e
On branch : gh963
Link : https://github.com/latex3/latex2e/commit/8267001d296924a7c91873006ccaa827b334bf8f
>---------------------------------------------------------------
commit 8267001d296924a7c91873006ccaa827b334bf8f
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Mon Nov 28 02:05:58 2022 -0300
Show 2e environments as environments
WIP: output is not quite right yet
>---------------------------------------------------------------
8267001d296924a7c91873006ccaa827b334bf8f
base/ltdefns.dtx | 21 ++++++++++++++-------
base/testfiles-ltcmd/github-0963.lvt | 16 ++++------------
base/testfiles-ltcmd/github-0963.tlg | 19 +++++++++++++++++++
3 files changed, 37 insertions(+), 19 deletions(-)
diff --git a/base/ltdefns.dtx b/base/ltdefns.dtx
index 7f3fa140..8d758a44 100644
--- a/base/ltdefns.dtx
+++ b/base/ltdefns.dtx
@@ -1746,13 +1746,20 @@
% \changes{v1.5s}{2022/11/24}{Add \cs{ShowEnvironment}}
% \begin{macrocode}
\def\ShowEnvironment#1{%
- \typeout{Begin code for environment #1:}%
- \nonstopmode
- \ExpandArgs{c}\ShowCommand{#1}%
- \errorstopmode
- \typeout{End code for environment #1:^^J}%
- \ExpandArgs{c}\ShowCommand{end#1}%
-}
+ \expandafter\@show at environment\csname #1\endcsname}
+\long\def\@show at environment#1{%
+ \robust at command@act
+ \@showcommandlisthook#1%
+ \@normal at showenv#1}
+\long\def\@normal at showenv#1{%
+ \typeout{> \string\begin{\@expl at cs@to at str@@N#1}=environment:}%
+ \@normal at showenv@meaning#1%
+ \typeout{> \string\end{\@expl at cs@to at str@@N#1}:}%
+ \expandafter\@normal at showenv@meaning\csname end\@expl at cs@to at str@@N#1\endcsname}
+\def\@normal at showenv@meaning#1{%
+ \edef\reserved at a{%
+ \@expl at cs@argument at spec@@N#1->\@expl at cs@replacement at spec@@N#1}%
+ \showtokens\expandafter\expandafter\expandafter{\expandafter\reserved at a}}
% \end{macrocode}
%
% Now the rollback code.
diff --git a/base/testfiles-ltcmd/github-0963.lvt b/base/testfiles-ltcmd/github-0963.lvt
index d0a55b25..1408275e 100644
--- a/base/testfiles-ltcmd/github-0963.lvt
+++ b/base/testfiles-ltcmd/github-0963.lvt
@@ -47,18 +47,10 @@
\show\group
\show\endgroup
+\typeout{---------- show 2e environment ----}
+\ShowEnvironment{center}
-
-% \stop
-
-% ouch
-
-
-% \ShowCommand\group
-% \ShowCommand\endgroup
-
-% \tracingall\tracinglostchars=3 \errorsropmode
-% \ShowEnvironment{foo}
-% \ShowEnvironment{center}
+\typeout{---------- show l3 environment ----}
+\ShowEnvironment{foo}
\END
diff --git a/base/testfiles-ltcmd/github-0963.tlg b/base/testfiles-ltcmd/github-0963.tlg
index 77016a91..81ae2a1c 100644
--- a/base/testfiles-ltcmd/github-0963.tlg
+++ b/base/testfiles-ltcmd/github-0963.tlg
@@ -71,3 +71,22 @@ or <return> to continue without it.
l. ...\show\group
> \endgroup=\endgroup.
l. ...\show\endgroup
+---------- show 2e environment ----
+> \begin{center}=environment:
+> ->\trivlist \centering \item \relax .
+<recently read> }
+l. ...\ShowEnvironment{center}
+> \end{center}:
+> ->\endtrivlist .
+<recently read> }
+l. ...\ShowEnvironment{center}
+---------- show l3 environment ----
+> \begin{foo}=document environment:
+ #1:m
+->\typeout {start foo #1}.
+<recently read> }
+l. ...\ShowEnvironment{foo}
+> \end{foo}:
+->\typeout {end foo #1}.
+<recently read> }
+l. ...\ShowEnvironment{foo}
More information about the latex3-commits
mailing list.