[latex3-commits] [git/LaTeX3-latex3-latex3] master: Add check that dates provided to l3doc are in the past (or day of) (bcb4cc8)

Bruno Le Floch bruno at le-floch.fr
Fri Jan 11 10:47:16 CET 2019


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/bcb4cc822ef814d7b5ea9668773e6b15d5ca2386

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

commit bcb4cc822ef814d7b5ea9668773e6b15d5ca2386
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Fri Jan 11 10:47:16 2019 +0100

    Add check that dates provided to l3doc are in the past (or day of)


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

bcb4cc822ef814d7b5ea9668773e6b15d5ca2386
 l3kernel/l3doc.dtx |   23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/l3kernel/l3doc.dtx b/l3kernel/l3doc.dtx
index 43a0505..6d8d1db 100644
--- a/l3kernel/l3doc.dtx
+++ b/l3kernel/l3doc.dtx
@@ -1351,6 +1351,8 @@ and all files in that bundle must be distributed together.
   { The~deprecated~function(s)~'#1'~should~have~been~removed~on~#2. }
 \msg_new:nnn { l3doc } { date-format }
   { The~date~'#1'~should~be~given~in~YYYY-MM-DD~format. }
+\msg_new:nnn { l3doc } { future-date }
+  { The~added/updated~date~'#2'~of~'#1'~is~in~the~future. }
 \msg_new:nnn { l3doc } { syntax-nested-function }
   {
     The~'syntax'~environment~should~be~used~in~the~
@@ -2370,8 +2372,8 @@ and all files in that bundle must be distributed together.
         \bool_set_true:N \l_@@_macro_noTF_bool
         \bool_set_true:N \l_@@_macro_TF_bool
       } ,
-    added .code:n = { \@@_date_set:Nn \l_@@_date_added_tl {#1} },
-    updated .code:n = { \@@_date_set:Nn \l_@@_date_updated_tl {#1} } ,
+    added .code:n = { \@@_date_set_past:Nn \l_@@_date_added_tl {#1} },
+    updated .code:n = { \@@_date_set_past:Nn \l_@@_date_updated_tl {#1} } ,
     deprecated .code:n = { \@@_deprecated_on:n {#1} } ,
     tested .code:n = { } ,
     label .code:n =
@@ -2385,9 +2387,11 @@ and all files in that bundle must be distributed together.
   }
 %    \end{macrocode}
 %
-% \begin{macro}{\@@_date_set:Nn}
+% \begin{macro}{\@@_date_set:Nn,\@@_date_set_past:Nn}
 %   Normalize the date into the format \texttt{YYYY-MM-DD}; more
-%   precisely month and day are allowed to be single digits.
+%   precisely month and day are allowed to be single digits.  The
+%   \cs{@@_date_set_past:Nn} function only allows dates in the past (or
+%   same day).
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_date_set:Nn #1#2
   {
@@ -2399,6 +2403,17 @@ and all files in that bundle must be distributed together.
         \tl_set:Nn #1 { 1970-01-01 }
       }
   }
+\cs_new_protected:Npn \@@_date_set_past:Nn #1#2
+  {
+    \@@_date_set:Nn #1 {#2}
+    \exp_args:No \@@_date_compare:nNnT
+      {#1} > { \tex_year:D - \tex_month:D - \tex_day:D }
+      {
+        \msg_error:nnxx { l3doc } { future-date }
+          { \tl_to_str:N \l_@@_macro_argument_tl }
+          {#1}
+      }
+  }
 %    \end{macrocode}
 % \end{macro}
 %





More information about the latex3-commits mailing list