[latex3-commits] [latex3/latex3] main: Allow for optional "/" at end of \input at path (cb8ef86a2)
github at latex-project.org
github at latex-project.org
Mon May 29 11:15:12 CEST 2023
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/cb8ef86a23a3814da62b3dee94c94f39db461248
>---------------------------------------------------------------
commit cb8ef86a23a3814da62b3dee94c94f39db461248
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Mon May 29 10:08:03 2023 +0100
Allow for optional "/" at end of \input at path
See latex3/latex2e#1076.
>---------------------------------------------------------------
cb8ef86a23a3814da62b3dee94c94f39db461248
l3kernel/CHANGELOG.md | 2 ++
l3kernel/l3file.dtx | 36 +++++++++++++++++++++++++++++++-----
l3kernel/testfiles/m3file001.lvt | 4 ++++
l3kernel/testfiles/m3file001.tlg | 1 +
4 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 32088ae3d..57ad0da13 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -20,6 +20,8 @@ this project uses date-based 'snapshot' version identifiers.
- Set `\l_keys_value_tl` in `.initial:n` (issue \#1013)
- Support for boolean values in `expl3` package options
`check-declarations` and `log-functions` (issue \#978)
+- Allow for optional `/` at end of `\input at path` entries
+ (see latex3/latex2e\#1076)
## [2023-05-22]
diff --git a/l3kernel/l3file.dtx b/l3kernel/l3file.dtx
index 0964354ab..1b7388073 100644
--- a/l3kernel/l3file.dtx
+++ b/l3kernel/l3file.dtx
@@ -2873,7 +2873,9 @@
%
% \begin{macro}[EXP]{\file_full_name:n, \@@_full_name:n, \@@_full_name_aux:n}
% \begin{macro}[EXP]{\@@_full_name_auxi:nn, \@@_full_name_auxii:nn}
-% \begin{macro}[EXP]{\@@_full_name_aux:Nnnn}
+% \begin{macro}[EXP]{\@@_full_name_aux:Nnn}
+% \begin{macro}[EXP]{\@@_full_name_slash:n}
+% \begin{macro}[EXP]{\@@_full_name_slash:w}
% \begin{macro}[EXP]{\@@_full_name_aux:nN}
% \begin{macro}[EXP]{\@@_full_name_aux:nnN}
% \begin{macro}[EXP]{\@@_name_cleanup:w}
@@ -2943,11 +2945,11 @@
\tl_if_blank:nTF {#2}
{
\seq_map_tokens:Nn \l_file_search_path_seq
- { \@@_full_name_aux:Nnnn \seq_map_break:n {#1} { / } }
+ { \@@_full_name_aux:Nnn \seq_map_break:n {#1} }
\cs_if_exist:NT \input at path
{
\tl_map_tokens:Nn \input at path
- { \@@_full_name_aux:Nnnn \tl_map_break:n {#1} { } }
+ { \@@_full_name_aux:Nnn \tl_map_break:n {#1} }
}
\@@_name_end:
}
@@ -2957,8 +2959,30 @@
% Two pars to the auxiliary here so we can avoid doing quoting
% twice in the event we find the right file.
% \begin{macrocode}
-\cs_new:Npn \@@_full_name_aux:Nnnn #1#2#3#4
- { \exp_args:Ne \@@_full_name_aux:nN { \tl_to_str:n {#4} #3 #2 } #1 }
+\cs_new:Npn \@@_full_name_aux:Nnn #1#2#3
+ {
+ \exp_args:Ne \@@_full_name_aux:nN
+ {
+ \exp_args:Ne \@@_full_name_slash:n
+ { \tl_to_str:n {#3} } #2
+ }
+ #1
+ }
+\cs_new:Npn \@@_full_name_slash:n #1
+ {
+ \@@_full_name_slash:nw { } #1 / \q_nil / \q_stop
+ }
+\cs_new:Npn \@@_full_name_slash:nw #1#2 / #3 / #4 \q_stop
+ {
+ \quark_if_nil:nTF {#3}
+ { #1#2 / }
+ {
+ \tl_if_blank:nTF {#3}
+ { \@@_full_name_slash:nw {#1#2} }
+ { \@@_full_name_slash:nw { #1#2 / #3 } }
+ / #4 \q_stop
+ }
+ }
\cs_new:Npn \@@_full_name_aux:nN #1
{ \exp_args:Nne \@@_full_name_aux:nnN {#1} { \@@_full_name_aux:n {#1} } }
\cs_new:Npn \@@_full_name_aux:nnN #1 #2 #3
@@ -3026,6 +3050,8 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \begin{macro}{\file_get_full_name:nN, \file_get_full_name:VN}
% \begin{macro}[TF]{\file_get_full_name:nN, \file_get_full_name:VN}
diff --git a/l3kernel/testfiles/m3file001.lvt b/l3kernel/testfiles/m3file001.lvt
index 86cca8160..d9f5c48cf 100644
--- a/l3kernel/testfiles/m3file001.lvt
+++ b/l3kernel/testfiles/m3file001.lvt
@@ -65,6 +65,10 @@
\cs_set:cpn { input at path } { { ./testpath/ } }
\TYPE { 2e:~\file_full_name:n { infolder.txt } }
\group_end:
+ \group_begin:
+ \cs_set:cpn { input at path } { { ./testpath } }
+ \TYPE { Slashes:~\file_full_name:n { infolder.txt } }
+ \group_end:
}
\TEST { Getting~the~full~name~of~files }
diff --git a/l3kernel/testfiles/m3file001.tlg b/l3kernel/testfiles/m3file001.tlg
index 788559be7..cac34196c 100644
--- a/l3kernel/testfiles/m3file001.tlg
+++ b/l3kernel/testfiles/m3file001.tlg
@@ -26,6 +26,7 @@ TEST 3: Find files in the search path
============================================================
l3: ./testpath/infolder.txt
2e: ./testpath/infolder.txt
+Slashes: ./testpath/infolder.txt
============================================================
============================================================
TEST 4: Getting the full name of files
More information about the latex3-commits
mailing list.