summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-06-17 22:32:09 +0000
committerKarl Berry <karl@freefriends.org>2014-06-17 22:32:09 +0000
commit3c2f50b92407533aabaef1823006032eedd6ef90 (patch)
treeeb67245dd952c951b95c485a5eb66f9539ac83df /Master/texmf-dist/source/latex/l3kernel/l3file.dtx
parent4aa0b8110f2fdb3044d8b26d54e12cbb49a9a3dc (diff)
l3
git-svn-id: svn://tug.org/texlive/trunk@34268 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3file.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3file.dtx54
1 files changed, 40 insertions, 14 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
index 45bb0ec7adf..2c9210f8d76 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
@@ -37,7 +37,7 @@
\documentclass[full]{l3doc}
%</driver>
%<*driver|package>
-\GetIdInfo$Id: l3file.dtx 4737 2014-05-05 07:37:48Z joseph $
+\GetIdInfo$Id: l3file.dtx 4890 2014-05-26 20:59:31Z joseph $
{L3 File and I/O operations}
%</driver|package>
%<*driver>
@@ -83,8 +83,9 @@
% may contain both literal items and expandable content, which should on
% full expansion be the desired file name. Any active characters (as
% declared in \cs{l_char_active_seq}) will \emph{not} be expanded,
-% allowing the direct use of these in file names.
-% Spaces are not allowed in file names.
+% allowing the direct use of these in file names. File names will be quoted
+% using |"| tokens if they contain spaces: as a result, |"| tokens are
+% \emph{not} permitted in file names.
%
% \section{File operation functions}
%
@@ -500,7 +501,7 @@
%
% \subsection{Internal file functions and variables}
%
-% \begin{variable}{\l__file_internal_name_ior}
+% \begin{variable}{\g__file_internal_ior}
% Used to test for the existence of files when opening.
% \end{variable}
%
@@ -638,9 +639,13 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}[aux]{\@@_name_sanitize:nn}
+% \begin{macro}[int]{\@@_name_sanitize:nn}
+% \begin{macro}[int, aux]{\@@_name_sanitize_aux:n}
% For converting a token list to a string where active characters are treated
-% as strings from the start.
+% as strings from the start. The logic to the quoting normalisation is the
+% same as used by \texttt{lualatexquotejobname}: check for balanced |"|, and
+% assuming they balance strip all of them out before quoting the entire name
+% if it contains spaces.
% \begin{macrocode}
\cs_new_protected:Npn \@@_name_sanitize:nn #1#2
{
@@ -650,20 +655,42 @@
\tl_set:Nx \l_@@_internal_name_tl {#1}
\tl_set:Nx \l_@@_internal_name_tl
{ \tl_to_str:N \l_@@_internal_name_tl }
- \tl_if_in:NnT \l_@@_internal_name_tl { ~ }
+ \int_compare:nNnTF
{
- \__msg_kernel_error:nnx { kernel } { space-in-file-name }
- { \l_@@_internal_name_tl }
- \tl_remove_all:Nn \l_@@_internal_name_tl { ~ }
+ \int_mod:nn
+ {
+ 0 \tl_map_function:NN \l_@@_internal_name_tl
+ \@@_name_sanitize_aux:n
+ }
+ \c_two
}
+ = \c_zero
+ {
+ \tl_remove_all:Nn \l_@@_internal_name_tl { " }
+ \tl_if_in:NnT \l_@@_internal_name_tl { ~ }
+ {
+ \tl_set:Nx \l_@@_internal_name_tl
+ { " \exp_not:V \l_@@_internal_name_tl " }
+ }
+ }
+ {
+ \__msg_kernel_error:nnx { kernel } { unbalanced-quote-in-filename }
+ { \l_@@_internal_name_tl }
+ }
\use:x
{
\group_end:
\exp_not:n {#2} { \l_@@_internal_name_tl }
}
}
+\cs_new:Npn \@@_name_sanitize_aux:n #1
+ {
+ \str_if_eq:nnT {#1} { " }
+ { + \c_one }
+ }
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\file_add_path:nN}
% \begin{macro}[aux]{\@@_add_path:nN, \@@_add_path_search:nN}
@@ -1710,11 +1737,10 @@
All~16~are~currently~in~use,~and~something~wanted~to~open~
another~one.
}
-\__msg_kernel_new:nnnn { kernel } { space-in-file-name }
- { Space~in~file~name~'#1'. }
+\__msg_kernel_new:nnnn { kernel } { unbalanced-quote-in-filename }
+ { Unbalanced~quotes~in~file~name~'#1'. }
{
- Spaces~are~not~permitted~in~files~loaded~by~LaTeX: \\
- Further~errors~may~follow!
+ File~names~must~contain~balanced~numbers~of~quotes~(").
}
% \end{macrocode}
%