[latex3-commits] [l3svn] r6902 - Detect wrong-format dates in l3doc (see #335)

noreply at latex-project.org noreply at latex-project.org
Sun Feb 12 17:09:33 CET 2017


Author: bruno
Date: 2017-02-12 17:09:32 +0100 (Sun, 12 Feb 2017)
New Revision: 6902

Modified:
   trunk/l3kernel/l3doc.dtx
Log:
Detect wrong-format dates in l3doc (see #335)


Modified: trunk/l3kernel/l3doc.dtx
===================================================================
--- trunk/l3kernel/l3doc.dtx	2017-02-12 11:49:52 UTC (rev 6901)
+++ trunk/l3kernel/l3doc.dtx	2017-02-12 16:09:32 UTC (rev 6902)
@@ -1235,6 +1235,8 @@
   }
 \msg_new:nnn { l3doc } { deprecated-function }
   { 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. }
 %    \end{macrocode}
 %
 % \subsection{Options and configuration}
@@ -2140,8 +2142,8 @@
         \bool_set_true:N \l_@@_macro_noTF_bool
         \bool_set_true:N \l_@@_macro_TF_bool
       } ,
-    added .tl_set:N = \l_@@_date_added_tl ,
-    updated .tl_set:N = \l_@@_date_updated_tl ,
+    added .code:n = { \@@_date_set:Nn \l_@@_date_added_tl {#1} },
+    updated .code:n = { \@@_date_set:Nn \l_@@_date_updated_tl {#1} } ,
     deprecated .code:n = { \@@_deprecated_on:n {#1} } ,
     tested .code:n = { } ,
     label .code:n =
@@ -2155,6 +2157,19 @@
   }
 %    \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.
+%    \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}
+  }
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}[aux]{\@@_deprecated_on:n}
 %   The date comparison function expects two dates in the YYYY-MM-DD
 %   format (|-|~is not subtraction here).



More information about the latex3-commits mailing list