summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/l3doc.cls')
-rw-r--r--Master/texmf-dist/tex/latex/l3kernel/l3doc.cls451
1 files changed, 312 insertions, 139 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls
index bc296c6ccde..b4d84b0f52a 100644
--- a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls
+++ b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls
@@ -24,7 +24,7 @@
%%
%% http://www.latex-project.org/lppl.txt
%%
-%% This file is part of the "expl3 bundle" (The Work in LPPL)
+%% This file is part of the "l3kernel bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%%
%% The released version of this bundle is available from CTAN.
@@ -47,16 +47,15 @@
%% prior consultation with the LaTeX3 Project.
%%
%% -----------------------------------------------------------------------
-\RequirePackage{l3names}
+\RequirePackage{expl3,xparse}
\let \filenameOld \ExplFileName
\let \filedateOld \ExplFileDate
\let \fileversionOld \ExplFileVersion
\let \filedescriptionOld \ExplFileDescription
-\GetIdInfo$Id: l3doc.dtx 2719 2011-09-04 13:40:25Z will $
+\GetIdInfo$Id: l3doc.dtx 2819 2011-09-12 17:26:47Z will $
{L3 Experimental documentation class}
\ProvidesExplClass
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\RequirePackage{expl3,xparse}
\let \ExplFileName \filenameOld
\let \ExplFileDate \filedateOld
\let \ExplFileVersion \fileversionOld
@@ -67,11 +66,44 @@
Rainer~Sch\"opf,~Johannes~Braams,~Michael~Downes,~
David~Carlisle,~Alan~Jeffrey,~Morten~H\o{}gholm,~Thomas~Lotze,~
Javier~Bezos,~Will~Robertson,~Joseph~Wright,~Bruno~Le~Floch}}
-\DeclareOption{a5paper}{\@latexerr{Option not supported}{}}
+\coffin_new:N \l_doc_output_box
+\coffin_new:N \l_doc_names_coffin
+\coffin_new:N \l_doc_descr_coffin
+\coffin_new:N \l_doc_syntax_coffin
+\bool_new:N \l_doc_long_name_bool
+\bool_new:N \g_doc_implementation_bool
+\dim_new:N \l_doc_trial_width_dim
+\int_new:N \l_doc_macro_int
+\int_new:N \g_doc_nested_macro_int
+\prop_new:N \g_doc_missing_tests_prop
+\clist_new:N \g_docinput_clist
+\seq_new:N \g_doc_testfiles_seq
+\seq_new:N \g_doc_functions_seq
+\seq_new:N \g_doc_macros_seq
+\seq_new:N \g_doc_not_tested_seq
+\bool_new:N \l_doc_meta_TF_bool
+\bool_new:N \l_doc_meta_pTF_bool
+\bool_new:N \l_doc_meta_EXP_bool
+\bool_new:N \l_doc_meta_rEXP_bool
+\bool_new:N \l_doc_macro_internal_bool
+\bool_new:N \l_doc_macro_aux_bool
+\bool_new:N \l_doc_macro_TF_bool
+\bool_new:N \l_doc_macro_pTF_bool
+\bool_new:N \l_doc_macro_var_bool
\bool_new:N \g_doc_full_bool
\bool_new:N \g_doc_lmodern_bool
\bool_new:N \g_doc_checkfunc_bool
\bool_new:N \g_doc_checktest_bool
+\cs_set_protected_nopar:Npn \coffin_gset_eq:NN #1#2
+ {
+ \coffin_if_exist:NT #1
+ {
+ \box_gset_eq:NN #1 #2
+ \coffin_gset_eq_structure:NN #1 #2
+ }
+ }
+\cs_generate_variant:Nn \coffin_gset_eq:NN { c , Nc , cc }
+\DeclareOption{a5paper}{\@latexerr{Option not supported}{}}
\DeclareOption{full}{ \bool_set_true:N \g_doc_full_bool }
\DeclareOption{onlydoc}{ \bool_set_false:N \g_doc_full_bool }
\DeclareOption{check}{ \bool_set_true:N \g_doc_checkfunc_bool }
@@ -92,7 +124,11 @@
\ProcessOptions
\LoadClass{article}
\RequirePackage{doc}
-\RequirePackage{array,alphalph,booktabs,color,fixltx2e,enumitem,pifont,textcomp,trace,underscore,csquotes}
+\RequirePackage{array,alphalph,booktabs,color,colortbl,fixltx2e,enumitem,pifont,textcomp,trace,underscore,csquotes,fancyvrb}
+\raggedbottom
+\fvset{gobble=2}
+\cs_set_eq:NN \verbatim \Verbatim
+\cs_set_eq:NN \endverbatim \endVerbatim
\bool_if:NT \g_doc_lmodern_bool {
\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern}
@@ -139,9 +175,9 @@
\addtolength \evensidemargin { 20pt }
\cs_set_eq:NN \@@oldlist\list
\cs_set_nopar:Npn \list#1#2{\@@oldlist{#1}{#2\listparindent\z@}}
-\setlength \parindent { 0pt }
+\setlength \parindent { 2em }
\setlength \itemindent { 0pt }
-\setlength \parskip { \medskipamount }
+\setlength \parskip { 0pt plus 3pt minus 0pt }
\cs_set_nopar:Npn \l@section #1#2 {
\ifnum \c@tocdepth >\z@
\addpenalty\@secpenalty
@@ -157,7 +193,6 @@
\endgroup
\fi}
\cs_set_nopar:Npn\l@subsection{\@dottedtocline{2}{2.5em}{2.3em}} % #2 = 1.5em
-
\AtBeginDocument {
\MakeShortVerb \"
\MakeShortVerb \|
@@ -181,7 +216,6 @@
\providecommand\marg[1]{ \texttt{\char`\{} \meta{#1} \texttt{\char`\}} }
\providecommand\oarg[1]{ \texttt[ \meta{#1} \texttt] }
\providecommand\parg[1]{ \texttt( \meta{#1} \texttt) }
-\cs_set_eq:NN \m \meta
\cs_set_eq:NN \file \nolinkurl
\DeclareRobustCommand \env {\texttt}
\DeclareRobustCommand \pkg {\textsf}
@@ -194,15 +228,17 @@
\vspace{3mm}
}
\newcommand\tn[1]{
- \texttt{\bslash #1}
+ \texttt { \char`\\ #1 }
\index{TeX~and~LaTeX2e~commands\actualchar
\string\TeX{}~and~\string\LaTeXe{}~commands:\levelchar
#1\actualchar{\string\ttfamily\string\bslash{}#1}}}
\cs_new:Npn \doc_implementation: {
\cs_set:Npn \variable {\macro[var]}
+ \cs_set_eq:NN \endvariable \endmacro
}
\cs_new:Npn \doc_docu: {
\cs_set_eq:NN \variable \variabledoc
+ \cs_set_eq:NN \endvariable \endvariabledoc
}
\AtEndOfPackage{\doc_docu:}
\newenvironment{documentation}{\doc_docu:}{}
@@ -230,18 +266,47 @@
}{
\endenumerate
}
+\keys_define:nn { l3doc/function }
+ {
+ TF .code:n =
+ {
+ \bool_gset_true:N \l_doc_meta_TF_bool
+ } ,
+ EXP .code:n =
+ {
+ \bool_gset_true:N \l_doc_meta_EXP_bool
+ \bool_gset_false:N \l_doc_meta_rEXP_bool
+ } ,
+ rEXP .code:n =
+ {
+ \bool_gset_false:N \l_doc_meta_EXP_bool
+ \bool_gset_true:N \l_doc_meta_rEXP_bool
+ } ,
+ pTF .code:n =
+ {
+ \bool_gset_true:N \l_doc_meta_pTF_bool
+ \bool_gset_true:N \l_doc_meta_TF_bool
+ \bool_gset_true:N \l_doc_meta_EXP_bool
+ } ,
+ added .tl_set:N = \l_doc_date_added_tl ,
+ updated .tl_set:N = \l_doc_date_updated_tl ,
+ }
\char_set_catcode_active:N \<
-\DeclareDocumentCommand \function { O{} } {
+\DeclareDocumentEnvironment {function} { O{} } {
+ \par\bigskip\noindent
\phantomsection
+ \coffin_clear:N \l_doc_descr_coffin
+ \coffin_clear:N \l_doc_syntax_coffin
+ \coffin_clear:N \l_doc_names_coffin
+
\bool_gset_false:N \l_doc_meta_TF_bool
\bool_gset_false:N \l_doc_meta_pTF_bool
\bool_gset_false:N \l_doc_meta_EXP_bool
\bool_gset_false:N \l_doc_meta_rEXP_bool
- \cs_set_nopar:Npn \KV_key_no_value_elt:n ##1 { \use:c {doc_meta_opt_##1:} }
- \keyval_parse:NNn \KV_key_no_value_elt:n \use_none:nn {#1}
+ \keys_set:nn { l3doc/function } {#1}
\char_set_catcode_active:N \<
\cs_set_eq:NN < \doc_open_meta:n
@@ -249,155 +314,279 @@
\group_begin:
\MakePrivateLetters
\char_set_catcode_other:N \|
- \char_set_catcode_other:N \\
\char_set_catcode_space:N \~
\char_set_catcode_ignore:N \ % space
\char_set_catcode_ignore:N \^^M
\char_set_catcode_ignore:N \^^I
+
\function_aux:n
-}
+ }
+ {
+ \vcoffin_set_end:
+ \hcoffin_set:Nn \l_doc_names_coffin
+ {
+ \exp_args:NV \function_typeset:n \l_doc_function_input_tl
+ }
+ \bool_if:NTF \l_doc_long_name_bool
+ {
+ \coffin_join:NnnNnnnn
+ \l_doc_output_box {hc} {vc}
+ \l_doc_syntax_coffin {l} {T}
+ {0pt} {0pt}
+ \coffin_join:NnnNnnnn
+ \l_doc_output_box {l} {t}
+ \l_doc_names_coffin {r} {t}
+ {-\marginparsep} {0pt}
+ \coffin_join:NnnNnnnn
+ \l_doc_output_box {l} {b}
+ \l_doc_descr_coffin {l} {t}
+ {0.75\marginparwidth + \marginparsep} {-\medskipamount}
+
+ \coffin_typeset:Nnnnn \l_doc_output_box {\l_doc_descr_coffin-l} {\l_doc_descr_coffin-t} {0pt} {0pt}
+ }
+ {
+ \coffin_join:NnnNnnnn
+ \l_doc_output_box {hc} {vc}
+ \l_doc_syntax_coffin {l} {t}
+ {0pt} {0pt}
+ \coffin_join:NnnNnnnn
+ \l_doc_output_box {l} {b}
+ \l_doc_descr_coffin {l} {t}
+ {0pt} {-\medskipamount}
+ \coffin_join:NnnNnnnn
+ \l_doc_output_box {l} {t}
+ \l_doc_names_coffin {r} {t}
+ {-\marginparsep} {0pt}
+
+ \coffin_typeset:Nnnnn
+ \l_doc_output_box {\l_doc_syntax_coffin-l} {\l_doc_syntax_coffin-T}
+ {0pt} {0pt}
+ }
+ \par
+ \allowbreak
+ }
\char_set_catcode_other:N \<
\cs_set_eq:NN \variabledoc \function
-\cs_set:Nn \doc_meta_opt_TF: {
- \bool_gset_true:N \l_doc_meta_TF_bool
-}
-\cs_set:Nn \doc_meta_opt_EXP: {
- \bool_gset_true:N \l_doc_meta_EXP_bool
- \bool_gset_false:N \l_doc_meta_rEXP_bool
-}
-\cs_set:Nn \doc_meta_opt_rEXP: {
- \bool_gset_false:N \l_doc_meta_EXP_bool
- \bool_gset_true:N \l_doc_meta_rEXP_bool
-}
-\cs_set:Nn \doc_meta_opt_pTF: {
- \bool_gset_true:N \l_doc_meta_pTF_bool
- \bool_gset_true:N \l_doc_meta_TF_bool
- \bool_gset_true:N \l_doc_meta_EXP_bool
-}
-\group_begin:
-\char_set_catcode_other:N \|
-\cs_gset_nopar:Npn \function_aux:n #1 {
- \cs_set_nopar:Npn \nextnewline{\cs_gset_nopar:Npn\nextnewline{\\}}
- \tl_gset_eq:NN \g_doc_macro_tl \c_empty_tl
- \bigskip\endgraf\noindent\ttfamily
- \tabular[b]{ | l @{} c | }
- \hline
- \clist_map_inline:nn {#1} {\doc_showmacro:w ##1 | \q_stop} \\
- \hline
- \endtabular
+\cs_set_eq:NN \endvariabledoc \endfunction
+\cs_set_nopar:Npn \function_aux:n #1 {
+
\group_end:
+
+ \tl_set:Nn \l_doc_function_input_tl {#1}
+
+ \dim_zero:N \l_doc_trial_width_dim
+ \hcoffin_set:Nn \l_doc_names_coffin { \function_typeset:n {#1} }
+ \dim_set:Nn \l_doc_trial_width_dim { \box_wd:N \l_doc_names_coffin }
+
+ \bool_set:Nn \l_doc_long_name_bool
+ { \dim_compare_p:nNn \l_doc_trial_width_dim > \marginparwidth }
+
+ \vcoffin_set:Nnw \l_doc_descr_coffin {\textwidth}
+ \noindent\ignorespaces
}
-\group_end:
-\group_begin:
-\char_set_catcode_other:N \|
-\cs_gset_nopar:Npn \doc_showmacro:w #1 | {
- \tl_if_blank:nTF {#1} {
- \use_none:n
- }{
- \doc_showmacro_aux:w #1 / \q_stop
- \peek_meaning:NTF \q_stop { \use_none:n } { \doc_showmacro:w }
- }
-}
-\group_end:
-\bool_new:N \l_doc_meta_TF_bool
-\bool_new:N \l_doc_meta_pTF_bool
-\bool_new:N \l_doc_meta_EXP_bool
-\bool_new:N \l_doc_meta_rEXP_bool
-\cs_new_nopar:Npn \doc_showmacro_aux:w #1 / #2 \q_stop {
+\cs_gset_nopar:Npn \function_typeset:n #1
+ {
- \tl_if_in:nnT {#2} { (TF) } {
- \bool_gset_true:N \l_doc_meta_TF_bool
- }
+ \cs_set_nopar:Npn \nextnewline{\cs_gset_nopar:Npn\nextnewline{\\}}
+ \tl_gclear:N \g_doc_macro_tl
+
+ \prop_clear:N \l_doc_functions_block_prop
+
+ \clist_map_function:nN {#1} \doc_parse_functions:n
+
+ \small\ttfamily
+ \begin{tabular}{ @{} l @{} r @{} }
+ \toprule
+ \prop_map_function:NN \l_doc_functions_block_prop \doc_show_functions:nn
+ \\
+
+ \bool_if:nF { \tl_if_empty_p:N \l_doc_date_added_tl &&
+ \tl_if_empty_p:N \l_doc_date_updated_tl }
+ { \midrule }
+
+ \tl_if_empty:NF \l_doc_date_added_tl
+ {
+ \multicolumn{2}{@{}r@{}}
+ { \scriptsize New:\,\l_doc_date_added_tl } \\
+ }
- \tl_if_in:nnT {#2} { (EXP) } {
- \bool_gset_true:N \l_doc_meta_EXP_bool
+ \tl_if_empty:NF \l_doc_date_updated_tl
+ {
+ \multicolumn{2}{@{}r@{}}
+ { \scriptsize Updated:\,\l_doc_date_updated_tl } \\
+ }
+ \bottomrule
+ \end{tabular}
+ \normalfont\normalsize
}
- \tl_if_in:nnT {#2} { (rEXP) } {
- \bool_gset_true:N \l_doc_meta_rEXP_bool
+
+\prop_new:N \l_doc_functions_block_prop
+\cs_generate_variant:Nn \prop_put:Nnn {Nxx}
+\cs_new:Nn \doc_parse_functions:n
+ {
+ \exp_args:Nxx \tl_if_head_eq_charcode:nNTF { \token_to_str:N #1 } {\cs_to_str:N \\}
+ {
+ \tl_gset_eq:NN \l_doc_function_name_prefix_tl \@backslashchar
+ % for the weird functions named "\::N" and so on:
+\exp_args:Nx \tl_if_head_eq_charcode:nNTF { \cs_to_str:N #1 } {:}
+{
+ % again, no variants:
+\prop_put:Nxx \l_doc_functions_block_prop { \cs_to_str:N #1 } { }
+}
+{
+ % finally, for regular old csnames:
+\exp_args:NNf \prop_get:NnNTF
+ \l_doc_functions_block_prop
+ { \cs_get_function_name:N #1 } \l_doc_tmp_tl
+{
+\prop_put:Nxx \l_doc_functions_block_prop
+{ \cs_get_function_name:N #1 }
+{ \l_doc_tmp_tl , \cs_get_function_signature:N #1 }
+}
+{
+\prop_put:Nxx \l_doc_functions_block_prop
+{ \cs_get_function_name:N #1 }
+{ \cs_get_function_signature:N #1 }
+}
+}
+ }
+ % for keys and things that aren't actually csnames:
+ {
+ % for now don't bother splitting into variants:
+ \tl_gclear:N \l_doc_function_name_prefix_tl
+\prop_put:Nxx \l_doc_functions_block_prop { #1 } { }
+ }
}
- \tl_if_in:nnT {#2} { (pTF) } {
- \bool_gset_true:N \l_doc_meta_TF_bool
- \bool_gset_true:N \l_doc_meta_pTF_bool
- \bool_gset_true:N \l_doc_meta_EXP_bool
+\cs_new:Nn \doc_show_functions:nn
+ {
+ \clist_gset:Nn \l_doc_variants_clist {#2}
+ \clist_gpop:NN \l_doc_variants_clist \l_doc_tmp_tl
+ \exp_args:Nx \doc_showmacro:n
+ { \exp_not:c {#1 \tl_if_empty:NF \l_doc_tmp_tl { : \l_doc_tmp_tl } } }
}
+\cs_new_nopar:Nn \doc_showmacro:n {
\bool_if:NT \l_doc_meta_pTF_bool {
- \tl_set:Nx \l_doc_pTF_name_tl { \doc_predicate_from_base:w #1 \q_nil }
- \doc_special_main_index:o { \l_doc_pTF_name_tl }
+ \tl_set:Nx \l_doc_pTF_name_tl { \doc_predicate_from_base:N #1 }
+ \doc_special_main_index:o { \token_to_str:N \l_doc_pTF_name_tl }
\seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:N \l_doc_pTF_name_tl }
}
\bool_if:NTF \l_doc_meta_TF_bool {
- \doc_special_main_index:o { #1 TF }
+ \doc_special_main_index:o { \token_to_str:N #1 TF }
\seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:n { #1 TF } }
\seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:n { #1 T } }
\seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:n { #1 F } }
}{
- \doc_special_main_index:o { #1 }
+ \doc_special_main_index:o { \token_to_str:N #1 }
\seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:n { #1 } }
}
\bool_if:NTF \l_doc_meta_pTF_bool {
\bool_gset_false:N \l_doc_meta_TF_bool
- \exp_after:wN \doc_showmacro_aux_ii:w \l_doc_pTF_name_tl ::\q_stop
+ \exp_args:Nc \doc_showmacro_aux_ii:N \l_doc_pTF_name_tl
\bool_gset_true:N \l_doc_meta_TF_bool
- \doc_showmacro_aux_ii:w #1::\q_stop
+ \exp_args:Nc \doc_showmacro_aux_ii:N { \cs_to_str:N #1 }
}{
- \exp_args:Nf \tl_if_head_eq_charcode:nNTF { \use_none:n #1 } {:}
- { \doc_showmacro_aux_iii:n {#1} }
- { \doc_showmacro_aux_ii:w #1::\q_stop }
+ \exp_args:Nx \tl_if_head_eq_charcode:nNTF { \exp_after:wN \use_none:n \token_to_str:N #1 } {:}
+ { \doc_showmacro_aux_iii:N #1 }
+ { \doc_showmacro_aux_ii:N #1 }
}
}
-\cs_set_nopar:Npn \doc_showmacro_aux_ii:w #1:#2:#3 \q_stop {
+\cs_set_nopar:Nn \doc_showmacro_aux_ii:N {
\nextnewline
- \str_if_eq:xxTF {#1} {\g_doc_macro_tl} {
- \doc_typeset_aux:n
- }{
- \tl_gset:Nn \g_doc_macro_tl {#1}
- \use:n
- }
- { \g_doc_macro_tl }
- #3
- #2
+ \tl_gset:Nx \l_doc_function_name_tl { \cs_get_function_name:N #1 }
+ \tl_gset:Nx \l_doc_function_sig_tl { \cs_get_function_signature:N #1 }
+ \tl_gset:Nx \g_doc_macro_tl { \l_doc_function_name_prefix_tl \l_doc_function_name_tl }
+
+ \g_doc_macro_tl
+ \tl_if_empty:NF \l_doc_function_sig_tl { : \l_doc_function_sig_tl }
\bool_if:NT \l_doc_meta_TF_bool { \doc_typeset_TF: }
+
&
\bool_if:NT \l_doc_meta_EXP_bool {
\hspace{\tabcolsep}
- \hyperlink{expstar}{$\star$}
+ \hyperlink{expstar} {$\star$}
}
\bool_if:NT \l_doc_meta_rEXP_bool {
\hspace{\tabcolsep}
- \hyperlink{rexpstar}{\ding{73}}% hollow star
+ \hyperlink{rexpstar} {\ding{73}} % hollow star
}
- \tl_set:Nx \g_doc_macro_tl { \tl_to_str:N \g_doc_macro_tl }
+
+ \clist_if_empty:NF \l_doc_variants_clist
+ {
+ \\
+ \doc_typeset_aux:n \g_doc_macro_tl :
+ \int_compare:nTF { \clist_length:N \l_doc_variants_clist == 1 }
+ { \l_doc_variants_clist }
+ {
+ \textrm(
+ \clist_pop:NN \l_doc_variants_clist \l_doc_tmp_tl
+ \l_doc_tmp_tl
+ \clist_map_inline:Nn \l_doc_variants_clist {\textrm|##1}
+ \textrm)
+ }
+ \bool_if:NT \l_doc_meta_TF_bool { \doc_typeset_TF: }
+ &
+ \bool_if:NT \l_doc_meta_EXP_bool {
+ \hspace{\tabcolsep}
+ \hyperlink{expstar} {$\star$}
+ }
+ \bool_if:NT \l_doc_meta_rEXP_bool {
+ \hspace{\tabcolsep}
+ \hyperlink{rexpstar} {\ding{73}} % hollow star
+ }
+ }
+
\exp_args:NNf \tl_replace_all:Nnn \g_doc_macro_tl {\token_to_str:N _} {/}
\exp_args:NNf \tl_replace_all:Nnn \g_doc_macro_tl {\@backslashchar} {}
\bool_if:NT \g_doc_full_bool {
- \exp_args:Nf\label{doc/function/\g_doc_macro_tl#3#2}
+ \exp_args:Nx \label
+ {
+ doc/function//\g_doc_macro_tl
+ \tl_if_empty:NF \l_doc_function_sig_tl { : \l_doc_function_sig_tl }
+ }
}
}
-\cs_set_nopar:Nn \doc_showmacro_aux_iii:n {
+\cs_set_nopar:Nn \doc_showmacro_aux_iii:N {
\nextnewline
- \tl_gset:Nx \g_doc_macro_tl {#1}
- #1 &
- \tl_set:Nx \g_doc_macro_tl { \tl_to_str:N \g_doc_macro_tl }
+ \tl_gset:Nx \g_doc_macro_tl { \token_to_str:N #1}
+ \token_to_str:N #1 &
+
\exp_args:NNf \tl_replace_all:Nnn \g_doc_macro_tl {\token_to_str:N _} {/}
\exp_args:NNf \tl_replace_all:Nnn \g_doc_macro_tl {\@backslashchar} {}
\bool_if:NT \g_doc_full_bool {
- \exp_args:Nf\label{doc/function/\g_doc_macro_tl}
+ \exp_args:Nx \label { doc/function//\g_doc_macro_tl }
}
}
-\dim_new:N \g_doc_syntax_dim
-\dim_set:Nn \g_doc_syntax_dim {0.7\textwidth}
\newenvironment{syntax}{
- \minipage[b]{\g_doc_syntax_dim}
- \small\ttfamily\raggedright
- \obeyspaces\obeylines
+ \small\ttfamily
+ \bool_if:NTF \l_doc_long_name_bool
+ {
+ \hcoffin_set:Nw \l_doc_syntax_coffin
+ \arrayrulecolor{white}
+ \begin{tabular}{@{}l@{}}
+ \toprule
+ \begin{minipage}
+ { \textwidth+0.75\marginparwidth-\l_doc_trial_width_dim }
+ }
+ {
+ \hcoffin_set:Nw \l_doc_syntax_coffin
+ \arrayrulecolor{white}
+ \begin{tabular}{@{}l@{}}
+ \toprule
+ \begin{minipage}{ \textwidth }
+ }
+ \raggedright
+ \obeyspaces\obeylines
}{
- \endminipage
- \hfil\break
- \global\@ignoretrue
+ \end{minipage}
+ \end{tabular}
+ \arrayrulecolor{black}
+ \hcoffin_set_end:
+ \coffin_gset_eq:NN \l_doc_syntax_coffin \l_doc_syntax_coffin
+ \ignorespacesafterend
}
\tl_map_inline:nn {0123456789} { \cs_gset_eq:cN {char_other_#1} #1 }
\group_begin:
@@ -441,8 +630,7 @@
\cs_set_eq:NN \doc_macroname_prefix:n \use:n
\cs_set_eq:NN \doc_macroname_suffix: \c_empty_tl
- \cs_set_nopar:Npn \KV_key_no_value_elt:n ##1 { \use:c {doc_macro_opt_##1:} }
- \keyval_parse:NNn \KV_key_no_value_elt:n \use_none:nn {#1}
+ \keys_set:nn { l3doc/macro } {#1}
\cs_set_eq:NN \testfile \doc_print_testfile:n
@@ -454,6 +642,10 @@
\char_set_catcode_ignore:N \^^I
\doc_macro_aux:n
}
+\keys_define:nn { l3doc/macro }
+ {
+ unknown .code:n = { \use:c{doc_macro_opt_#1:} }
+ }
\cs_new_nopar:Npn \doc_macro_aux:n #1 {
\group_end:
\cs_set:Npn \l_doc_macro_input_clist {#1}
@@ -461,34 +653,23 @@
{
\clist_map_inline:nn {#1}
{
- \tl_if_blank:nF {##1}
- {
- \exp_args:Nf \doc_macro_single
- { \doc_predicate_from_base:w ##1 \q_nil }
- }
+ \exp_args:Nf \doc_macro_single { \doc_predicate_from_base:w ##1 }
}
\bool_set_true:N \l_doc_macro_TF_bool
- \clist_map_inline:nn {#1}
- { \tl_if_blank:nF {##1} { \doc_macro_single {##1} } }
+ \clist_map_function:nN {#1} \doc_macro_single
\bool_set_false:N \l_doc_macro_TF_bool
}
- {
- \clist_map_inline:nn {#1}
- { \tl_if_blank:nF {##1} { \doc_macro_single {##1} } }
- }
+ { \clist_map_function:nN {#1} \doc_macro_single }
}
-\bool_new:N \l_doc_macro_internal_bool
-\bool_new:N \l_doc_macro_aux_bool
-\bool_new:N \l_doc_macro_TF_bool
-\bool_new:N \l_doc_macro_pTF_bool
-\bool_new:N \l_doc_macro_var_bool
\cs_set_nopar:Npn \doc_macro_opt_aux: { \bool_set_true:N \l_doc_macro_aux_bool }
\cs_set_nopar:Npn \doc_macro_opt_internal: { \bool_set_true:N \l_doc_macro_internal_bool }
\cs_set_nopar:Npn \doc_macro_opt_TF: { \bool_set_true:N \l_doc_macro_TF_bool }
\cs_set_nopar:Npn \doc_macro_opt_pTF: { \bool_set_true:N \l_doc_macro_pTF_bool }
\cs_set_nopar:Npn \doc_macro_opt_var: { \bool_set_true:N \l_doc_macro_var_bool }
-\cs_set:Npn \doc_predicate_from_base:w #1:#2 \q_nil {#1_p:#2}
-\int_new:N \l_doc_macro_int
+\cs_set:Nn \doc_predicate_from_base:N
+ {
+ \cs_get_function_name:N #1 _p: \cs_get_function_signature:N #1
+ }
\cs_set_nopar:Npn \doc_macro_single #1 {
\int_incr:N \l_doc_macro_int
\tl_set:Nx \saved@macroname { \token_to_str:N #1 }
@@ -553,14 +734,14 @@
\tl_clear:N \l_doc_macro_tl
\cs_set_nopar:Npn \doc_print_macroname:n #1 {
\strut
- \int_compare:nTF { \tl_elt_count:n {#1} <= 28 }
+ \int_compare:nTF { \tl_length:n {#1} <= 28 }
{ \MacroFont } { \MacroLongFont }
% INEFFICIENT: (!)
\exp_args:NNx \seq_if_in:NnTF \g_doc_functions_seq
{ #1 \bool_if:NT \l_doc_macro_TF_bool { \tl_to_str:n {TF} } }
{
- \hyperref [doc/function/\l_doc_macro_tl]
+ \hyperref [doc/function//\l_doc_macro_tl]
}
{ \use:n }
{
@@ -581,7 +762,7 @@
}
}
\cs_set_nopar:Npn \doc_typeset_aux:n #1 {
- {\color[gray]{0.5} #1}
+ {\color[gray]{0.7} #1}
}
\DeclareDocumentCommand \doc_print_testfile:n {m} {
\bool_set_true:N \l_doc_tested_bool
@@ -595,7 +776,6 @@
}
}
}
-\seq_new:N \g_doc_testfiles_seq
\DeclareDocumentCommand \TestFiles {m} {
\par
{\itshape
@@ -607,7 +787,6 @@
\testfile*
}
\cs_generate_variant:Nn \prop_gput:Nnn {NVx}
-\prop_new:N \g_doc_missing_tests_prop
\DeclareDocumentCommand \TestMissing {m} {
\prop_if_in:NVTF \g_doc_missing_tests_prop \l_doc_macro_input_clist
{
@@ -621,7 +800,6 @@
}
{ \prop_gput:NVn \g_doc_missing_tests_prop \l_doc_macro_input_clist {#1} }
}
-\int_new:N \g_doc_nested_macro_int
\cs_set:Nn \doc_texttt_comma:n {\,,~\texttt{#1}}
\cs_set:Npn \endmacro {
\int_compare:nT {\g_doc_nested_macro_int<1}
@@ -661,7 +839,7 @@
\bool_if:NTF \l_doc_macro_var_bool{variable}{function}
\int_compare:nNnTF \l_doc_macro_int=1 {~is~}{s~are~}
documented~on~page~
- \exp_args:Nx\pageref{doc/function/\l_doc_macro_tl}.
+ \exp_args:Nx\pageref{doc/function//\l_doc_macro_tl}.
}
})\par}
}
@@ -772,7 +950,6 @@
xxxx\=#1\=\kill
}
{\par\bigskip}
-\bool_new:N \g_doc_implementation_bool
\cs_set_nopar:Npn \AlsoImplementation {
\bool_set_true:N \g_doc_implementation_bool
\cs_set:Npn \StopEventually ##1 {
@@ -791,7 +968,6 @@
}
\cs_set_eq:NN \Finale \relax
\cs_set_nopar:Npn \partname{File}
-\clist_new:N \g_docinput_clist
\cs_set:Npn \DocInput #1 {
\clist_map_inline:nn {#1} {
\clist_put_right:Nn \g_docinput_clist {##1}
@@ -895,9 +1071,6 @@
}
\cs_set_eq:NN \@evenfoot \@oddfoot
}
-\seq_new:N \g_doc_functions_seq
-\seq_new:N \g_doc_macros_seq
-\seq_new:N \g_doc_not_tested_seq
\iow_open:Nn \g_write_func_stream { \jobname.cmds }
\cs_new_nopar:Npn \doc_show_functions_defined: {
\bool_if:nT { \g_doc_implementation_bool && \g_doc_checkfunc_bool } {