[latex3-commits] [git/LaTeX3-latex3-latex3] master: Add \tl_(g)set_from_shell:Nnn (2a99641)

Unknown joseph.wright at morningstar2.co.uk
Mon Jul 23 14:28:39 CEST 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/2a996418e1604eda5dd7121c8ebbd35d7d31dbcc

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

commit 2a996418e1604eda5dd7121c8ebbd35d7d31dbcc
Author: Unknown <joseph.wright at morningstar2.co.uk>
Date:   Mon Jul 23 13:28:39 2018 +0100

    Add \tl_(g)set_from_shell:Nnn


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

2a996418e1604eda5dd7121c8ebbd35d7d31dbcc
 l3kernel/CHANGELOG.md                   |    1 +
 l3kernel/l3candidates.dtx               |   50 ++++++++++++++++++++++++++++++-
 l3kernel/testfiles/m3expl001.luatex.tlg |    6 ++++
 l3kernel/testfiles/m3expl001.ptex.tlg   |    6 ++++
 l3kernel/testfiles/m3expl001.tlg        |    6 ++++
 l3kernel/testfiles/m3expl001.uptex.tlg  |    6 ++++
 l3kernel/testfiles/m3expl001.xetex.tlg  |    6 ++++
 l3kernel/testfiles/m3expl003.luatex.tlg |    6 ++++
 l3kernel/testfiles/m3expl003.ptex.tlg   |    6 ++++
 l3kernel/testfiles/m3expl003.tlg        |    6 ++++
 l3kernel/testfiles/m3expl003.uptex.tlg  |    6 ++++
 l3kernel/testfiles/m3expl003.xetex.tlg  |    6 ++++
 12 files changed, 110 insertions(+), 1 deletion(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 4e3435a..39f2b91 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -10,6 +10,7 @@ this project uses date-based 'snapshot' version identifiers.
 ## Added
 - `\lua_escape:e`, `\lua_now:e` and `\lua_shipout_e:n`
 - `\str_case_e:nn(TF)` and `\str_if_eq:ee(TF)`
+- `\tl_(g)}set_from_shell:Nnn`
 
 ## Deprecated
 - `\lua_escape_x:n`, `\lua_now_x:n` and `\lua_shipout_x:n`
diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index bfd7182..a9ec173 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -1212,6 +1212,21 @@
 %   argument.
 % \end{function}
 %
+% \begin{function}[added = 2018-07-23]
+%   {
+%     \tl_set_from_shell:Nnn,  \tl_set_from_file:cnn,
+%     \tl_gset_from_shell:Nnn, \tl_gset_from_shell:cnn
+%   }
+%   \begin{syntax}
+%     \cs{tl_set_from_shell:Nnn} \meta{tl~var} \Arg{setup} \Arg{shell~command}
+%   \end{syntax}
+%   Defines \meta{tl} to the text returned by the \meta{shell command}.
+%   Category codes may need to be set appropriately via the \meta{setup}
+%   argument. If shell escape is disabled, the \meta{tl~var} will be empty.
+%   Note that quote characters (|"|) \emph{cannot} be used inside the
+%   \meta{shell command}.
+% \end{function}
+%
 % \begin{function}[EXP, added = 2016-12-06]
 %   {\tl_rand_item:N, \tl_rand_item:c, \tl_rand_item:n}
 %   \begin{syntax}
@@ -3131,8 +3146,41 @@
 %    \end{macrocode}
 % \end{variable}
 %
-%    \begin{macrocode}
+% \begin{macro}
+%   {
+%     \tl_set_from_shell:Nnn, \tl_set_from_shell:cnn,
+%     \tl_gset_from_shell:Nnn, \tl_gset_from_shell:cnn
+%   }
+% \begin{macro}{\@@_set_from_shell:NNnn}
+%   Setting using a shell is at this level just a slightly specialised file
+%   operation.
+%    \begin{macrocode}
+\cs_new_protected:Npn \tl_set_from_shell:Nnn
+  { \@@_set_from_shell:NNnn \tl_set:Nn }
+\cs_generate_variant:Nn \tl_set_from_shell:Nnn { c }
+\cs_new_protected:Npn \tl_gset_from_shell:Nnn
+  { \@@_set_from_shell:NNnn \tl_gset:Nn }
+\cs_generate_variant:Nn \tl_gset_from_shell:Nnn { c }
+\cs_new_protected:Npn \@@_set_from_shell:NNnn #1#2#3#4
+  {
+    \sys_if_shell:TF
+      {
+        \tl_set:Nn \l_@@_internal_a_tl {#4}
+        \tl_if_in:NnTF \l_@@_internal_a_tl { " }
+          {
+            \__kernel_msg_error:nnx
+              { kernel } { quote-in-shell } {#4}
+          }
+          { \@@_set_from:nNNn { | " #4 " } #1 #2 {#3} }
+      }
+      { #1 #2 { } }
+  }
+\__kernel_msg_new:nnnn { kernel } { quote-in-shell }
+  { Quotes~in~shell~command~'#1'. }
+  { Shell~commands~cannot~contain~quotes~("). }
 %    \end{macrocode}
+% \end{macro}
+% \end{macro}
 %
 % \subsubsection{Unicode case changing}
 %
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 5614f13..80a8705 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -5866,6 +5866,12 @@ Defining \tl_gset_from_file_x:cnn on line ...
 Defining \__tl_set_from_file_x:NNnn on line ...
 Defining \__tl_set_from_x:nNNn on line ...
 Defining \l__tl_file_name_str on line ...
+Defining \tl_set_from_shell:Nnn on line ...
+Defining \tl_set_from_shell:cnn on line ...
+Defining \tl_gset_from_shell:Nnn on line ...
+Defining \tl_gset_from_shell:cnn on line ...
+Defining \__tl_set_from_shell:NNnn on line ...
+Defining message LaTeX/kernel/quote-in-shell on line ...
 Defining \char_lower_case:N on line ...
 Defining \char_upper_case:N on line ...
 Defining \char_mixed_case:N on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 27a94ab..834f494 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -5900,6 +5900,12 @@ Defining \tl_gset_from_file_x:cnn on line ...
 Defining \__tl_set_from_file_x:NNnn on line ...
 Defining \__tl_set_from_x:nNNn on line ...
 Defining \l__tl_file_name_str on line ...
+Defining \tl_set_from_shell:Nnn on line ...
+Defining \tl_set_from_shell:cnn on line ...
+Defining \tl_gset_from_shell:Nnn on line ...
+Defining \tl_gset_from_shell:cnn on line ...
+Defining \__tl_set_from_shell:NNnn on line ...
+Defining message LaTeX/kernel/quote-in-shell on line ...
 Defining \char_lower_case:N on line ...
 Defining \char_upper_case:N on line ...
 Defining \char_mixed_case:N on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index 3d075d5..2a59028 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -5900,6 +5900,12 @@ Defining \tl_gset_from_file_x:cnn on line ...
 Defining \__tl_set_from_file_x:NNnn on line ...
 Defining \__tl_set_from_x:nNNn on line ...
 Defining \l__tl_file_name_str on line ...
+Defining \tl_set_from_shell:Nnn on line ...
+Defining \tl_set_from_shell:cnn on line ...
+Defining \tl_gset_from_shell:Nnn on line ...
+Defining \tl_gset_from_shell:cnn on line ...
+Defining \__tl_set_from_shell:NNnn on line ...
+Defining message LaTeX/kernel/quote-in-shell on line ...
 Defining \char_lower_case:N on line ...
 Defining \char_upper_case:N on line ...
 Defining \char_mixed_case:N on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 8d0dc04..c9d4b01 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -5897,6 +5897,12 @@ Defining \tl_gset_from_file_x:cnn on line ...
 Defining \__tl_set_from_file_x:NNnn on line ...
 Defining \__tl_set_from_x:nNNn on line ...
 Defining \l__tl_file_name_str on line ...
+Defining \tl_set_from_shell:Nnn on line ...
+Defining \tl_set_from_shell:cnn on line ...
+Defining \tl_gset_from_shell:Nnn on line ...
+Defining \tl_gset_from_shell:cnn on line ...
+Defining \__tl_set_from_shell:NNnn on line ...
+Defining message LaTeX/kernel/quote-in-shell on line ...
 Defining \char_lower_case:N on line ...
 Defining \char_upper_case:N on line ...
 Defining \char_mixed_case:N on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 8ea9770..d996e67 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -5870,6 +5870,12 @@ Defining \tl_gset_from_file_x:cnn on line ...
 Defining \__tl_set_from_file_x:NNnn on line ...
 Defining \__tl_set_from_x:nNNn on line ...
 Defining \l__tl_file_name_str on line ...
+Defining \tl_set_from_shell:Nnn on line ...
+Defining \tl_set_from_shell:cnn on line ...
+Defining \tl_gset_from_shell:Nnn on line ...
+Defining \tl_gset_from_shell:cnn on line ...
+Defining \__tl_set_from_shell:NNnn on line ...
+Defining message LaTeX/kernel/quote-in-shell on line ...
 Defining \char_lower_case:N on line ...
 Defining \char_upper_case:N on line ...
 Defining \char_mixed_case:N on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 5614f13..80a8705 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -5866,6 +5866,12 @@ Defining \tl_gset_from_file_x:cnn on line ...
 Defining \__tl_set_from_file_x:NNnn on line ...
 Defining \__tl_set_from_x:nNNn on line ...
 Defining \l__tl_file_name_str on line ...
+Defining \tl_set_from_shell:Nnn on line ...
+Defining \tl_set_from_shell:cnn on line ...
+Defining \tl_gset_from_shell:Nnn on line ...
+Defining \tl_gset_from_shell:cnn on line ...
+Defining \__tl_set_from_shell:NNnn on line ...
+Defining message LaTeX/kernel/quote-in-shell on line ...
 Defining \char_lower_case:N on line ...
 Defining \char_upper_case:N on line ...
 Defining \char_mixed_case:N on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 27a94ab..834f494 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -5900,6 +5900,12 @@ Defining \tl_gset_from_file_x:cnn on line ...
 Defining \__tl_set_from_file_x:NNnn on line ...
 Defining \__tl_set_from_x:nNNn on line ...
 Defining \l__tl_file_name_str on line ...
+Defining \tl_set_from_shell:Nnn on line ...
+Defining \tl_set_from_shell:cnn on line ...
+Defining \tl_gset_from_shell:Nnn on line ...
+Defining \tl_gset_from_shell:cnn on line ...
+Defining \__tl_set_from_shell:NNnn on line ...
+Defining message LaTeX/kernel/quote-in-shell on line ...
 Defining \char_lower_case:N on line ...
 Defining \char_upper_case:N on line ...
 Defining \char_mixed_case:N on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 3d075d5..2a59028 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -5900,6 +5900,12 @@ Defining \tl_gset_from_file_x:cnn on line ...
 Defining \__tl_set_from_file_x:NNnn on line ...
 Defining \__tl_set_from_x:nNNn on line ...
 Defining \l__tl_file_name_str on line ...
+Defining \tl_set_from_shell:Nnn on line ...
+Defining \tl_set_from_shell:cnn on line ...
+Defining \tl_gset_from_shell:Nnn on line ...
+Defining \tl_gset_from_shell:cnn on line ...
+Defining \__tl_set_from_shell:NNnn on line ...
+Defining message LaTeX/kernel/quote-in-shell on line ...
 Defining \char_lower_case:N on line ...
 Defining \char_upper_case:N on line ...
 Defining \char_mixed_case:N on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index 8d0dc04..c9d4b01 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -5897,6 +5897,12 @@ Defining \tl_gset_from_file_x:cnn on line ...
 Defining \__tl_set_from_file_x:NNnn on line ...
 Defining \__tl_set_from_x:nNNn on line ...
 Defining \l__tl_file_name_str on line ...
+Defining \tl_set_from_shell:Nnn on line ...
+Defining \tl_set_from_shell:cnn on line ...
+Defining \tl_gset_from_shell:Nnn on line ...
+Defining \tl_gset_from_shell:cnn on line ...
+Defining \__tl_set_from_shell:NNnn on line ...
+Defining message LaTeX/kernel/quote-in-shell on line ...
 Defining \char_lower_case:N on line ...
 Defining \char_upper_case:N on line ...
 Defining \char_mixed_case:N on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 8ea9770..d996e67 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -5870,6 +5870,12 @@ Defining \tl_gset_from_file_x:cnn on line ...
 Defining \__tl_set_from_file_x:NNnn on line ...
 Defining \__tl_set_from_x:nNNn on line ...
 Defining \l__tl_file_name_str on line ...
+Defining \tl_set_from_shell:Nnn on line ...
+Defining \tl_set_from_shell:cnn on line ...
+Defining \tl_gset_from_shell:Nnn on line ...
+Defining \tl_gset_from_shell:cnn on line ...
+Defining \__tl_set_from_shell:NNnn on line ...
+Defining message LaTeX/kernel/quote-in-shell on line ...
 Defining \char_lower_case:N on line ...
 Defining \char_upper_case:N on line ...
 Defining \char_mixed_case:N on line ...





More information about the latex3-commits mailing list