diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3doc.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3doc.dtx | 106 |
1 files changed, 75 insertions, 31 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index 08ae366efed..985518e71e4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -70,14 +70,14 @@ and all files in that bundle must be distributed together. % This isn't included in the typeset documentation because it's a bit % ugly: %<*class> -\ProvidesExplClass{l3doc}{2017/07/15}{} +\ProvidesExplClass{l3doc}{2017/07/19}{} {L3 Experimental documentation class} %</class> % \fi % % \title{The \cls{l3doc} class} % \author{\Team} -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % \maketitle % \tableofcontents % @@ -594,6 +594,15 @@ and all files in that bundle must be distributed together. % \end{macrocode} % \end{variable} % +% \begin{variable}[int]{\l_@@_in_function_bool} +% True when inside a \texttt{function} or \texttt{variable} +% environment. Used by the \texttt{syntax} environment to determine +% its behaviour. +% \begin{macrocode} +\bool_new:N \l_@@_in_function_bool +% \end{macrocode} +% \end{variable} +% % \begin{variable}[int]{\l_@@_long_name_bool, \l_@@_trial_width_dim} % The boolean \cs{l_@@_long_name_bool} is \texttt{true} if the width % \cs{l_@@_trial_width_dim} of the coffin \cs{l_@@_functions_coffin} @@ -1225,6 +1234,16 @@ 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 } { 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. + } % \end{macrocode} % % \subsection{Options and configuration} @@ -2146,14 +2165,18 @@ and all files in that bundle must be distributed together. % \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 +2190,13 @@ and all files in that bundle must be distributed together. % \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 } @@ -2236,30 +2262,39 @@ and all files in that bundle must be distributed together. % \end{macro} % % \begin{macro}[aux]{\@@_function_init:} -% Allow |<...>| to be used as markup for |\meta{...}|. Clear various -% variables. +% Complain if \texttt{function} environments are nested. Clear +% various variables. % \begin{macrocode} -\group_begin: - \char_set_catcode_active:N \< - \cs_new_protected:Npn \@@_function_init: - { - \coffin_clear:N \l_@@_descr_coffin - \box_gclear:N \g_@@_syntax_box - \coffin_clear:N \l_@@_syntax_coffin - \coffin_clear:N \l_@@_functions_coffin - \bool_set_false:N \l_@@_macro_TF_bool - \bool_set_false:N \l_@@_macro_pTF_bool - \bool_set_false:N \l_@@_macro_noTF_bool - \bool_set_false:N \l_@@_macro_EXP_bool - \bool_set_false:N \l_@@_macro_rEXP_bool - \bool_set_false:N \l_@@_no_label_bool - \bool_set_false:N \l_@@_names_verb_bool - \clist_clear:N \l_@@_function_label_clist - \tl_set:Nn \l_@@_override_module_tl { \q_no_value } - \char_set_catcode_active:N \< - \cs_set_protected_nopar:Npn < ##1 > { \meta {##1} } +\cs_new_protected:Npn \@@_function_init: + { + \box_if_empty:NF \g_@@_syntax_box + { \msg_error:nn { l3doc } { syntax-nested-function } } + \coffin_clear:N \l_@@_descr_coffin + \box_gclear:N \g_@@_syntax_box + \coffin_clear:N \l_@@_syntax_coffin + \coffin_clear:N \l_@@_functions_coffin + \bool_set_false:N \l_@@_macro_TF_bool + \bool_set_false:N \l_@@_macro_pTF_bool + \bool_set_false:N \l_@@_macro_noTF_bool + \bool_set_false:N \l_@@_macro_EXP_bool + \bool_set_false:N \l_@@_macro_rEXP_bool + \bool_set_false:N \l_@@_no_label_bool + \bool_set_false:N \l_@@_names_verb_bool + \bool_set_true:N \l_@@_in_function_bool + \clist_clear:N \l_@@_function_label_clist + \tl_set:Nn \l_@@_override_module_tl { \q_no_value } + \char_set_active_eq:NN \< \@@_shorthand_meta: + \char_set_catcode_active:N \< } -\group_end: +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux]{\@@_shorthand_meta:, \@@_shorthand_meta:w} +% Allow |<...>| to be used as markup for |\meta{...}|. +% \begin{macrocode} +\cs_new_protected:Npn \@@_shorthand_meta: + { \mode_if_math:TF { < } { \@@_shorthand_meta:w } } +\cs_new_protected_nopar:Npn \@@_shorthand_meta:w #1 > { \meta {#1} } % \end{macrocode} % \end{macro} % @@ -2320,7 +2355,7 @@ and all files in that bundle must be distributed together. \cs_new_protected:Npn \@@_function_assemble: { \hcoffin_set:Nn \l_@@_syntax_coffin - { \box_use:N \g_@@_syntax_box } + { \box_use_clear:N \g_@@_syntax_box } \bool_if:NTF \l_@@_long_name_bool { \coffin_join:NnnNnnnn @@ -2505,6 +2540,8 @@ and all files in that bundle must be distributed together. \dim_new:N \l_@@_syntax_dim \cs_new_protected:Npn \@@_syntax:w { + \box_if_empty:NF \g_@@_syntax_box + { \msg_error:nn { l3doc } { multiple-syntax } } \dim_set:Nn \l_@@_syntax_dim { \textwidth @@ -2527,6 +2564,13 @@ and all files in that bundle must be distributed together. \end{tabular} \arrayrulecolor{black} \hbox_gset_end: + \bool_if:NF \l_@@_in_function_bool + { + \begin{quote} + \mode_leave_vertical: + \box_use_clear:N \g_@@_syntax_box + \end{quote} + } } % \end{macrocode} % \end{macro} |