From 51d74983b14a9c2832b6bfbdcac4e99243aabbb6 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 21 Jul 2017 22:02:53 +0000
Subject: l3 (21jul17)

git-svn-id: svn://tug.org/texlive/trunk@44864 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/l3kernel/l3doc.cls | 82 ++++++++++++++++++--------
 1 file changed, 56 insertions(+), 26 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/l3kernel/l3doc.cls')

diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls
index 40e5be8e70b..f65fc2134c6 100644
--- a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls
+++ b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls
@@ -20,7 +20,7 @@
 %% 
 %% File: l3doc.dtx Copyright (C) 1990-2017 The LaTeX3 project
 \RequirePackage{expl3,xparse,calc}
-\ProvidesExplClass{l3doc}{2017/07/15}{}
+\ProvidesExplClass{l3doc}{2017/07/19}{}
   {L3 Experimental documentation class}
 \clist_new:N \g_docinput_clist
 \seq_new:N \g_doc_functions_seq
@@ -30,6 +30,7 @@
 \coffin_new:N \l__codedoc_descr_coffin
 \coffin_new:N \l__codedoc_syntax_coffin
 \box_new:N \g__codedoc_syntax_box
+\bool_new:N \l__codedoc_in_function_bool
 \bool_new:N \l__codedoc_long_name_bool
 \dim_new:N \l__codedoc_trial_width_dim
 \int_new:N \l__codedoc_nested_macro_int
@@ -299,6 +300,16 @@
   { 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 } { syntax-nested-function }
+  {
+    The~'syntax'~environment~should~be~used~in~the~
+    innermost~'function'~environment.
+  }
+\msg_new:nnn { l3doc } { multiple-syntax }
+  {
+    The~'syntax'~environment~should~only~be~used~once~in~
+    a~'function'~environment.
+  }
 \DeclareOption { a5paper } { \@latexerr { Option~not~supported } { } }
 \DeclareOption { full }
   {
@@ -834,16 +845,23 @@
   }
 \cs_new_protected:Npn \__codedoc_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 }
+      }
   }
 \cs_new_protected:Npn \__codedoc_deprecated_on:n #1
   {
-    \__codedoc_date_compare:nNnT {#1} < { \tex_year:D - \tex_month:D - \tex_day:D }
+    \__codedoc_date_set:Nn \l__codedoc_tmpa_tl {#1}
+    \exp_args:No \__codedoc_date_compare:nNnT
+      { \l__codedoc_tmpa_tl } < { \tex_year:D - \tex_month:D - \tex_day:D }
       {
         \msg_error:nnxx { l3doc } { deprecated-function }
-          { \tl_to_str:N \l__codedoc_macro_argument_tl } {#1}
+          { \tl_to_str:N \l__codedoc_macro_argument_tl }
+          { \l__codedoc_tmpa_tl }
       }
     \bool_set_true:N \l__codedoc_macro_internal_bool
   }
@@ -874,27 +892,30 @@
     \par
     \allowbreak
   }
-\group_begin:
-  \char_set_catcode_active:N \<
-  \cs_new_protected:Npn \__codedoc_function_init:
-    {
-      \coffin_clear:N \l__codedoc_descr_coffin
-      \box_gclear:N \g__codedoc_syntax_box
-      \coffin_clear:N \l__codedoc_syntax_coffin
-      \coffin_clear:N \l__codedoc_functions_coffin
-      \bool_set_false:N \l__codedoc_macro_TF_bool
-      \bool_set_false:N \l__codedoc_macro_pTF_bool
-      \bool_set_false:N \l__codedoc_macro_noTF_bool
-      \bool_set_false:N \l__codedoc_macro_EXP_bool
-      \bool_set_false:N \l__codedoc_macro_rEXP_bool
-      \bool_set_false:N \l__codedoc_no_label_bool
-      \bool_set_false:N \l__codedoc_names_verb_bool
-      \clist_clear:N \l__codedoc_function_label_clist
-      \tl_set:Nn \l__codedoc_override_module_tl { \q_no_value }
-      \char_set_catcode_active:N \<
-      \cs_set_protected_nopar:Npn < ##1 > { \meta {##1} }
+\cs_new_protected:Npn \__codedoc_function_init:
+  {
+    \box_if_empty:NF \g__codedoc_syntax_box
+      { \msg_error:nn { l3doc } { syntax-nested-function } }
+    \coffin_clear:N \l__codedoc_descr_coffin
+    \box_gclear:N \g__codedoc_syntax_box
+    \coffin_clear:N \l__codedoc_syntax_coffin
+    \coffin_clear:N \l__codedoc_functions_coffin
+    \bool_set_false:N \l__codedoc_macro_TF_bool
+    \bool_set_false:N \l__codedoc_macro_pTF_bool
+    \bool_set_false:N \l__codedoc_macro_noTF_bool
+    \bool_set_false:N \l__codedoc_macro_EXP_bool
+    \bool_set_false:N \l__codedoc_macro_rEXP_bool
+    \bool_set_false:N \l__codedoc_no_label_bool
+    \bool_set_false:N \l__codedoc_names_verb_bool
+    \bool_set_true:N \l__codedoc_in_function_bool
+    \clist_clear:N \l__codedoc_function_label_clist
+    \tl_set:Nn \l__codedoc_override_module_tl { \q_no_value }
+    \char_set_active_eq:NN \< \__codedoc_shorthand_meta:
+    \char_set_catcode_active:N \<
   }
-\group_end:
+\cs_new_protected:Npn \__codedoc_shorthand_meta:
+  { \mode_if_math:TF { < } { \__codedoc_shorthand_meta:w } }
+\cs_new_protected_nopar:Npn \__codedoc_shorthand_meta:w #1 > { \meta {#1} }
 \cs_new_protected:Npn \__codedoc_function_reset:
   {
     \tl_set:Nn \l__codedoc_override_module_tl { \q_no_value }
@@ -918,7 +939,7 @@
 \cs_new_protected:Npn \__codedoc_function_assemble:
   {
     \hcoffin_set:Nn  \l__codedoc_syntax_coffin
-      { \box_use:N \g__codedoc_syntax_box }
+      { \box_use_clear:N \g__codedoc_syntax_box }
     \bool_if:NTF \l__codedoc_long_name_bool
       {
         \coffin_join:NnnNnnnn
@@ -1057,6 +1078,8 @@
 \dim_new:N \l__codedoc_syntax_dim
 \cs_new_protected:Npn \__codedoc_syntax:w
   {
+    \box_if_empty:NF \g__codedoc_syntax_box
+      { \msg_error:nn { l3doc } { multiple-syntax } }
     \dim_set:Nn \l__codedoc_syntax_dim
       {
         \textwidth
@@ -1079,6 +1102,13 @@
       \end{tabular}
       \arrayrulecolor{black}
     \hbox_gset_end:
+    \bool_if:NF \l__codedoc_in_function_bool
+      {
+        \begin{quote}
+          \mode_leave_vertical:
+          \box_use_clear:N \g__codedoc_syntax_box
+        \end{quote}
+      }
   }
 \keys_define:nn { l3doc/macro }
   {
-- 
cgit v1.2.3

