[latex3-commits] [l3svn] r7386 - Allow YYYY/MM/DD in l3doc.dtx (fixes #335)
noreply at latex-project.org
noreply at latex-project.org
Mon Jul 17 03:47:08 CEST 2017
Author: bruno
Date: 2017-07-17 03:47:07 +0200 (Mon, 17 Jul 2017)
New Revision: 7386
Modified:
trunk/l3kernel/l3box.dtx
trunk/l3kernel/l3doc.dtx
Log:
Allow YYYY/MM/DD in l3doc.dtx (fixes #335)
That adds error checking using a regex. The regex allows such
weird things as YYYY-MM/DD but I didn't bother filtering that.
Still, it found a typo in l3box.dtx.
Modified: trunk/l3kernel/l3box.dtx
===================================================================
--- trunk/l3kernel/l3box.dtx 2017-07-17 01:42:23 UTC (rev 7385)
+++ trunk/l3kernel/l3box.dtx 2017-07-17 01:47:07 UTC (rev 7386)
@@ -536,22 +536,22 @@
% \meta{dimexpr} and then stores the result inside the \meta{box}.
% \end{function}
%
-% \begin{function}[updated = 2017-04-058]
-% {
-% \vbox_set:Nw, \vbox_set:cw,
-% \vbox_set_end:,
-% \vbox_gset:Nw, \vbox_gset:cw,
-% \vbox_gset_end:
-% }
-% \begin{syntax}
-% \cs{vbox_set:Nw} \meta{box} \meta{contents} \cs{vbox_set_end:}
-% \end{syntax}
-% Typesets the \meta{contents} at natural height and then stores the
-% result inside the \meta{box}. In contrast
-% to \cs{vbox_set:Nn} this function does not absorb the argument
-% when finding the \meta{content}, and so can be used in circumstances
-% where the \meta{content} may not be a simple argument.
-% \end{function}
+% \begin{function}[updated = 2017-04-05]
+% {
+% \vbox_set:Nw, \vbox_set:cw,
+% \vbox_set_end:,
+% \vbox_gset:Nw, \vbox_gset:cw,
+% \vbox_gset_end:
+% }
+% \begin{syntax}
+% \cs{vbox_set:Nw} \meta{box} \meta{contents} \cs{vbox_set_end:}
+% \end{syntax}
+% Typesets the \meta{contents} at natural height and then stores the
+% result inside the \meta{box}. In contrast
+% to \cs{vbox_set:Nn} this function does not absorb the argument
+% when finding the \meta{content}, and so can be used in circumstances
+% where the \meta{content} may not be a simple argument.
+% \end{function}
%
% \begin{function}[added = 2017-06-08]
% {
Modified: trunk/l3kernel/l3doc.dtx
===================================================================
--- trunk/l3kernel/l3doc.dtx 2017-07-17 01:42:23 UTC (rev 7385)
+++ trunk/l3kernel/l3doc.dtx 2017-07-17 01:47:07 UTC (rev 7386)
@@ -2146,14 +2146,18 @@
% \end{macrocode}
%
% \begin{macro}[aux]{\@@_date_set:Nn}
-% Minimal check that the date is not given in the YYYY/MM/DD format.
-% Eventually we should check the input more carefully.
+% Normalize the date into the format \texttt{YYYY-MM-DD}; more
+% precisely month and day are allowed to be single digits.
% \begin{macrocode}
\cs_new_protected:Npn \@@_date_set:Nn #1#2
{
- \tl_if_in:nnT {#2} { / }
- { \msg_error:nnn { l3doc } { date-format } {#2} }
\tl_set:Nn #1 {#2}
+ \regex_replace_once:nnNF
+ { \A(\d\d\d\d)[-/](\d\d?)[-/](\d\d?)\Z } { \1-\2-\3 } #1
+ {
+ \msg_error:nnn { l3doc } { date-format } {#2}
+ \tl_set:Nn #1 { 1970-01-01 }
+ }
}
% \end{macrocode}
% \end{macro}
@@ -2167,10 +2171,13 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_deprecated_on:n #1
{
- \@@_date_compare:nNnT {#1} < { \tex_year:D - \tex_month:D - \tex_day:D }
+ \@@_date_set:Nn \l_@@_tmpa_tl {#1}
+ \exp_args:No \@@_date_compare:nNnT
+ { \l_@@_tmpa_tl } < { \tex_year:D - \tex_month:D - \tex_day:D }
{
\msg_error:nnxx { l3doc } { deprecated-function }
- { \tl_to_str:N \l_@@_macro_argument_tl } {#1}
+ { \tl_to_str:N \l_@@_macro_argument_tl }
+ { \l_@@_tmpa_tl }
}
\bool_set_true:N \l_@@_macro_internal_bool
}
More information about the latex3-commits
mailing list