[latex3-commits] [latex3/latex2e] gh1092: Support pipes in \input, etc. (fixes #1092) (d5a05799)

github at latex-project.org github at latex-project.org
Fri Jun 16 18:25:58 CEST 2023


Repository : https://github.com/latex3/latex2e
On branch  : gh1092
Link       : https://github.com/latex3/latex2e/commit/d5a057995541eb1c8c3f8fa65d09f4e2af6c3610

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

commit d5a057995541eb1c8c3f8fa65d09f4e2af6c3610
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Jun 16 16:05:37 2023 +0100

    Support pipes in \input, etc. (fixes #1092)


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

d5a057995541eb1c8c3f8fa65d09f4e2af6c3610
 base/changes.txt               |  5 ++++
 base/ltfiles.dtx               | 24 ++++++++++++---
 base/testfiles/github-1092.lvt | 12 ++++++++
 base/testfiles/github-1092.tlg | 67 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 104 insertions(+), 4 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index a8eabd5d..e01f70b7 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -10,6 +10,11 @@ are not part of the distribution.
 All changes above are only part of the development branch for the next release.
 ================================================================================
 
+2023-06-16  Joseph Wright  <Joseph.Wright at latex-project.org>
+
+	* ltfiles.dtx
+	Allow for pipes in \input, etc.
+
 #########################
 # 2023-06-01 Release
 #########################
diff --git a/base/ltfiles.dtx b/base/ltfiles.dtx
index 3bac7ea0..01816dd2 100644
--- a/base/ltfiles.dtx
+++ b/base/ltfiles.dtx
@@ -32,7 +32,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltfiles.dtx}
-             [2023/05/17 v1.2t LaTeX Kernel (File Handling)]
+             [2023/06/16 v1.2u LaTeX Kernel (File Handling)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltfiles.dtx}
@@ -1203,8 +1203,9 @@
 % \changes{v1.2d}{2019/10/26}{quote on openin}
 % \changes{v1.2k}{2021/03/12}{Allow unbalanced conditionals (gh/530)}
 % \changes{v1.2t}{2023/05/15}{Use \pkg{expl3} file existence test}
-% \begin{macro}{\IfFileExists@}
+% \begin{macro}{\IfFileExists@@}
 % \changes{v1.2t}{2023/05/15}{Macro added}
+% \changes{v1.2u}{2023/06/16}{Support piped input}
 % Argument |#1| is |\@curr at file| so catcode 12 string with no quotes.
 %
 %    The original definition picked up arguments |#2| and |#3| in a
@@ -1212,7 +1213,7 @@
 %    implementation would have been not to pick up the arguments at
 %    all but instead use the usual \cs{@firstoftwo} and
 %    \cs{secondoftwo}. However, that changes how |#| is interpreted
-%    and so we can't do that nowaways without invalidating a lot of
+%    and so we can't do that nowadays without invalidating a lot of
 %    code. Therefore the somewhat curious construction near the end.
 %
 %    Earlier versions used |\openin| here, but this led to two
@@ -1251,8 +1252,23 @@
   \expandafter\def\expandafter\reserved at a
     \expandafter{\reserved at a{#2}{#3}}%
 \reserved at a}
+%    \end{macrocode}
+%    Pipes are not really files, but at the document level they are supported.
+%    To quickly trim of any leading spaces, we use a blank test and \cs{use:n}
+%    rather than \cs{tl_trim_spaces:n} for speed as we don't care about the end
+%    of the input.
+%    \begin{macrocode}
 \ExplSyntaxOn
-\cs_new_eq:NN \IfFileExists@@ \file_full_name:n
+\cs_new:Npn \IfFileExists@@ #1
+  {
+    \tl_if_blank:nF {#1}
+      {
+        \tl_if_head_eq_charcode:eNTF { \use:n #1 } |
+          {#1}
+          { \file_full_name:n {#1} }
+      }
+  }
+\cs_generate_variant:Nn \tl_if_head_eq_charcode:nNTF { e }
 \ExplSyntaxOff
 %</2ekernel|latexrelease>
 %<latexrelease>\EndIncludeInRelease
diff --git a/base/testfiles/github-1092.lvt b/base/testfiles/github-1092.lvt
new file mode 100644
index 00000000..afb83078
--- /dev/null
+++ b/base/testfiles/github-1092.lvt
@@ -0,0 +1,12 @@
+\input{test2e}
+\documentclass{article}
+\begin{document}
+\showoutput
+% These are before \START so we avoid engine-dependent .log lines
+\input{|kpsewhich article.cls}
+
+\input{ |kpsewhich article.cls}
+
+\START
+
+\end{document}
\ No newline at end of file
diff --git a/base/testfiles/github-1092.tlg b/base/testfiles/github-1092.tlg
new file mode 100644
index 00000000..94862dcf
--- /dev/null
+++ b/base/testfiles/github-1092.tlg
@@ -0,0 +1,67 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+Completed box being shipped out [1]
+\vbox(633.0+0.0)x407.0
+.\glue 16.0
+.\vbox(617.0+0.0)x345.0, shifted 62.0
+..\vbox(12.0+0.0)x345.0, glue set 12.0fil
+...\glue 0.0 plus 1.0fil
+...\hbox(0.0+0.0)x345.0
+....\hbox(0.0+0.0)x345.0
+..\glue 25.0
+..\glue(\lineskip) 0.0
+..\vbox(550.0+0.0)x345.0, glue set 527.9436fil
+...\write-{}
+...\glue(\topskip) 2.5
+...\hbox(7.5+2.5)x345.0, glue set 277.69437fil
+....\hbox(0.0+0.0)x15.0
+....\OT1/cmr/m/n/10 .
+....\OT1/cmr/m/n/10 /
+....\OT1/cmr/m/n/10 a
+....\OT1/cmr/m/n/10 r
+....\OT1/cmr/m/n/10 t
+....\OT1/cmr/m/n/10 i
+....\OT1/cmr/m/n/10 c
+....\OT1/cmr/m/n/10 l
+....\OT1/cmr/m/n/10 e
+....\OT1/cmr/m/n/10 .
+....\OT1/cmr/m/n/10 c
+....\OT1/cmr/m/n/10 l
+....\OT1/cmr/m/n/10 s
+....\glue 3.33333 plus 1.66666 minus 1.11111
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\parskip) 0.0
+...\glue(\baselineskip) 2.0
+...\hbox(7.5+2.5)x345.0, glue set 277.69437fil
+....\hbox(0.0+0.0)x15.0
+....\OT1/cmr/m/n/10 .
+....\OT1/cmr/m/n/10 /
+....\OT1/cmr/m/n/10 a
+....\OT1/cmr/m/n/10 r
+....\OT1/cmr/m/n/10 t
+....\OT1/cmr/m/n/10 i
+....\OT1/cmr/m/n/10 c
+....\OT1/cmr/m/n/10 l
+....\OT1/cmr/m/n/10 e
+....\OT1/cmr/m/n/10 .
+....\OT1/cmr/m/n/10 c
+....\OT1/cmr/m/n/10 l
+....\OT1/cmr/m/n/10 s
+....\glue 3.33333 plus 1.66666 minus 1.11111
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue -2.5
+...\glue 0.0 plus 1.0fil
+...\glue 0.0
+...\glue 0.0 plus 0.0001fil
+..\glue(\baselineskip) 23.55556
+..\hbox(6.44444+0.0)x345.0
+...\hbox(6.44444+0.0)x345.0, glue set 170.0fil
+....\glue 0.0 plus 1.0fil
+....\OT1/cmr/m/n/10 1
+....\glue 0.0 plus 1.0fil
+(github-1092.aux)





More information about the latex3-commits mailing list.