[latex3-commits] [git/LaTeX3-latex3-latex2e] gh569: Showing environments (bc464656)

PhelypeOleinik phelype.oleinik at latex-project.org
Mon Aug 30 05:55:40 CEST 2021


Repository : https://github.com/latex3/latex2e
On branch  : gh569
Link       : https://github.com/latex3/latex2e/commit/bc46465655820f2713efcfea0a1fc590e11aa35e

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

commit bc46465655820f2713efcfea0a1fc590e11aa35e
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Mon Aug 30 00:55:40 2021 -0300

    Showing environments


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

bc46465655820f2713efcfea0a1fc590e11aa35e
 base/ltcmd.dtx | 37 ++++++++++++++++++++++++++++---------
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/base/ltcmd.dtx b/base/ltcmd.dtx
index 3261cade..b87a612f 100644
--- a/base/ltcmd.dtx
+++ b/base/ltcmd.dtx
@@ -2308,8 +2308,8 @@
         \exp_not:N \@@_cmd_type_cases:NnnnnF \exp_not:N #1
           { \@@_show_command:N }
           { \@@_show_expandable:N }
-          { \@@_show_env:N }
-          { \@@_show_env_end:N }
+          { \@@_show_environment:N }
+          { \@@_show_environment_end:N }
           { \@@_cant_copy:nwn { non-ltcmd } }
             \exp_not:N #1
         \exp_not:N \@@_break_point:n { \cs_to_str:N #1 }
@@ -2325,7 +2325,7 @@
 %     \@@_show_expandable:N,
 %     \@@_show_expandable:NnNNNNnN,
 %     \@@_show_command_aux:nNNn,
-%     \@@_show_env:N,
+%     \@@_show_environment:N,
 %   }
 %   These commands just expand the command once to reveal its innards,
 %   then pass the type of command, the control sequence, the signature,
@@ -2359,12 +2359,31 @@
 %
 %   But complain when used with an environment:
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_show_env:N #1
-  { \msg_error:nn { cmd } { env-show } }
-\cs_new_protected:Npn \@@_show_env_end:N #1
-  { \msg_error:nn { cmd } { env-show } }
-\msg_new:nnn { cmd } { env-show }
-  { Showing~environments~is~not~possible. }
+\cs_new_protected:Npn \@@_show_environment:N #1
+  {
+    \exp_after:wN \@@_show_environment:Nnnw #1 \q_@@
+    \iow_term:x
+      {
+        > ~ \token_to_str:N \end { \cs_to_str:N #1 } : \iow_newline:
+        -> \exp_args:Nc \cs_replacement_spec:N
+          { environment~ \cs_to_str:N #1 ~end~aux~ } .
+      }
+  }
+\cs_new_protected:Npn \@@_show_environment:Nnnw #1 #2 #3 #4 \q_@@
+  {
+    \use:x
+      {
+        \@@_show_command_aux:nNNn { document~environment }
+          { \exp_not:N \begin {#3} }
+          \exp_not:c { environment~ #3 ~ code }
+          {#2}
+      }
+  }
+\cs_new_protected:Npn \@@_show_environment_end:N #1
+  {
+    \exp_args:NNx \@@_check_end:Nn \l_@@_tmpa_tl { \cs_to_str:N #1 }
+    \exp_args:Nc \@@_show_environment:N { \l_@@_tmpa_tl }
+  }
 %    \end{macrocode}
 %
 %   And, of course, add \cs{__kernel_cmd_if_xparse:NTF} and





More information about the latex3-commits mailing list.