summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-06-19 22:34:54 +0000
committerKarl Berry <karl@freefriends.org>2015-06-19 22:34:54 +0000
commit8ec6f52457309f1e1152d881c29acc8f8c775442 (patch)
tree3b3247c79f170cc40a286743fb4e1265255cbb06 /Master/texmf-dist/source/latex/l3kernel/l3file.dtx
parent487de9cd41f430fd78e869079c420f36a8ff051a (diff)
l3 (19jun15)
git-svn-id: svn://tug.org/texlive/trunk@37621 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.dtx44
1 files changed, 34 insertions, 10 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
index bded1318cdc..b057b04dc80 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: l3file.dtx Copyright (C) 1990-2014 The LaTeX3 Project
+%% File: l3file.dtx Copyright (C) 1990-2015 The LaTeX3 Project
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -37,7 +37,7 @@
\documentclass[full]{l3doc}
%</driver>
%<*driver|package>
-\GetIdInfo$Id: l3file.dtx 5369 2014-08-24 22:41:47Z bruno $
+\GetIdInfo$Id: l3file.dtx 5627 2015-06-07 09:26:26Z bruno $
{L3 File and I/O operations}
%</driver|package>
%<*driver>
@@ -432,7 +432,7 @@
% \item |\#|, |\%|, |\{|, |\}|, |\~| may be used to represent
% the corresponding character,
% \item \cs{iow_indent:n} may be used to indent a part of the
-% message.
+% \meta{text} (not the \meta{run-on text}).
% \end{itemize}
% Additional functions may be added to the wrapping by using the
% \meta{set up}, which is executed before the wrapping takes place: this
@@ -464,7 +464,7 @@
% \begin{syntax}
% \cs{iow_indent:n} \Arg{text}
% \end{syntax}
-% In the context of \cs{iow_wrap:nnnN} (for instance in messages),
+% In the first argument of \cs{iow_wrap:nnnN} (for instance in messages),
% indents \meta{text} by four spaces. This function will not cause
% a line break, and only affects lines which start within the scope
% of the \meta{text}. In case the indented \meta{text} should appear
@@ -975,7 +975,10 @@
{
\cs_if_exist:NTF \normalend
{ \tex_count:D 38 \scan_stop: }
- { \tex_count:D 16 \scan_stop: - \c_one }
+ {
+ \tex_count:D 16 \scan_stop:
+ \cs_if_exist:NT \loccount { - \c_one }
+ }
}
{
\prop_gput:Nnn \g_@@_streams_prop {#1} { Reserved~by~format }
@@ -1239,7 +1242,10 @@
{
\cs_if_exist:NTF \normalend
{ \tex_count:D 39 \scan_stop: }
- { \tex_count:D 17 \scan_stop: - \c_one }
+ {
+ \tex_count:D 17 \scan_stop:
+ \cs_if_exist:NT \loccount { - \c_one }
+ }
}
{
\prop_gput:Nnn \g_@@_streams_prop {#1} { Reserved~by~format }
@@ -1554,21 +1560,26 @@
% \end{macro}
%
% \begin{macro}{\iow_indent:n}
-% \begin{macro}[aux]{\@@_indent:n}
-% We give a dummy (protected) definition to \cs{iow_indent:n}
+% \begin{macro}[aux]{\@@_indent:n, \@@_indent_error:n}
+% We give a (protected) error definition to \cs{iow_indent:n}
% when outside messages. Within wrapped message, it places
% the instruction for increasing the indentation before its
% argument, and the instruction for unindenting afterwards.
% Note that there will be no forced line-break, so the indentation
% only changes when the next line is started.
% \begin{macrocode}
-\cs_new_protected:Npn \iow_indent:n #1 { }
\cs_new:Npx \@@_indent:n #1
{
\c_@@_wrap_indent_marker_tl
#1
\c_@@_wrap_unindent_marker_tl
}
+\cs_new:Npn \@@_indent_error:n #1
+ {
+ \__msg_kernel_expandable_error:nn { kernel } { indent-outside-wrapping-code }
+ #1
+ }
+\cs_new_protected_nopar:Npn \iow_indent:n { \@@_indent_error:n }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1612,11 +1623,14 @@
\@@_wrap_set:Nx \l_@@_wrap_tl {#1}
%</package>
% \end{macrocode}
+% To warn users that \cs{iow_indent:n} only works in the first argument
+% of \cs{iow_wrap:nnnN} reset \cs{iow_indent:n} to its error definition.
% This is a bit of a hack to measure the string length of the run on text
% without the \pkg{l3str} module (which is still experimental). This should
% be replaced once the string module is finalised with something a little
% cleaner.
% \begin{macrocode}
+ \cs_set_eq:NN \iow_indent:n \@@_indent_error:n
\tl_set:Nx \l_@@_newline_tl { \iow_newline: #2 }
\tl_set:Nx \l_@@_newline_tl { \tl_to_str:N \l_@@_newline_tl }
\tl_replace_all:Nnn \l_@@_newline_tl { ~ } { \c_space_tl }
@@ -1625,12 +1639,20 @@
\int_zero:N \l_@@_current_indentation_int
\tl_clear:N \l_@@_current_indentation_tl
\int_zero:N \l_@@_current_line_int
- \tl_clear:N \l_@@_current_line_tl
+ \tl_set:Nn \l_@@_current_line_tl { \use_none:n }
\bool_set_true:N \l_@@_line_start_bool
+% \end{macrocode}
+% After some setup above (in particular the odd setting of the current line
+% to \cs{use_none:n}), a loop goes through space-delimited words in the
+% message, recognizing special markers. To make sure that the first line
+% behaves identically to others, start with a newline marker: the
+% \cs{use_none:n} above avoids actually getting a new line in the output.
+% \begin{macrocode}
\use:x
{
\exp_not:n { \tl_clear:N \l_@@_wrap_tl }
\@@_wrap_loop:w
+ \tl_to_str:N \c_@@_wrap_newline_marker_tl
\tl_to_str:N \l_@@_wrap_tl
\tl_to_str:N \c_@@_wrap_end_marker_tl
\c_space_tl \c_space_tl
@@ -1836,6 +1858,8 @@
{
File~names~must~contain~balanced~numbers~of~quotes~(").
}
+\__msg_kernel_new:nnn { kernel } { indent-outside-wrapping-code }
+ { Only~\iow_wrap:nnnN~(arg~1)~allows~\iow_indent:n }
% \end{macrocode}
%
% \begin{macrocode}