diff options
author | Karl Berry <karl@freefriends.org> | 2014-08-26 17:33:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-08-26 17:33:09 +0000 |
commit | 6c4cd2ab2f8d1ebe3a051d700c3005d73eefe04c (patch) | |
tree | 16833d474c6532347c42dee6b34fa77aed22eca6 /Master/texmf-dist/tex/latex/l3kernel/l3doc.cls | |
parent | 097e7dc0afa442be238a967b292237470680626e (diff) |
l3 (26aug14)
git-svn-id: svn://tug.org/texlive/trunk@35045 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/l3doc.cls')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3doc.cls | 2883 |
1 files changed, 1600 insertions, 1283 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls index 68d8ada8b0f..f4467321a8f 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls +++ b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls @@ -50,7 +50,7 @@ \let \fileversionOld \ExplFileVersion \let \filedescriptionOld \ExplFileDescription \RequirePackage{expl3,xparse,calc} -\GetIdInfo$Id: l3doc.dtx 5204 2014-07-15 09:56:33Z mittelba $ +\GetIdInfo$Id: l3doc.dtx 5353 2014-08-23 01:23:51Z bruno $ {L3 Experimental documentation class} \ProvidesExplClass {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -58,62 +58,169 @@ \let \ExplFileDate \filedateOld \let \ExplFileVersion \fileversionOld \let \ExplFileDescription \filedescriptionOld -\coffin_new:N \l__codedoc_output_box +\cs_generate_variant:Nn \tl_count:n { f } +\cs_generate_variant:Nn \tl_greplace_all:Nnn { Nx } +\cs_generate_variant:Nn \tl_if_head_eq_charcode:nNTF { o } +\cs_generate_variant:Nn \tl_if_head_eq_charcode:nNT { o } +\cs_generate_variant:Nn \tl_if_head_eq_charcode:nNF { o } +\cs_generate_variant:Nn \tl_if_in:NnTF { No } +\cs_generate_variant:Nn \tl_if_in:NnT { No } +\cs_generate_variant:Nn \tl_if_in:NnF { No } +\cs_generate_variant:Nn \tl_remove_all:Nn { Nx } +\cs_generate_variant:Nn \tl_replace_all:Nnn { Nx , Nnx, No , Nno } +\cs_generate_variant:Nn \tl_replace_once:Nnn { Noo } +\cs_generate_variant:Nn \prop_get:NnNTF { Nx } +\cs_generate_variant:Nn \prop_put:Nnn { Nx } +\cs_generate_variant:Nn \prop_gput:Nnn { NVx } +\cs_new_protected:Npn \__codedoc_replace_at_at:N #1 + { + \tl_if_empty:NF \g__codedoc_module_name_tl + { + \exp_args:NNo \__codedoc_replace_at_at_aux:Nn + #1 \g__codedoc_module_name_tl + } + } +\cs_new_protected:Npn \__codedoc_replace_at_at_aux:Nn #1#2 + { + \tl_replace_all:Non #1 { \token_to_str:N @ } { @ } + \tl_replace_all:Non #1 { \token_to_str:N _ } { _ } + \tl_replace_all:Nnn #1 { _ @ @ } { _ _ #2 } + \tl_replace_all:Nnn #1 { @ @ } { _ _ #2 } + } +\cs_new_protected:Npn \__codedoc_verb_get_seq:nN #1#2 + { + \tl_set:Nx \l__codedoc_tmpa_tl { \tl_to_str:n {#1} } + \tl_remove_all:Nx \l__codedoc_tmpa_tl + { \iow_char:N \^^M \iow_char:N \% } + \tl_remove_all:Nx \l__codedoc_tmpa_tl { \tl_to_str:n { ^ ^ A } } + \tl_remove_all:Nx \l__codedoc_tmpa_tl { \iow_char:N \^^I } + \tl_remove_all:Nx \l__codedoc_tmpa_tl { \iow_char:N \^^M } + \__codedoc_replace_at_at:N \l__codedoc_tmpa_tl + \exp_args:NNx \seq_set_from_clist:Nn #2 + { \tl_to_str:N \l__codedoc_tmpa_tl } + } +\cs_new:Npn \__codedoc_signature_base_form:n #1 + { \__codedoc_signature_base_form_aux:n #1 \c_empty_tl } +\cs_new:Npn \__codedoc_signature_base_form_aux:n #1 + { + \str_case:nnTF {#1} + { + { N } { N } + { c } { N } + { n } { n } + { o } { n } + { f } { n } + { x } { n } + { V } { n } + { v } { n } + } + { \__codedoc_signature_base_form_aux:n } + {#1} + } +\cs_new:Npn \__codedoc_predicate_from_base:N #1 + { + \__cs_get_function_name:N #1 _p: + \__cs_get_function_signature:N #1 + } +\cs_new_protected:Npn \CodedocUseCs #1 { \use:c { \tl_to_str:n {#1} } } +\cs_new:Npn \CodedocUnexpandedTokens #1 # + { \use:c { CodedocUnexpandedTokens ~ } \__codedoc_exp_not:n } +\cs_new_protected:cpn { CodedocUnexpandedTokens ~ } #1#2 {#2} +\cs_new:Npn \__codedoc_exp_not:n #1 { \exp_not:n { \__codedoc_exp_not:n {#1} } } +\clist_new:N \g_docinput_clist +\seq_new:N \g_doc_functions_seq +\seq_new:N \g_doc_macros_seq +\coffin_new:N \l__codedoc_output_coffin \coffin_new:N \l__codedoc_names_coffin \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_long_name_bool -\bool_new:N \g__codedoc_implementation_bool \dim_new:N \l__codedoc_trial_width_dim -\tl_new:N \l__codedoc_macro_tl -\int_new:N \l__codedoc_macro_int -\int_new:N \g__codedoc_nested_macro_int +\int_new:N \l__codedoc_nested_macro_int +\bool_new:N \l__codedoc_macro_tested_bool \prop_new:N \g__codedoc_missing_tests_prop -\clist_new:N \g_docinput_clist -\tl_new:N \l__codedoc_at_replaced_macro_tl -\seq_new:N \g__codedoc_testfiles_seq -\seq_new:N \g_doc_functions_seq -\seq_new:N \g_doc_macros_seq \seq_new:N \g__codedoc_not_tested_seq -\bool_new:N \l__codedoc_meta_TF_bool -\bool_new:N \l__codedoc_meta_pTF_bool -\bool_new:N \l__codedoc_meta_EXP_bool -\bool_new:N \l__codedoc_meta_rEXP_bool +\seq_new:N \g__codedoc_testfiles_seq \bool_new:N \l__codedoc_macro_internal_bool \bool_new:N \l__codedoc_macro_aux_bool \bool_new:N \l__codedoc_macro_TF_bool \bool_new:N \l__codedoc_macro_pTF_bool +\bool_new:N \l__codedoc_macro_EXP_bool +\bool_new:N \l__codedoc_macro_rEXP_bool \bool_new:N \l__codedoc_macro_var_bool -\bool_new:N \g__codedoc_full_bool \bool_new:N \g__codedoc_lmodern_bool \bool_new:N \g__codedoc_checkfunc_bool \bool_new:N \g__codedoc_checktest_bool -\seq_new:N \g__codedoc_tmpa_seq \tl_new:N \l__codedoc_tmpa_tl \tl_new:N \l__codedoc_tmpb_tl \int_new:N \l__codedoc_tmpa_int -\bool_new:N \l__codedoc_tested_bool -\DeclareOption{a5paper}{\@latexerr{Option not supported}{}} -\DeclareOption{full}{ \bool_set_true:N \g__codedoc_full_bool } -\DeclareOption{onlydoc}{ \bool_set_false:N \g__codedoc_full_bool } -\DeclareOption{check}{ \bool_set_true:N \g__codedoc_checkfunc_bool } -\DeclareOption{nocheck}{ \bool_set_false:N \g__codedoc_checkfunc_bool } -\DeclareOption{checktest}{ \bool_set_true:N \g__codedoc_checktest_bool } -\DeclareOption{nochecktest}{ \bool_set_false:N \g__codedoc_checktest_bool } -\DeclareOption{cm-default}{ \bool_set_false:N \g__codedoc_lmodern_bool } -\DeclareOption{lm-default}{ \bool_set_true:N \g__codedoc_lmodern_bool } -\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} -\ExecuteOptions{full,a4paper,nocheck,nochecktest,lm-default} -\msg_new:nnn {l3doc} {input-cfg} - { - Local~config~file~l3doc.cfg~loaded. - } -\file_if_exist:nT {l3doc.cfg} - { - \file_input:n {l3doc.cfg} - \msg_info:nn {l3doc} {input-cfg} - } +\prop_new:N \l__codedoc_functions_block_prop +\seq_new:N \l__codedoc_function_input_seq +\seq_new:N \l__codedoc_macro_input_seq +\tl_const:Nx \c__codedoc_backslash_tl { \iow_char:N \\ } +\exp_last_unbraced:NNo + \cs_new_eq:NN \c__codedoc_backslash_token { \c__codedoc_backslash_tl } +\tl_new:N \g__codedoc_function_name_prefix_tl +\tl_new:N \l__codedoc_index_macro_tl +\tl_new:N \l__codedoc_index_key_tl +\tl_new:N \l__codedoc_index_module_tl +\tl_new:N \g__codedoc_module_name_tl +\tl_const:Nn \c__codedoc_iow_rule_tl + { ======================================== } +\tl_const:Nn \c__codedoc_iow_mid_rule_tl + { -------------------------------------- } +\box_new:N \l__codedoc_macro_index_box +\box_new:N \l__codedoc_macro_box +\int_new:N \l__codedoc_macro_int +\tl_new:N \l__codedoc_cmd_tl +\tl_new:N \l__codedoc_cmd_index_tl +\bool_new:N \l__codedoc_cmd_replace_bool +\bool_new:N \l__codedoc_in_implementation_bool +\bool_new:N \g__codedoc_typeset_documentation_bool +\bool_new:N \g__codedoc_typeset_implementation_bool +\bool_set_true:N \g__codedoc_typeset_documentation_bool +\bool_set_true:N \g__codedoc_typeset_implementation_bool +\tl_new:N \g__codedoc_base_name_tl +\prop_new:N \l__codedoc_variants_prop +\bool_new:N \l__codedoc_no_label_bool +\cs_new_eq:NN \__codedoc_tmpa:w ? +\cs_new_eq:NN \__codedoc_tmpb:w ? +\DeclareOption { a5paper } { \@latexerr { Option~not~supported } { } } +\DeclareOption { full } + { + \bool_gset_true:N \g__codedoc_typeset_documentation_bool + \bool_gset_true:N \g__codedoc_typeset_implementation_bool + } +\DeclareOption { onlydoc } + { + \bool_gset_true:N \g__codedoc_typeset_documentation_bool + \bool_gset_false:N \g__codedoc_typeset_implementation_bool + } +\DeclareOption { check } + { \bool_gset_true:N \g__codedoc_checkfunc_bool } +\DeclareOption { nocheck } + { \bool_gset_false:N \g__codedoc_checkfunc_bool } +\DeclareOption { checktest } + { \bool_gset_true:N \g__codedoc_checktest_bool } +\DeclareOption { nochecktest } + { \bool_gset_false:N \g__codedoc_checktest_bool } +\DeclareOption { cm-default } + { \bool_gset_false:N \g__codedoc_lmodern_bool } +\DeclareOption { lm-default } + { \bool_gset_true:N \g__codedoc_lmodern_bool } +\DeclareOption* { \PassOptionsToClass { \CurrentOption } { article } } +\ExecuteOptions { full, a4paper, nocheck, nochecktest, lm-default } +\msg_new:nnn { l3doc } { input-cfg } + { Local~config~file~l3doc.cfg~loaded. } +\file_if_exist:nT { l3doc.cfg } + { + \file_input:nT { l3doc.cfg } + { + \cs_if_exist:cF { ExplMakeTitle } + { \msg_info:nn { l3doc } { input-cfg } } + } + } \ProcessOptions \LoadClass{article} \RequirePackage{doc} @@ -138,862 +245,1158 @@ verbatim } \raggedbottom -\fvset{gobble=2} -\cs_set_eq:NN \verbatim \Verbatim -\cs_set_eq:NN \endverbatim \endVerbatim \bool_if:NT \g__codedoc_lmodern_bool - { - \RequirePackage[T1]{fontenc} - \RequirePackage{lmodern} - \group_begin: - \ttfamily - \DeclareFontShape{T1}{lmtt}{m}{it}{<->ec-lmtto10}{} - \group_end: - } + { + \RequirePackage[T1]{fontenc} + \RequirePackage{lmodern} + \group_begin: + \ttfamily + \DeclareFontShape{T1}{lmtt}{m}{it}{<->ec-lmtto10}{} + \group_end: + } \RequirePackage{hypdoc} -\cs_set_nopar:Npn \MakePrivateLetters - { - \char_set_catcode_letter:N \@ - \char_set_catcode_letter:N \_ - \char_set_catcode_letter:N \: - } +\cs_gset_nopar:Npn \MakePrivateLetters + { + \char_set_catcode_letter:N \@ + \char_set_catcode_letter:N \_ + \char_set_catcode_letter:N \: + } \setcounter{StandardModuleDepth}{1} \@addtoreset{CodelineNo}{part} \tl_replace_once:Nnn \theCodelineNo - { \HDorg@theCodelineNo } - { \textcolor[gray]{0.5} { \sffamily\tiny\arabic{CodelineNo} } } + { \HDorg@theCodelineNo } + { \textcolor[gray]{0.5} { \sffamily\tiny\arabic{CodelineNo} } } +\fvset{gobble=2} +\cs_gset_eq:NN \verbatim \Verbatim +\cs_gset_eq:NN \endverbatim \endVerbatim \setlength \textwidth { 385pt } \addtolength \marginparwidth { 30pt } \addtolength \oddsidemargin { 20pt } \addtolength \evensidemargin { 20pt } -\cs_set_eq:NN \__codedoc_oldlist:nn \list -\cs_set_nopar:Npn \list #1 #2 { \__codedoc_oldlist:nn {#1} { #2 \listparindent\z@ } } +\cs_new_eq:NN \__codedoc_oldlist:nn \list +\cs_gset_nopar:Npn \list #1 #2 + { \__codedoc_oldlist:nn {#1} { #2 \dim_zero:N \listparindent } } \setlength \parindent { 2em } \setlength \itemindent { 0pt } \setlength \parskip { 0pt plus 3pt minus 0pt } +\tl_gset:Nn \partname {File} \@addtoreset{section}{part} -\cs_set_nopar:Npn \l@section #1#2 - { - \ifnum \c@tocdepth >\z@ - \addpenalty\@secpenalty - \addvspace{1.0em \@plus\p@} - \setlength\@tempdima{2.5em} % was 1.5em - \begingroup - \parindent \z@ \rightskip \@pnumwidth - \parfillskip -\@pnumwidth - \leavevmode \bfseries - \advance\leftskip\@tempdima - \hskip -\leftskip - #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par - \endgroup - \fi - } -\cs_set_nopar:Npn\l@subsection{\@dottedtocline{2}{2.5em}{2.3em}} % #2 = 1.5em +\cs_gset_nopar:Npn \l@section #1#2 + { + \ifnum \c@tocdepth >\z@ + \addpenalty\@secpenalty + \addvspace{1.0em \@plus\p@} + \setlength\@tempdima{2.5em} % was 1.5em + \begingroup + \parindent \z@ \rightskip \@pnumwidth + \parfillskip -\@pnumwidth + \leavevmode \bfseries + \advance\leftskip\@tempdima + \hskip -\leftskip + #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par + \endgroup + \fi + } +\cs_gset_nopar:Npn \l@subsection + { \@dottedtocline{2}{2.5em}{2.3em} } % #2 = 1.5em \AtBeginDocument - { - \MakeShortVerb \" - \MakeShortVerb \| - } + { + \MakeShortVerb \" + \MakeShortVerb \| + } +\AtEndDocument + { + \DeleteShortVerb \" + \DeleteShortVerb \| + } \providecommand*\eTeX{\hologo{eTeX}} \providecommand*\IniTeX{\hologo{iniTeX}} \providecommand*\Lua{Lua} \providecommand*\LuaTeX{\hologo{LuaTeX}} \providecommand*\pdfTeX{\hologo{pdfTeX}} \providecommand*\XeTeX{\hologo{XeTeX}} -\DeclareDocumentCommand \cmd {m} { \__codedoc_cmd:n { #1 } } -\DeclareDocumentCommand \cs {m} { \__codedoc_cs:n { #1 } } -\cs_new:Npn \__codedoc_cmd:n #1 { \cs{ \expandafter \__codedoc_cmd_to_cs:w \string#1 } } -\cs_set_nopar:Npn \__codedoc_cmd_to_cs:w #1#2 { \char\number`#2\relax } -\cs_new:Npn \__codedoc_cs:n #1 - { - \tl_set_rescan:Nnn \l__codedoc_tmpb_tl { } { _ } - \tl_set:Nn \l__codedoc_tmpa_tl {#1} - \tl_replace_all:NVn \l__codedoc_tmpa_tl \l__codedoc_tmpb_tl { _ } - \__codedoc_replace_at_at:N \l__codedoc_tmpa_tl - \tl_replace_all:NnV \l__codedoc_tmpa_tl { _ } \l__codedoc_tmpb_tl - \texttt { \char`\\ \tl_use:N \l__codedoc_tmpa_tl} - } -\cs_generate_variant:Nn \tl_replace_all:Nnn { NV , NnV } -\providecommand\marg[1]{ \texttt{\char`\{} \meta{#1} \texttt{\char`\}} } +\DeclareExpandableDocumentCommand \cmd { O{} m } + { \__codedoc_cmd:no {#1} { \token_to_str:N #2 } } +\DeclareExpandableDocumentCommand \cs { O{} m } + { \__codedoc_cmd:no {#1} { \c__codedoc_backslash_tl #2 } } +\DeclareExpandableDocumentCommand \tn { O{} m } + { + \__codedoc_cmd:no + { index = TeX , replace = false , #1 } + { \c__codedoc_backslash_tl #2 } + } +\DeclareExpandableDocumentCommand { \meta } { m } + { \__codedoc_meta:n {#1} } +\newcommand\Arg[1] + { \texttt{\char`\{} \meta{#1} \texttt{\char`\}} } +\providecommand\marg[1]{ \Arg{#1} } \providecommand\oarg[1]{ \texttt[ \meta{#1} \texttt] } \providecommand\parg[1]{ \texttt( \meta{#1} \texttt) } -\cs_set_eq:NN \file \nolinkurl +\DeclareRobustCommand \file {\nolinkurl} \DeclareRobustCommand \env {\texttt} \DeclareRobustCommand \pkg {\textsf} \DeclareRobustCommand \cls {\textsf} -\newenvironment{texnote} - { - \endgraf - \vspace{3mm} - \small\textbf{\TeX~hackers~note:} - } - { - \vspace{3mm} - } -\DeclareDocumentCommand \tn {m} - { - \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 \__codedoc_implementation: - { - \DeclareDocumentCommand {\variable} { O{} } { \__codedoc_macro:n { var , ##1 } } - \cs_set_eq:NN \endvariable \endmacro - } -\cs_new:Npn \__codedoc_docu: - { - \cs_set_eq:NN \variable \variabledoc - \cs_set_eq:NN \endvariable \endvariabledoc - } -\AtEndOfPackage{\__codedoc_docu:} -\newenvironment{documentation}{\__codedoc_docu:}{} -\newenvironment{implementation}{\__codedoc_implementation:}{} -\NewDocumentCommand \EnableDocumentation {} - { - \renewenvironment{documentation}{\__codedoc_docu:}{} - } -\NewDocumentCommand \EnableImplementation {} - { - \renewenvironment{implementation}{\__codedoc_implementation:}{} - } -\NewDocumentCommand \DisableDocumentation {} - { - \cs_set_eq:NN \documentation \comment - \cs_set_eq:NN \enddocumentation \endcomment - } -\NewDocumentCommand \DisableImplementation {} - { - \cs_set_eq:NN \implementation \comment - \cs_set_eq:NN \endimplementation \endcomment - } -\newenvironment{arguments} - { - \enumerate[ - nolistsep, - label=\texttt{\#\arabic*}~:, - labelsep=*, - ] - } - { - \endenumerate - } -\keys_define:nn { l3doc/function } - { - TF .code:n = - { - \bool_gset_true:N \l__codedoc_meta_TF_bool - } , - EXP .code:n = - { - \bool_gset_true:N \l__codedoc_meta_EXP_bool - \bool_gset_false:N \l__codedoc_meta_rEXP_bool - } , - rEXP .code:n = - { - \bool_gset_false:N \l__codedoc_meta_EXP_bool - \bool_gset_true:N \l__codedoc_meta_rEXP_bool - } , - pTF .code:n = - { - \bool_gset_true:N \l__codedoc_meta_pTF_bool - \bool_gset_true:N \l__codedoc_meta_TF_bool - \bool_gset_true:N \l__codedoc_meta_EXP_bool - } , - added .tl_set:N = \l__codedoc_date_added_tl , - updated .tl_set:N = \l__codedoc_date_updated_tl , - tested .code:n = { } , - } -\char_set_catcode_active:N \< -\DeclareDocumentEnvironment {function} { O{} } - { - - \par\bigskip\noindent - \phantomsection - - \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_names_coffin - - \bool_set_false:N \l__codedoc_meta_TF_bool - \bool_set_false:N \l__codedoc_meta_pTF_bool - \bool_set_false:N \l__codedoc_meta_EXP_bool - \bool_set_false:N \l__codedoc_meta_rEXP_bool - - \keys_set:nn { l3doc/function } {#1} - - \char_set_active_eq:NN < \__codedoc_open_meta:w - - \group_begin: - \MakePrivateLetters - \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 - \exp_after:wN - \group_end: - \__codedoc_function:n - } - { - \vcoffin_set_end: - \hcoffin_set:Nn \l__codedoc_syntax_coffin { \box_use:N \g__codedoc_syntax_box } - \bool_if:NTF \l__codedoc_long_name_bool - { - \coffin_join:NnnNnnnn - \l__codedoc_output_box {hc} {vc} - \l__codedoc_syntax_coffin {l} {T} - {0pt} {0pt} - \coffin_join:NnnNnnnn - \l__codedoc_output_box {l} {t} - \l__codedoc_names_coffin {r} {t} - {-\marginparsep} {0pt} - \coffin_join:NnnNnnnn - \l__codedoc_output_box {l} {b} - \l__codedoc_descr_coffin {l} {t} - {0.75\marginparwidth + \marginparsep} {-\medskipamount} - - \coffin_typeset:Nnnnn \l__codedoc_output_box {\l__codedoc_descr_coffin-l} {\l__codedoc_descr_coffin-t} {0pt} {0pt} - } - { - \coffin_join:NnnNnnnn - \l__codedoc_output_box {hc} {vc} - \l__codedoc_syntax_coffin {l} {t} - {0pt} {0pt} - \coffin_join:NnnNnnnn - \l__codedoc_output_box {l} {b} - \l__codedoc_descr_coffin {l} {t} - {0pt} {-\medskipamount} - \coffin_join:NnnNnnnn - \l__codedoc_output_box {l} {t} - \l__codedoc_names_coffin {r} {t} - {-\marginparsep} {0pt} - - \coffin_typeset:Nnnnn - \l__codedoc_output_box {\l__codedoc_syntax_coffin-l} {\l__codedoc_syntax_coffin-T} - {0pt} {0pt} - } - \par - \allowbreak - } -\char_set_catcode_other:N \< -\cs_set_eq:NN \variabledoc \function -\cs_set_eq:NN \endvariabledoc \endfunction -\cs_set_nopar:Npn \__codedoc_function:n #1 - { - - \tl_set:Nn \l__codedoc_function_input_tl {#1} - - \dim_zero:N \l__codedoc_trial_width_dim - \hcoffin_set:Nn \l__codedoc_names_coffin { \function_typeset:n {#1} } - \dim_set:Nn \l__codedoc_trial_width_dim { \box_wd:N \l__codedoc_names_coffin } - - \bool_set:Nn \l__codedoc_long_name_bool - { \dim_compare_p:nNn \l__codedoc_trial_width_dim > \marginparwidth } - - \vcoffin_set:Nnw \l__codedoc_descr_coffin {\textwidth} - \noindent\ignorespaces - } -\cs_gset_nopar:Npn \function_typeset:n #1 %^^A todo: use "\cs_new:Npn" here - { - \tl_gclear:N \g__codedoc_macro_tl - - % populate "\l__codedoc_functions_block_prop" with info on the functions present: - % with a hack as we don't currently read verbatim and that means that - % \q_recursion_tail is an issue! - \str_if_eq:nnTF {#1} { \q_recursion_tail } +\NewDocumentCommand \EnableDocumentation { } + { \bool_gset_true:N \g__codedoc_typeset_documentation_bool } +\NewDocumentCommand \EnableImplementation { } + { \bool_gset_true:N \g__codedoc_typeset_implementation_bool } +\NewDocumentCommand \DisableDocumentation { } + { \bool_gset_false:N \g__codedoc_typeset_documentation_bool } +\NewDocumentCommand \DisableImplementation { } + { \bool_gset_false:N \g__codedoc_typeset_implementation_bool } +\NewDocumentEnvironment { documentation } { } + { + \bool_if:NTF \g__codedoc_typeset_documentation_bool + { \bool_set_false:N \l__codedoc_in_implementation_bool } + { \comment } + } + { \bool_if:NF \g__codedoc_typeset_documentation_bool { \endcomment } } +\NewDocumentEnvironment { implementation } { } + { + \bool_if:NTF \g__codedoc_typeset_implementation_bool + { \bool_set_true:N \l__codedoc_in_implementation_bool } + { \comment } + } + { \bool_if:NF \g__codedoc_typeset_implementation_bool { \endcomment } } +\DeclareDocumentEnvironment { variable } { O{} +v } + { + \bool_if:NTF \l__codedoc_in_implementation_bool + { \__codedoc_macro:nnw { var , #1 } {#2} } + { \__codedoc_function:nnw {#1} {#2} } + } + { + \bool_if:NTF \l__codedoc_in_implementation_bool + { \__codedoc_macro_end: } + { \__codedoc_function_end: } + } +\DeclareDocumentEnvironment { function } { O{} +v } + { \__codedoc_function:nnw {#1} {#2} } + { \__codedoc_function_end: } +\DeclareDocumentEnvironment { macro } { O{} +v } + { \__codedoc_macro:nnw {#1} {#2} } + { \__codedoc_macro_end: } +\NewDocumentEnvironment { syntax } { } + { \__codedoc_syntax:w } + { + \__codedoc_syntax_end: + \ignorespacesafterend + } +\NewDocumentEnvironment { texnote } { } + { + \endgraf + \vspace{3mm} + \small\textbf{\TeX~hackers~note:} + } + { + \vspace{3mm} + } +\NewDocumentEnvironment { arguments } { } + { + \enumerate [ + nolistsep , + label = \texttt{\#\arabic*} ~ : , + labelsep = * , + ] + } + { + \endenumerate + } +\keys_define:nn { l3doc/cmd } + { + index .tl_set:N = \l__codedoc_cmd_index_tl , + replace .bool_set:N = \l__codedoc_cmd_replace_bool , + } +\cs_new:Npn \__codedoc_cmd:nn #1#2 + { + \texorpdfstring + { + \CodedocUnexpandedTokens + { \CodedocUseCs { __codedoc_cmd_aux:nn } {#1} {#2} } + } + {#2} + } +\cs_generate_variant:Nn \__codedoc_cmd:nn { no } +\cs_new_protected:Npn \__codedoc_cmd_aux:nn #1#2 + { + \bool_set_true:N \l__codedoc_cmd_replace_bool + \tl_set:Nn \l__codedoc_cmd_index_tl { \q_no_value } + \keys_set:nn { l3doc/cmd } {#1} + \tl_set:No \l__codedoc_cmd_tl { \token_to_str:N #2 } + \bool_if:NT \l__codedoc_cmd_replace_bool + { + \tl_set_rescan:Nnn \l__codedoc_tmpb_tl { } { _ } + \tl_replace_all:Non \l__codedoc_cmd_tl \l__codedoc_tmpb_tl { _ } + \__codedoc_replace_at_at:N \l__codedoc_cmd_tl + \tl_replace_all:Nno \l__codedoc_cmd_tl { _ } \l__codedoc_tmpb_tl + } + \mode_if_math:T { \mbox } { - \prop_put:Nxx \l__codedoc_functions_block_prop - { \cs_to_str:N \q_recursion_tail } - { { -1 } { } } + \verbatim@font + \int_compare:nNnF + { \tl_count:N \l__codedoc_cmd_tl } + < { \tl_count:f { \tl_to_str:N \l__codedoc_cmd_tl } } + { + \tl_set:Nx \l__codedoc_cmd_tl { \tl_to_str:N \l__codedoc_cmd_tl } + \tl_replace_all:Non \l__codedoc_cmd_tl + { \token_to_str:N _ } { \_ } + } + \tl_replace_all:Nnn \l__codedoc_cmd_tl { ~ } { \@xobeysp } + \l__codedoc_cmd_tl } - { \clist_map_function:nN {#1} \__codedoc_parse_functions:n } - - \small\ttfamily - \begin{tabular}{ @{} l @{} r @{} } - \toprule - \prop_map_function:NN \l__codedoc_functions_block_prop \__codedoc_typeset_functions:nn - \__codedoc_typeset_dates: - \bottomrule - \end{tabular} - \normalfont\normalsize - } -\prop_new:N \l__codedoc_functions_block_prop -\cs_generate_variant:Nn \prop_put:Nnn {Nxx} -\cs_new:Nn \__codedoc_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__codedoc_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__codedoc_functions_block_prop { \cs_to_str:N #1 } { {-1} {} } - } - { - % finally, for regular old csnames: - \exp_args:NNf \prop_get:NnNTF - \l__codedoc_functions_block_prop - { \__cs_get_function_name:N #1 } \l__codedoc_tmpb_tl - { - \prop_put:Nxx \l__codedoc_functions_block_prop - { \__cs_get_function_name:N #1 } - { - \l__codedoc_tmpb_tl , - {\__cs_count_signature:N #1} - {\__cs_get_function_signature:N #1} - } - } - { - \prop_put:Nxx \l__codedoc_functions_block_prop - { \__cs_get_function_name:N #1 } + \exp_args:No \__codedoc_key_get:n { \l__codedoc_cmd_tl } + \quark_if_no_value:NF \l__codedoc_cmd_index_tl + { \tl_set_eq:NN \l__codedoc_index_module_tl \l__codedoc_cmd_index_tl } + \__codedoc_special_index_module:ooon + { \l__codedoc_index_key_tl } + { \l__codedoc_index_macro_tl } + { \l__codedoc_index_module_tl } + { } + } +\cs_new:Npn \__codedoc_meta:n #1 + { + \texorpdfstring + { + \CodedocUnexpandedTokens + { \CodedocUseCs { __codedoc_meta_aux:n } {#1} } + } + { < #1 > } + } +\cs_new_protected:Npn \__codedoc_meta_aux:n #1 + { + \tl_set:Nn \l__codedoc_tmpa_tl {#1} + \tl_map_inline:nn + { { 3 } { 4 } { 7 } { 8 } { 11 } { 12 } { 13 } } + { + \tl_set_rescan:Nnn \l__codedoc_tmpb_tl + { \char_set_catcode:nn { `_ } {##1} } { _ } + \tl_replace_all:Non \l__codedoc_tmpa_tl \l__codedoc_tmpb_tl + { \__codedoc_ensuremath_sb:n } + } + \exp_args:NV \__codedoc_meta_original:n \l__codedoc_tmpa_tl + } +\cs_new_protected:Npn \__codedoc_ensuremath_sb:n #1 + { \ensuremath { \sb {#1} } } +\cs_new_protected:Npn \__codedoc_meta_original:n #1 + { + \ensuremath \langle + \mode_if_math:T { \nfss@text } + { + \meta@font@select + \edef \meta@hyphen@restore + { \hyphenchar \the \font \the \hyphenchar \font } + \hyphenchar \font \m@ne + \language \l@nohyphenation + #1 \/ + \meta@hyphen@restore + } + \ensuremath \rangle + } +\keys_define:nn { l3doc/function } + { + TF .code:n = + { + \bool_set_true:N \l__codedoc_macro_TF_bool + } , + EXP .code:n = + { + \bool_set_true:N \l__codedoc_macro_EXP_bool + \bool_set_false:N \l__codedoc_macro_rEXP_bool + } , + rEXP .code:n = + { + \bool_set_false:N \l__codedoc_macro_EXP_bool + \bool_set_true:N \l__codedoc_macro_rEXP_bool + } , + pTF .code:n = + { + \bool_set_true:N \l__codedoc_macro_pTF_bool + \bool_set_true:N \l__codedoc_macro_TF_bool + \bool_set_true:N \l__codedoc_macro_EXP_bool + \bool_set_false:N \l__codedoc_macro_rEXP_bool + } , + added .tl_set:N = \l__codedoc_date_added_tl , + updated .tl_set:N = \l__codedoc_date_updated_tl , + tested .code:n = { } , + no-label .bool_set:N = \l__codedoc_no_label_bool , + } +\cs_new_protected:Npn \__codedoc_function:nnw #1#2 + { + \__codedoc_function_typeset_start: + \__codedoc_function_init: + \keys_set:nn { l3doc/function } {#1} + \__codedoc_verb_get_seq:nN {#2} \l__codedoc_function_input_seq + \__codedoc_function_parse: + \__codedoc_function_typeset: + \__codedoc_function_descr_start:w + } +\cs_new_protected_nopar:Npn \__codedoc_function_end: + { + \__codedoc_function_descr_stop: + \__codedoc_function_assemble: + \__codedoc_function_typeset_stop: + } +\cs_new_protected_nopar:Npn \__codedoc_function_typeset_start: + { + \par \bigskip \noindent + \phantomsection + } +\cs_new_protected_nopar:Npn \__codedoc_function_typeset_stop: + { + \par + \allowbreak + } +\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_names_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_EXP_bool + \bool_set_false:N \l__codedoc_macro_rEXP_bool + \bool_set_false:N \l__codedoc_no_label_bool + \char_set_active:Npn < ##1 > { \meta {##1} } + } +\cs_new_protected_nopar:Npn \__codedoc_function_parse: + { + \seq_map_function:NN + \l__codedoc_function_input_seq + \__codedoc_function_parse_one:n + } +\cs_new_protected:Npn \__codedoc_function_parse_one:n #1 + { + \tl_if_head_eq_charcode:nNTF {#1} \c__codedoc_backslash_token + { + \tl_gset_eq:NN \g__codedoc_function_name_prefix_tl \c__codedoc_backslash_tl + \exp_args:No \tl_if_head_eq_charcode:nNTF { \use_none:n #1 } : { - {\__cs_count_signature:N #1} - {\__cs_get_function_signature:N #1} + \prop_put:Nxn \l__codedoc_functions_block_prop + { \use_none:n #1 } { \scan_stop: } } - } - } - } - { - % for now don't bother splitting into variants: - \tl_gclear:N \l__codedoc_function_name_prefix_tl - \prop_put:Nxx \l__codedoc_functions_block_prop { \tl_to_str:n {#1} } { {-1} {} } - } - } -\cs_new:Nn \__codedoc_typeset_functions:nn - { - \clist_gset:Nn \l__codedoc_variants_clist {#2} - \clist_gpop:NN \l__codedoc_variants_clist \l__codedoc_tmpb_tl - \exp_args:Nc \__codedoc_typeset_functions_aux:N - { - #1 - \int_compare:nT { \exp_after:wN \use_i:nn \l__codedoc_tmpb_tl > -1 } {:} - \int_compare:nT { \exp_after:wN \use_i:nn \l__codedoc_tmpb_tl > 0 } - { \exp_after:wN \use_ii:nn \l__codedoc_tmpb_tl } - } - \\ - } - -\cs_new_nopar:Nn \__codedoc_typeset_functions_aux:N - { - \bool_if:NT \l__codedoc_meta_pTF_bool - { - \tl_set:Nx \l__codedoc_pTF_name_tl - { \l__codedoc_function_name_prefix_tl \__codedoc_predicate_from_base:N #1 } - \__codedoc_special_main_index:o { \l__codedoc_pTF_name_tl } - \seq_gput_right:Nx \g_doc_functions_seq - { \tl_to_str:N \l__codedoc_pTF_name_tl } - \tl_set:Nx \l__codedoc_pTF_name_tl { \__codedoc_predicate_from_base:N #1 } - } - - \tl_set:Nx \l__codedoc_tmpa_tl - { - \l__codedoc_function_name_prefix_tl - \cs_to_str:N #1 - \bool_if:NT \l__codedoc_meta_TF_bool { \tl_to_str:n {TF} } - } - \__codedoc_special_main_index:o { \l__codedoc_tmpa_tl } - \seq_gput_right:No \g_doc_functions_seq { \l__codedoc_tmpa_tl } - - \bool_if:NTF \l__codedoc_meta_pTF_bool - { - \bool_gset_false:N \l__codedoc_meta_TF_bool - \exp_args:Nc \__codedoc_typeset_function_block:N { \l__codedoc_pTF_name_tl } - \bool_gset_true:N \l__codedoc_meta_TF_bool - + { + \exp_args:Nc \__cs_split_function:NN { \use_none:n #1 } + \__codedoc_function_parse_cs_aux:nnN + } + } + { + \tl_gclear:N \g__codedoc_function_name_prefix_tl + \prop_put:Nnn \l__codedoc_functions_block_prop {#1} { \scan_stop: } + } + } +\cs_new_protected:Npn \__codedoc_function_parse_cs_aux:nnN #1#2#3 + { + \prop_get:NnNF + \l__codedoc_functions_block_prop {#1} \l__codedoc_tmpb_tl + { \tl_clear:N \l__codedoc_tmpb_tl } + \prop_put:Nnx \l__codedoc_functions_block_prop {#1} + { + \l__codedoc_tmpb_tl , + \bool_if:NTF #3 { {#2} } { \scan_stop: } + } + } +\cs_new_protected_nopar:Npn \__codedoc_function_typeset: + { + \dim_zero:N \l__codedoc_trial_width_dim + \hcoffin_set:Nn \l__codedoc_names_coffin { \__codedoc_typeset_names: } + \dim_set:Nn \l__codedoc_trial_width_dim + { \box_wd:N \l__codedoc_names_coffin } + \bool_set:Nn \l__codedoc_long_name_bool + { \dim_compare_p:nNn \l__codedoc_trial_width_dim > \marginparwidth } + } +\cs_new_protected_nopar:Npn \__codedoc_function_descr_start:w + { + \vcoffin_set:Nnw \l__codedoc_descr_coffin { \textwidth } + \noindent \ignorespaces + } +\cs_new_protected_nopar:Npn \__codedoc_function_descr_stop: + { \vcoffin_set_end: } +\cs_new_protected_nopar:Npn \__codedoc_function_assemble: + { + \hcoffin_set:Nn \l__codedoc_syntax_coffin + { \box_use:N \g__codedoc_syntax_box } + \bool_if:NTF \l__codedoc_long_name_bool + { + \coffin_join:NnnNnnnn + \l__codedoc_output_coffin {hc} {vc} + \l__codedoc_syntax_coffin {l} {T} + {0pt} {0pt} + \coffin_join:NnnNnnnn + \l__codedoc_output_coffin {l} {t} + \l__codedoc_names_coffin {r} {t} + {-\marginparsep} {0pt} + \coffin_join:NnnNnnnn + \l__codedoc_output_coffin {l} {b} + \l__codedoc_descr_coffin {l} {t} + {0.75\marginparwidth + \marginparsep} {-\medskipamount} + \coffin_typeset:Nnnnn \l__codedoc_output_coffin + {\l__codedoc_descr_coffin-l} {\l__codedoc_descr_coffin-t} + {0pt} {0pt} + } + { + \coffin_join:NnnNnnnn + \l__codedoc_output_coffin {hc} {vc} + \l__codedoc_syntax_coffin {l} {t} + {0pt} {0pt} + \coffin_join:NnnNnnnn + \l__codedoc_output_coffin {l} {b} + \l__codedoc_descr_coffin {l} {t} + {0pt} {-\medskipamount} + \coffin_join:NnnNnnnn + \l__codedoc_output_coffin {l} {t} + \l__codedoc_names_coffin {r} {t} + {-\marginparsep} {0pt} + \coffin_typeset:Nnnnn \l__codedoc_output_coffin + {\l__codedoc_syntax_coffin-l} {\l__codedoc_syntax_coffin-T} + {0pt} {0pt} + } + } +\cs_new_protected_nopar:Npn \__codedoc_typeset_names: + { + \small\ttfamily + \begin{tabular} { @{} l @{} r @{} } + \toprule + \__codedoc_typeset_functions: + \__codedoc_typeset_dates: + \bottomrule + \end{tabular} + \normalfont\normalsize + } +\cs_new_protected_nopar:Npn \__codedoc_typeset_functions: + { + \prop_map_function:NN \l__codedoc_functions_block_prop + \__codedoc_typeset_functions_auxi:nn + } +\cs_new_protected:Npn \__codedoc_typeset_functions_auxi:nn #1#2 + { + \tl_gset:Nn \g__codedoc_base_name_tl {#1} + \prop_clear:N \l__codedoc_variants_prop + \clist_map_inline:nn {#2} + { + \tl_set:Nx \l__codedoc_tmpa_tl + { \__codedoc_signature_base_form:n {##1} } + \prop_get:NoNTF \l__codedoc_variants_prop + \l__codedoc_tmpa_tl \l__codedoc_tmpb_tl + { \tl_put_right:Nn \l__codedoc_tmpb_tl { , {##1} } } + { \tl_set:Nn \l__codedoc_tmpb_tl { {##1} } } + \prop_put:Noo \l__codedoc_variants_prop + \l__codedoc_tmpa_tl \l__codedoc_tmpb_tl + } + \prop_map_function:NN \l__codedoc_variants_prop + \__codedoc_typeset_functions_auxii:nn + } +\cs_new_protected:Npn \__codedoc_typeset_functions_auxii:nn #1#2 + { + \clist_gset:Nn \g__codedoc_variants_clist {#2} + \clist_gpop:NN \g__codedoc_variants_clist \l__codedoc_tmpb_tl + \exp_args:Nc \__codedoc_typeset_functions_auxiii:N + { + \g__codedoc_base_name_tl + \exp_last_unbraced:Nf \token_if_eq_meaning:NNF + { \tl_head:f { \l__codedoc_tmpb_tl ? } } + \scan_stop: + { : \l__codedoc_tmpb_tl } + } + } +\cs_new_protected:Npn \__codedoc_typeset_functions_auxiii:N #1 + { + \bool_if:NT \l__codedoc_macro_pTF_bool + { + \tl_set:Nx \l__codedoc_pTF_name_tl + { \__codedoc_predicate_from_base:N #1 } + \__codedoc_function_index:x { \l__codedoc_pTF_name_tl } + } + \__codedoc_function_index:x + { + \cs_to_str:N #1 + \bool_if:NT \l__codedoc_macro_TF_bool { \tl_to_str:n {TF} } + } + \bool_if:NT \l__codedoc_macro_pTF_bool + { + \exp_args:Nc \__codedoc_typeset_function_block:NN + { \l__codedoc_pTF_name_tl } \c_false_bool + } + \__codedoc_typeset_function_block:NN #1 \l__codedoc_macro_TF_bool + } +\cs_new_protected:Npn \__codedoc_function_index:x #1 + { + \tl_set:Nx \l__codedoc_tmpa_tl + { \g__codedoc_function_name_prefix_tl #1 } + \seq_gput_right:No \g_doc_functions_seq { \l__codedoc_tmpa_tl } + \__codedoc_special_index:on { \l__codedoc_tmpa_tl } { usage } + } +\cs_new_protected:Npn \__codedoc_typeset_function_block:NN #1#2 + { + \__codedoc_function_label:x + { \g__codedoc_function_name_prefix_tl \cs_to_str:N #1 } + \g__codedoc_function_name_prefix_tl \cs_to_str:N #1 + \bool_if:NT #2 { \__codedoc_typeset_TF: } + \__codedoc_typeset_expandability: + \clist_if_empty:NF \g__codedoc_variants_clist + { \__codedoc_typeset_variant_list:NN #1#2 } \\ - \__codedoc_typeset_function_block:N #1 - } - { - \exp_args:Nx \tl_if_head_eq_charcode:nNTF { \exp_after:wN \use_none:n \token_to_str:N #1 } {:} - { \__codedoc_show_macro_unusual:N #1 } - { \__codedoc_typeset_function_block:N #1 } - } -} -\cs_set_nopar:Nn \__codedoc_typeset_function_block:N - { - \tl_gset:Nx \l__codedoc_function_name_tl { \__cs_get_function_name:N #1 } - \tl_gset:Nx \l__codedoc_function_sig_tl { \__cs_get_function_signature:N #1 } - \tl_gset:Nx \g__codedoc_macro_tl { \l__codedoc_function_name_prefix_tl \l__codedoc_function_name_tl } - - \__codedoc_typeset_function_basename:N #1 - \bool_if:NT \l__codedoc_meta_TF_bool { \__codedoc_typeset_TF: } - \__codedoc_typeset_expandability: - \clist_if_empty:NF \l__codedoc_variants_clist { \__codedoc_typeset_variants: } - \bool_if:NT \g__codedoc_full_bool { \__codedoc_label_function:N #1 } - } -\cs_set:Nn \__codedoc_typeset_function_basename:N - { \l__codedoc_function_name_prefix_tl \cs_to_str:N #1 } -\cs_set:Nn \__codedoc_typeset_expandability: - { - & - \bool_if:NT \l__codedoc_meta_EXP_bool - { - \hspace{\tabcolsep} - \hyperlink{expstar} {$\star$} - } - \bool_if:NT \l__codedoc_meta_rEXP_bool - { - \hspace{\tabcolsep} - \hyperlink{rexpstar} {\ding{73}} % hollow star - } - } -\cs_set:Nn \__codedoc_typeset_variants: - { - \\ - \__codedoc_typeset_aux:n \g__codedoc_macro_tl : - \int_compare:nTF { \clist_count:N \l__codedoc_variants_clist == 1 } - { \exp_after:wN \use_ii:nn \l__codedoc_variants_clist } - { - \textrm( - \clist_pop:NN \l__codedoc_variants_clist \l__codedoc_tmpb_tl - \exp_after:wN \use_ii:nn \l__codedoc_tmpb_tl - \clist_map_inline:Nn \l__codedoc_variants_clist {\textrm| \use_ii:nn ##1} - \textrm) - } - \bool_if:NT \l__codedoc_meta_TF_bool { \__codedoc_typeset_TF: } - & - \bool_if:NT \l__codedoc_meta_EXP_bool - { - \hspace{\tabcolsep} - \hyperlink{expstar} {$\star$} - } - \bool_if:NT \l__codedoc_meta_rEXP_bool - { - \hspace{\tabcolsep} - \hyperlink{rexpstar} {\ding{73}} % hollow star - } - } -\cs_set:Nn \__codedoc_label_function:N - { - \tl_set:Nx \l__codedoc_tmpa_tl { \l__codedoc_function_name_prefix_tl \cs_to_str:N #1 } - \exp_args:NNf \tl_replace_all:Nnn \l__codedoc_tmpa_tl {\token_to_str:N _} {/} - \exp_args:NNf \tl_remove_all:Nn \l__codedoc_tmpa_tl {\@backslashchar} - \exp_args:Nx \label {doc/function//\l__codedoc_tmpa_tl} - } -\cs_set_nopar:Nn \__codedoc_show_macro_unusual:N - { - \tl_gset:Nx \g__codedoc_macro_tl { \token_to_str:N #1} - \token_to_str:N #1 & - - \exp_args:NNf \tl_replace_all:Nnn \g__codedoc_macro_tl {\token_to_str:N _} {/} - \exp_args:NNf \tl_replace_all:Nnn \g__codedoc_macro_tl {\@backslashchar} {} - \bool_if:NT \g__codedoc_full_bool - { - \exp_args:Nx \label { doc/function//\g__codedoc_macro_tl } - } - } -\cs_set:Nn \__codedoc_typeset_dates: - { - \bool_if:nF { \tl_if_empty_p:N \l__codedoc_date_added_tl && - \tl_if_empty_p:N \l__codedoc_date_updated_tl } - { \midrule } - - \tl_if_empty:NF \l__codedoc_date_added_tl - { - \multicolumn{2}{@{}r@{}} - { \scriptsize New:\,\l__codedoc_date_added_tl } \\ - } - - \tl_if_empty:NF \l__codedoc_date_updated_tl - { - \multicolumn{2}{@{}r@{}} - { \scriptsize Updated:\,\l__codedoc_date_updated_tl } \\ - } - } -\newenvironment{syntax} - { - \small\ttfamily - \bool_if:NTF \l__codedoc_long_name_bool - { - \hbox_gset:Nw \g__codedoc_syntax_box - \arrayrulecolor{white} - \begin{tabular}{@{}l@{}} - \toprule - \begin{minipage} - { \textwidth+0.75\marginparwidth-\l__codedoc_trial_width_dim } - } - { - \hbox_gset:Nw \g__codedoc_syntax_box - \arrayrulecolor{white} - \begin{tabular}{@{}l@{}} - \toprule - \begin{minipage}{ \textwidth } - } - \raggedright - \obeyspaces\obeylines - } - { - \end{minipage} - \end{tabular} - \arrayrulecolor{black} - \hbox_set_end: - \ignorespacesafterend - } -\cs_new:Npn \__codedoc_ensuremath_sb:n #1 - { - \ensuremath{\sb{#1}} - } -\cs_set_eq:NN \__codedoc_meta:n \meta -\cs_set:Npn \meta - { - \group_begin: - \char_set_active_eq:NN _ \__codedoc_ensuremath_sb:n - \__codedoc_close_meta:n - } -\cs_new:Npn \__codedoc_open_meta:w - { - \group_begin: - \char_set_active_eq:NN _ \__codedoc_ensuremath_sb:n - \__codedoc_close_meta:w - } -\cs_new:Npn \Arg - { - \texttt{ \char`\{ } - \group_begin: - \char_set_active_eq:NN _ \__codedoc_ensuremath_sb:n - \__codedoc_close_Arg:n - } -\cs_new_nopar:Npn \__codedoc_close_meta:n #1 { \__codedoc_meta:n {#1} \group_end: } -\cs_new_nopar:Npn \__codedoc_close_meta:w #1> { \__codedoc_meta:n {#1} \group_end: } -\cs_new_nopar:Npn \__codedoc_close_Arg:n #1 - { - \__codedoc_meta:n {#1} - \group_end: - \texttt{ \char`\} } - } -\keys_define:nn { l3doc/macro } - { - aux .code:n = - { \bool_set_true:N \l__codedoc_macro_aux_bool } , - internal .code:n = - { \bool_set_true:N \l__codedoc_macro_internal_bool } , - int .code:n = - { \bool_set_true:N \l__codedoc_macro_internal_bool } , - var .code:n = - { \bool_set_true:N \l__codedoc_macro_var_bool } , - TF .code:n = - { \bool_set_true:N \l__codedoc_macro_TF_bool } , - pTF .code:n = - { \bool_set_true:N \l__codedoc_macro_pTF_bool } , - tested .code:n = - { } , - EXP .code:n = {} , % TODO - rEXP .code:n = {} , % TODO - added .code:n = {} , % TODO - updated .code:n = {} , % TODO - } -\RenewDocumentCommand { \macro } { O{} } { \__codedoc_macro:n {#1} } -\cs_new_protected:Npn \__codedoc_macro:n #1 - { - - \int_compare:nNnTF \currentgrouplevel=2 - { \int_gzero:N \g__codedoc_nested_macro_int } - { \int_incr:N \g__codedoc_nested_macro_int } - - \bool_set_false:N \l__codedoc_macro_aux_bool - \bool_set_false:N \l__codedoc_macro_internal_bool - \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_var_bool - \bool_set_false:N \l__codedoc_tested_bool - - \cs_set_eq:NN \__codedoc_macroname_prefix:n \use:n - \cs_set_eq:NN \__codedoc_macroname_suffix: \c_empty_tl - - \keys_set:nn { l3doc/macro } {#1} - - \cs_set_eq:NN \testfile \__codedoc_print_testfile:n + } +\cs_new_protected_nopar:Npn \__codedoc_typeset_expandability: + { + & + \bool_if:NT \l__codedoc_macro_EXP_bool + { + \hspace{\tabcolsep} + \hyperlink{expstar} {$\star$} + } + \bool_if:NT \l__codedoc_macro_rEXP_bool + { + \hspace{\tabcolsep} + \hyperlink{rexpstar} {\ding{73}} % hollow star + } + } +\cs_new_protected:Npn \__codedoc_typeset_variant_list:NN #1#2 + { + \\ + \__codedoc_typeset_aux:n + { + \g__codedoc_function_name_prefix_tl + \__cs_get_function_name:N #1 + } + : + \int_compare:nTF { \clist_count:N \g__codedoc_variants_clist == 1 } + { \clist_use:Nn \g__codedoc_variants_clist { } } + { + \textrm( + \clist_use:Nn \g__codedoc_variants_clist { \textrm| } + \textrm) + } + \bool_if:NT #2 { \__codedoc_typeset_TF: } + \__codedoc_typeset_expandability: + } +\cs_new_protected:Npn \__codedoc_function_label:n #1 + { + % \bool_if:NT \g__codedoc_typeset_implementation_bool + % { + \bool_if:NF \l__codedoc_no_label_bool + { + \__codedoc_get_hyper_target:nN {#1} \l__codedoc_tmpa_tl + \exp_args:No \label { \l__codedoc_tmpa_tl } + } + % } + } +\cs_generate_variant:Nn \__codedoc_function_label:n { x } +\cs_new_nopar:Npn \__codedoc_typeset_dates: + { + \bool_if:nF + { + \tl_if_empty_p:N \l__codedoc_date_added_tl && + \tl_if_empty_p:N \l__codedoc_date_updated_tl + } + { \midrule } + \tl_if_empty:NF \l__codedoc_date_added_tl + { + \multicolumn { 2 } { @{} r @{} } + { \scriptsize New: \, \l__codedoc_date_added_tl } \\ + } - \peek_meaning_ignore_spaces:NTF \c_group_begin_token - { - \group_begin: - \MakePrivateLetters - \char_set_catcode_letter:N \\ - \char_set_catcode_ignore:N \ % space - \char_set_catcode_ignore:N \^^M - \char_set_catcode_ignore:N \^^I - \__codedoc_macro_aux:n - } - { - \__codedoc_macro_verbatim:w - } - } -\NewDocumentCommand {\__codedoc_macro_verbatim:w} {v} - { - \group_begin: % pretty useless - \__codedoc_macro_aux:n {#1} - } -\clist_new:N \l__codedoc_macro_input_clist -\cs_new_nopar:Npn \__codedoc_macro_aux:n #1 - { - \group_end: - \clist_set:Nn \l__codedoc_macro_input_clist {#1} - \bool_if:NTF \l__codedoc_macro_pTF_bool - { - \clist_map_inline:Nn \l__codedoc_macro_input_clist - { - \exp_args:Nx \__codedoc_macro_single:n { \__codedoc_predicate_from_base:w ##1 \q_nil } + \tl_if_empty:NF \l__codedoc_date_updated_tl + { + \multicolumn { 2 } { @{} r @{} } + { \scriptsize Updated: \, \l__codedoc_date_updated_tl } \\ + } + } +\dim_new:N \l__codedoc_syntax_dim +\cs_new_protected:Npn \__codedoc_syntax:w + { + \dim_set:Nn \l__codedoc_syntax_dim + { + \textwidth + \bool_if:NT \l__codedoc_long_name_bool + { + 0.75 \marginparwidth - \l__codedoc_trial_width_dim } } - \bool_set_true:N \l__codedoc_macro_TF_bool - \clist_map_function:NN \l__codedoc_macro_input_clist \__codedoc_macro_single:n + \hbox_gset:Nw \g__codedoc_syntax_box + \small \ttfamily + \arrayrulecolor{white} + \begin{tabular} { @{} l @{} } + \toprule + \begin{minipage}{\l__codedoc_syntax_dim} + \raggedright + \obeyspaces + \obeylines + } +\cs_new_protected:Npn \__codedoc_syntax_end: + { + \end{minipage} + \end{tabular} + \arrayrulecolor{black} + \hbox_gset_end: + } +\keys_define:nn { l3doc/macro } + { + aux .code:n = + { \bool_set_true:N \l__codedoc_macro_aux_bool } , + internal .code:n = + { \bool_set_true:N \l__codedoc_macro_internal_bool } , + int .code:n = + { \bool_set_true:N \l__codedoc_macro_internal_bool } , + var .code:n = + { \bool_set_true:N \l__codedoc_macro_var_bool } , + TF .code:n = + { \bool_set_true:N \l__codedoc_macro_TF_bool } , + pTF .code:n = + { + \bool_set_true:N \l__codedoc_macro_TF_bool + \bool_set_true:N \l__codedoc_macro_pTF_bool + \bool_set_true:N \l__codedoc_macro_EXP_bool + \bool_set_false:N \l__codedoc_macro_rEXP_bool + } , + EXP .code:n = + { + \bool_set_true:N \l__codedoc_macro_EXP_bool + \bool_set_false:N \l__codedoc_macro_rEXP_bool + } , + rEXP .code:n = + { + \bool_set_false:N \l__codedoc_macro_EXP_bool + \bool_set_true:N \l__codedoc_macro_rEXP_bool + } , + tested .code:n = + { + \bool_set_true:N \l__codedoc_macro_tested_bool + } , + added .code:n = {} , % TODO + updated .code:n = {} , % TODO + } +\cs_new_protected:Npn \__codedoc_macro:nnw #1#2 + { + \__codedoc_macro_init: + \keys_set:nn { l3doc/macro } {#1} + \__codedoc_verb_get_seq:nN {#2} \l__codedoc_macro_input_seq + \__codedoc_macro_map:N \__codedoc_macro_single:n + \__codedoc_macro_typeset: + } +\cs_new_protected_nopar:Npn \__codedoc_macro_init: + { + \int_incr:N \l__codedoc_nested_macro_int + \bool_set_false:N \l__codedoc_macro_aux_bool + \bool_set_false:N \l__codedoc_macro_internal_bool \bool_set_false:N \l__codedoc_macro_TF_bool - } - { \clist_map_function:NN \l__codedoc_macro_input_clist \__codedoc_macro_single:n } - } -\cs_set:Nn \__codedoc_predicate_from_base:N - { - \__cs_get_function_name:N #1 _p: \__cs_get_function_signature:N #1 - } -\cs_set:Npn \__codedoc_predicate_from_base:w #1 : #2 \q_nil - { - #1 _p: #2 - } -\cs_set_nopar:Npn \__codedoc_macro_single:n #1 - { - \int_incr:N \l__codedoc_macro_int - - \tl_set:Nx \l__codedoc_at_replaced_macro_tl { \token_to_str:N #1 } - \__codedoc_replace_at_at:N \l__codedoc_at_replaced_macro_tl - \tl_set_eq:NN \saved@macroname \l__codedoc_at_replaced_macro_tl - - \topsep\MacroTopsep - \trivlist - \cs_set_nopar:Npn \makelabel ##1 { \llap{##1} } - \if@inlabel - \cs_set_eq:NN \@tempa \@empty - \count@ \macro@cnt - \loop \ifnum\count@>\z@ - \cs_set_nopar:Npx \@tempa{\@tempa\hbox{\strut}} - \advance\count@\m@ne - \repeat - \cs_set_nopar:Npx \makelabel ##1 - { - \llap{\vtop to\baselineskip {\@tempa\hbox{##1}\vss}} - } - \advance \macro@cnt \@ne - \else - \macro@cnt \@ne - \fi - - \bool_if:NT \l__codedoc_macro_aux_bool - { - \cs_set_eq:NN \__codedoc_macroname_prefix:n \__codedoc_typeset_aux:n - } - \bool_if:NT \l__codedoc_macro_TF_bool - { - \cs_set_eq:NN \__codedoc_macroname_suffix: \__codedoc_typeset_TF: - } - - \bool_if:NF \l__codedoc_macro_aux_bool - { - \tl_gset:Nx \l__codedoc_macro_tl { \tl_to_str:N \l__codedoc_at_replaced_macro_tl } - \exp_args:NNf \tl_greplace_all:Nnn \l__codedoc_macro_tl {\token_to_str:N _} {/} - \exp_args:NNf \tl_greplace_all:Nnn \l__codedoc_macro_tl {\@backslashchar} {} - } - - \use:x - { - \exp_not:N \item [ \exp_not:N \__codedoc_print_macroname:n { - \tl_to_str:N \l__codedoc_at_replaced_macro_tl - }] - } - \int_gincr:N \c@CodelineNo - - \bool_if:NF \l__codedoc_macro_aux_bool - { - \bool_if:NTF \l__codedoc_macro_TF_bool - { - \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:N \l__codedoc_at_replaced_macro_tl \tl_to_str:n {TF} } - \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:N \l__codedoc_at_replaced_macro_tl \tl_to_str:n {T } } - \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:N \l__codedoc_at_replaced_macro_tl \tl_to_str:n { F} } - } - { - \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:N \l__codedoc_at_replaced_macro_tl } - } - } - \bool_if:NTF \l__codedoc_macro_TF_bool - { - \exp_args:Nx \SpecialMainIndex{ \tl_to_str:N \l__codedoc_at_replaced_macro_tl TF}\nobreak - \exp_args:Nx \DoNotIndex{ \tl_to_str:N \l__codedoc_at_replaced_macro_tl TF} - } - { - \exp_args:Nx \SpecialMainIndex{ \tl_to_str:N \l__codedoc_at_replaced_macro_tl }\nobreak - \exp_args:Nx \DoNotIndex{ \tl_to_str:N \l__codedoc_at_replaced_macro_tl } - } + \bool_set_false:N \l__codedoc_macro_pTF_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_macro_var_bool + \bool_set_false:N \l__codedoc_macro_tested_bool + \cs_set_eq:NN \testfile \__codedoc_print_testfile:n + \box_clear:N \l__codedoc_macro_index_box + \vbox_set:Nn \l__codedoc_macro_box + { + \hbox:n { \strut } + \vskip \int_eval:n { \l__codedoc_macro_int - 1 } \baselineskip + } + } +\cs_new_protected:Npn \__codedoc_macro_map:N #1 + { + \bool_if:NT \l__codedoc_macro_pTF_bool + { + \bool_set_false:N \l__codedoc_macro_TF_bool + \seq_map_inline:Nn \l__codedoc_macro_input_seq + { + \tl_set:Nn \l__codedoc_tmpa_tl {##1} + \tl_replace_once:Noo \l__codedoc_tmpa_tl + { \tl_to_str:n { : } } { \tl_to_str:n { _p: } } + \exp_args:No #1 \l__codedoc_tmpa_tl + } + \bool_set_true:N \l__codedoc_macro_TF_bool + } + \seq_map_function:NN \l__codedoc_macro_input_seq #1 + } +\cs_new_protected_nopar:Npn \__codedoc_macro_typeset: + { + \topsep\MacroTopsep + \trivlist + \cs_set:Npn \makelabel ##1 + { + \llap + { + \hbox_unpack_clear:N \l__codedoc_macro_index_box + \vtop to \baselineskip + { + \vbox_unpack_clear:N \l__codedoc_macro_box + \vss + } + } + } + \item [ ] + } +\cs_new_protected:Npn \__codedoc_macro_single:n #1 + { + \tl_set:Nn \saved@macroname {#1} - \int_gdecr:N \c@CodelineNo - \ignorespaces - } -\tl_clear:N \l__codedoc_macro_tl -\cs_set_nopar:Npn \__codedoc_print_macroname:n #1 - { - \strut - \HD@target - \int_compare:nTF { \tl_count:n {#1} <= 28 } - { \MacroFont } { \MacroLongFont } + \__codedoc_macro_typeset_one:n {#1} + \exp_args:Nx \__codedoc_macro_index:n + { + #1 + \bool_if:NT \l__codedoc_macro_TF_bool { \tl_to_str:n { TF } } + } + } +\cs_new_protected:Npn \__codedoc_macro_index:n #1 + { + \bool_if:NF \l__codedoc_macro_aux_bool + { \seq_gput_right:Nn \g_doc_macros_seq {#1} } + \hbox_set:Nn \l__codedoc_macro_index_box + { + % This box only contains targets... it seems inefficient. + \hbox_unpack_clear:N \l__codedoc_macro_index_box + \int_gincr:N \c@CodelineNo + \__codedoc_special_index:nn {#1} { main } + \DoNotIndex {#1} + \int_gdecr:N \c@CodelineNo + } + } +\cs_new_protected:Npn \__codedoc_macro_typeset_one:n #1 + { + \vbox_set:Nn \l__codedoc_macro_box + { + \vbox_unpack_clear:N \l__codedoc_macro_box + \hbox { \llap { \__codedoc_print_macroname:n {#1} \ } } + } + \int_incr:N \l__codedoc_macro_int + } +\cs_new_protected:Npn \__codedoc_print_macroname:n #1 + { + \strut + \HD@target - % INEFFICIENT: (!) - \exp_args:NNx \seq_if_in:NnTF \g_doc_functions_seq - { #1 \bool_if:NT \l__codedoc_macro_TF_bool { \tl_to_str:n {TF} } } - { - \hyperref [doc/function//\l__codedoc_macro_tl] - } - { \use:n } - { - \__codedoc_macroname_prefix:n {#1} \__codedoc_macroname_suffix: \ % space! - } - } + % TODO: INEFFICIENT(!) + \exp_args:NNx \seq_if_in:NnTF \g_doc_functions_seq + { #1 \bool_if:NT \l__codedoc_macro_TF_bool { \tl_to_str:n {TF} } } + { + \__codedoc_get_hyper_target:nN {#1} \l__codedoc_tmpa_tl + \exp_last_unbraced:NNo \hyperref [ \l__codedoc_tmpa_tl ] + } + { \use:n } + { + \int_compare:nTF { \tl_count:n {#1} <= 28 } + { \MacroFont } { \MacroLongFont } + \__codedoc_macroname_prefix:n {#1} \__codedoc_macroname_suffix: + } + } +\cs_new_protected:Npn \__codedoc_macroname_prefix:n #1 + { + \bool_if:NTF \l__codedoc_macro_aux_bool + { \__codedoc_typeset_aux:n {#1} } {#1} + } +\cs_new_protected_nopar:Npn \__codedoc_macroname_suffix: + { \bool_if:NTF \l__codedoc_macro_TF_bool { \__codedoc_typeset_TF: } { } } \providecommand \MacroLongFont - { - \fontfamily{lmtt}\fontseries{lc}\small - } -\cs_set_nopar:Npn \__codedoc_typeset_TF: - { - \hyperlink{explTF} - { - \color{black} - \itshape TF - \makebox[0pt][r] - { - \color{red} - \underline { \phantom{\itshape TF} \kern-0.1em } - } - } - } -\cs_set_nopar:Npn \__codedoc_typeset_aux:n #1 - { - { \color[gray]{0.7} #1 } - } -\DeclareDocumentCommand \__codedoc_print_testfile:n {m} - { - \bool_set_true:N \l__codedoc_tested_bool - \tl_if_eq:nnF {#1} {*} - { - \seq_if_in:NnF \g__codedoc_testfiles_seq {#1} - { - \seq_gput_right:Nn \g__codedoc_testfiles_seq {#1} - \par - \__codedoc_print_testfile_aux:n {#1} - } - } - } + { + \fontfamily{lmtt}\fontseries{lc}\small + } +\cs_new_protected:Npn \__codedoc_print_testfile:n #1 + { + \bool_set_true:N \l__codedoc_macro_tested_bool + \tl_if_eq:nnF {#1} {*} + { + \seq_if_in:NnF \g__codedoc_testfiles_seq {#1} + { + \seq_gput_right:Nn \g__codedoc_testfiles_seq {#1} + \par + \__codedoc_print_testfile_aux:n {#1} + } + } + } \cs_new_protected:Npn \__codedoc_print_testfile_aux:n #1 - { - \footnotesize - ( - \textit{ - The~ test~ suite~ for~ this~ command,~ - and~ others~ in~ this~ file,~ is~ \textsf{#1} - }. - )\par - } + { + \footnotesize + ( + \textit + { + The~ test~ suite~ for~ this~ command,~ + and~ others~ in~ this~ file,~ is~ \textsf{#1} + }. + )\par + } \DeclareDocumentCommand \TestFiles {m} - { - \par - {\itshape - The~ following~ test~ files~ are~ used~ for~ this~ code:~ \textsf{#1}. - } - \par\ignorespaces - } -\DeclareDocumentCommand \UnitTested {} { \testfile* } -\cs_generate_variant:Nn \prop_gput:Nnn {NVx} -\DeclareDocumentCommand \TestMissing {m} - { - \prop_if_in:NVTF \g__codedoc_missing_tests_prop \l__codedoc_macro_input_clist - { - \prop_get:NVN \g__codedoc_missing_tests_prop \l__codedoc_macro_input_clist \l__codedoc_tmpa_tl - \prop_gput:NVx \g__codedoc_missing_tests_prop \l__codedoc_macro_input_clist + { + \par + \textit + { + The~ following~ test~ files~ are~ + used~ for~ this~ code:~ \textsf{#1}. + } + \par \ignorespaces + } +\DeclareDocumentCommand \UnitTested { } { \testfile* } +\DeclareDocumentCommand \TestMissing { m } + { \__codedoc_test_missing:n {#1} } +\cs_new_protected:Npn \__codedoc_test_missing:n #1 + { + \tl_set:Nx \l__codedoc_tmpb_tl + { \seq_use:Nn \l__codedoc_macro_input_seq { , } } + \prop_if_in:NVTF \g__codedoc_missing_tests_prop \l__codedoc_tmpb_tl + { + \prop_get:NVN \g__codedoc_missing_tests_prop \l__codedoc_tmpb_tl + \l__codedoc_tmpa_tl + } + { \tl_clear:N \l__codedoc_tmpa_tl } + \clist_set:Nx \l__codedoc_tmpa_clist { \l__codedoc_tmpa_tl , #1 } + \prop_gput:NVV \g__codedoc_missing_tests_prop \l__codedoc_tmpb_tl + \l__codedoc_tmpa_clist + } +\cs_new_protected:Npn \__codedoc_macro_end: + { + \endtrivlist + \__codedoc_macro_end_check_tested: + \int_compare:nNnT \l__codedoc_nested_macro_int = 1 + { + \__codedoc_macro_end_style:n + { + \__codedoc_print_end_definition: + \__codedoc_print_documented: + } + } + } +\cs_new_protected_nopar:Npn \__codedoc_macro_end_check_tested: + { + \bool_if:nT { - *~ \l__codedoc_tmpa_tl - ^^J \exp_not:n {\space\space\space\space\space\space} - *~ #1 + \g__codedoc_checktest_bool && + ! \l__codedoc_macro_aux_bool && + ! \l__codedoc_macro_var_bool && + ! \l__codedoc_macro_tested_bool } - } - { \prop_gput:NVn \g__codedoc_missing_tests_prop \l__codedoc_macro_input_clist {#1} } - } -\tl_new:N \g__codedoc_module_name_tl -\cs_new_protected:Npn \__codedoc_replace_at_at:N #1 - { - \tl_if_empty:NF \g__codedoc_module_name_tl - { - \tl_replace_all:Non #1 { \token_to_str:N @ } { @ } - \tl_replace_all:Non #1 { \token_to_str:N _ } { _ } - \tl_replace_all:Nox #1 { _@ @ } { __ \g__codedoc_module_name_tl } - \tl_replace_all:Nox #1 { @ @ } { __ \g__codedoc_module_name_tl } - } - } -\cs_generate_variant:Nn \tl_replace_all:Nnn { Non, Nox } -\cs_new_protected:Nn \__codedoc_endmacro_build_seq:N - { - \seq_gclear:N #1 - \clist_map_inline:Nn \l__codedoc_macro_input_clist - { - \tl_set:Nn \l__codedoc_tmpa_tl {##1} - \__codedoc_replace_at_at:N \l__codedoc_tmpa_tl - \seq_gput_right:No #1 { \l__codedoc_tmpa_tl } - } - } -\cs_set_protected:Nn \__codedoc_endmacro_wrap_each:N - { - \bool_if:NTF \l__codedoc_macro_TF_bool - { \seq_gset_map:NNn #1 #1 { \exp_not:N \texttt { ##1 TF } } } - { \seq_gset_map:NNn #1 #1 { \exp_not:N \texttt { ##1 } } } - } -\cs_set:Nn \__codedoc_texttt_comma:n {\,,~\texttt{#1}} -\cs_set:Npn \endmacro - { - \int_compare:nT { \g__codedoc_nested_macro_int < 1 } - { - \par\nobreak\noindent{\footnotesize(\emph{ + { + \seq_gput_right:Nx \g__codedoc_not_tested_seq + { + \seq_use:Nn \l__codedoc_macro_input_seq { , } + \bool_if:NTF \l__codedoc_macro_pTF_bool {~(pTF)} + { \bool_if:NT \l__codedoc_macro_TF_bool {~(TF)} } + } + } + } +\cs_new_protected:Npn \__codedoc_macro_end_style:n #1 + { + \nobreak \noindent + { \footnotesize ( \emph{#1} ) \par } + } +\cs_new_protected:Npn \__codedoc_macro_end_wrap_items:N #1 + { + \bool_if:NT \l__codedoc_macro_TF_bool + { \seq_set_map:NNn #1 #1 { ##1 TF } } + \seq_set_map:NNn #1 #1 + { + \exp_not:n + { + \tl_set:Nn \l__codedoc_tmpa_tl {##1} + \tl_replace_all:Non \l__codedoc_tmpa_tl + { \token_to_str:N _ } { \_ } + \texttt { \l__codedoc_tmpa_tl } + } + } + } +\cs_new_protected_nopar:Npn \__codedoc_print_end_definition: + { + \group_begin: + \__codedoc_macro_end_wrap_items:N \l__codedoc_macro_input_seq End~ definition~ for~ - \__codedoc_endmacro_build_seq:N \g__codedoc_tmpa_seq - \__codedoc_endmacro_wrap_each:N \g__codedoc_tmpa_seq - \int_compare:nTF { \seq_count:N \g__codedoc_tmpa_seq <= 3 } + \int_compare:nTF { \seq_count:N \l__codedoc_macro_input_seq <= 3 } { - \seq_use:Nnnn \g__codedoc_tmpa_seq + \seq_use:Nnnn \l__codedoc_macro_input_seq { \,~and~ } { \,,~ } { \,,~and~ } \@. } - { \seq_item:Nn \g__codedoc_tmpa_seq {1}\,~and~others. } - + { \seq_item:Nn \l__codedoc_macro_input_seq {1}\,~and~others. } + \group_end: + } +\cs_new_protected_nopar:Npn \__codedoc_print_documented: + { \bool_if:nT - { - !\l__codedoc_macro_aux_bool && - !\l__codedoc_macro_internal_bool && - \int_compare_p:n {\g__codedoc_nested_macro_int<1} - } - { - \int_compare:nNnTF \l__codedoc_macro_int=1 {~This~} {~These~} - \bool_if:NTF \l__codedoc_macro_var_bool{variable}{function} - \int_compare:nNnTF \l__codedoc_macro_int=1 {~is~}{s~are~} - documented~on~page~ - \exp_args:Nx\pageref{doc/function//\l__codedoc_macro_tl}. - } - })\par} - } - - \bool_if:nT - { - \g__codedoc_checktest_bool && - !( \l__codedoc_macro_aux_bool || \l__codedoc_macro_var_bool ) && - !\l__codedoc_tested_bool - } - { - \seq_gput_right:Nx \g__codedoc_not_tested_seq - { - \seq_use:Nnnn \g__codedoc_tmpa_seq { , } { , } { , } - \bool_if:NT \l__codedoc_macro_pTF_bool {~(pTF)} - \bool_if:NT \l__codedoc_macro_TF_bool {~(TF)} - } - } - } + { + ! \l__codedoc_macro_aux_bool && + ! \l__codedoc_macro_internal_bool + } + { + \int_set:Nn \l__codedoc_tmpa_int + { \seq_count:N \l__codedoc_macro_input_seq } + \int_compare:nNnTF \l__codedoc_tmpa_int = 1 {~This~} {~These~} + \bool_if:NTF \l__codedoc_macro_var_bool {variable} {function} + \int_compare:nNnTF \l__codedoc_tmpa_int = 1 {~is~} {s~are~} + documented~on~page~ + \exp_args:Nx \__codedoc_get_hyper_target:nN + { \seq_item:Nn \l__codedoc_macro_input_seq { 1 } } + \l__codedoc_tmpa_tl + \exp_args:Nx \pageref { \l__codedoc_tmpa_tl } . + } + } +\cs_new_protected_nopar:Npn \__codedoc_typeset_TF: + { + \hyperlink{explTF} + { + \color{black} + \itshape TF + \makebox[0pt][r] + { + \color{red} + \underline { \phantom{\itshape TF} \kern-0.1em } + } + } + } +\cs_new_protected:Npn \__codedoc_typeset_aux:n #1 + { + { \color[gray]{0.7} #1 } + } +\cs_new_protected:Npn \__codedoc_get_hyper_target:nN #1#2 + { + \tl_set:Nx #2 + { + \tl_to_str:n {#1} + \bool_if:NT \l__codedoc_macro_TF_bool { \tl_to_str:n {TF} } + } + \tl_replace_all:Nxn #2 { \iow_char:N \_ } { / } + \tl_remove_all:Nx #2 { \iow_char:N \\ } + \tl_put_left:Nn #2 { doc/function// } + } +\newcommand*{\DescribeOption} + { + \leavevmode + \@bsphack + \begingroup + \MakePrivateLetters + \Describe@Option + } +\newcommand*{\Describe@Option}[1] + { + \endgroup + \marginpar{ + \raggedleft + \PrintDescribeEnv{#1} + } + \SpecialOptionIndex{#1} + \@esphack + \ignorespaces + } +\newcommand*{\SpecialOptionIndex}[1] + { + \@bsphack + \begingroup + \HD@target + \let\HDorg@encapchar\encapchar + \edef\encapchar usage + { + \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage} + } + \index + { + #1\actualchar{\protect\ttfamily#1}~(option) + \encapchar usage + } + \index + { + options:\levelchar#1\actualchar{\protect\ttfamily#1} + \encapchar usage + } + \endgroup + \@esphack + } +\font \manual = manfnt \scan_stop: +\cs_gset_nopar:Npn \dbend { {\manual\char127} } +\newenvironment {danger} + { + \begin{trivlist}\item[]\noindent + \begingroup\hangindent=2pc\hangafter=-2 + \cs_set_nopar:Npn \par{\endgraf\endgroup} + \hbox to0pt{\hskip-\hangindent\dbend\hfill}\ignorespaces + } + { + \par\end{trivlist} + } +\newenvironment {ddanger} + { + \begin{trivlist}\item[]\noindent + \begingroup\hangindent=3.5pc\hangafter=-2 + \cs_set_nopar:Npn \par{\endgraf\endgroup} + \hbox to0pt{\hskip-\hangindent\dbend\kern2pt\dbend\hfill}\ignorespaces + }{ + \par\end{trivlist} + } +\newenvironment{TemplateInterfaceDescription}[1] + { + \subsection{The~object~type~`#1'} + \begingroup + \@beginparpenalty\@M + \description + \def\TemplateArgument##1##2{\item[Arg:~##1]##2\par} + \def\TemplateSemantics + { + \enddescription\endgroup + \subsubsection*{Semantics:} + } + } + { + \par\bigskip + } +\newenvironment{TemplateDescription}[2] + { + \subsection{The~template~`#2'~(object~type~#1)} + \subsubsection*{Attributes:} + \begingroup + \@beginparpenalty\@M + \description + \def\TemplateKey##1##2##3##4 + { + \item[##1~(##2)]##3% + \ifx\TemplateKey##4\TemplateKey\else + \hfill\penalty500\hbox{}\hfill Default:~##4% + \nobreak\hskip-\parfillskip\hskip0pt\relax + \fi + \par + } + \def\TemplateSemantics + { + \enddescription\endgroup + \subsubsection*{Semantics~\&~Comments:} + } + } + { \par \bigskip } +\newenvironment{InstanceDescription}[4][xxxxxxxxxxxxxxx] + { + \subsubsection{The~instance~`#3'~(template~#2/#4)} + \subsubsection*{Attribute~values:} + \begingroup + \@beginparpenalty\@M + \def\InstanceKey##1##2{\>\textbf{##1}\>##2\\} + \def\InstanceSemantics{\endtabbing\endgroup + \vskip-30pt\vskip0pt + \subsubsection*{Layout~description~\&~Comments:}} + \tabbing + xxxx\=#1\=\kill + } + { \par \bigskip } +\DeclareDocumentCommand \OnlyDescription { } + { \bool_gset_false:N \g__codedoc_typeset_implementation_bool } +\DeclareDocumentCommand \AlsoImplementation { } + { \bool_gset_true:N \g__codedoc_typeset_implementation_bool } +\DeclareDocumentCommand \StopEventually { m } + { + \bool_if:NTF \g__codedoc_typeset_implementation_bool + { + \@bsphack + \tl_gset:Nn \g__codedoc_finale_tl { #1 \check@checksum } + \init@checksum + \@esphack + } + { #1 \endinput } + } +\DeclareDocumentCommand \Finale { } + { \tl_use:N \g__codedoc_finale_tl } +\tl_new:N \g__codedoc_finale_tl +\cs_new_protected:Npn \__codedoc_input:n #1 + { + \tl_gclear:N \g__codedoc_module_name_tl + \MakePercentIgnore + \input{#1} + \MakePercentComment + } +\DeclareDocumentCommand \DocInput { m } + { + \clist_map_inline:nn {#1} + { + \clist_put_right:Nn \g_docinput_clist {##1} + \__codedoc_input:n {##1} + } + } +\DeclareDocumentCommand \DocInputAgain { } + { \clist_map_function:NN \g_docinput_clist \__codedoc_input:n } +\NewDocumentCommand \DocInclude { m } + { + \relax\clearpage + \docincludeaux + \IfFileExists{#1.fdd} + { \cs_set_nopar:Npn \currentfile{#1.fdd} } + { \cs_set_nopar:Npn \currentfile{#1.dtx} } + \int_compare:nNnTF \@auxout = \@partaux + { \@latexerr{\string\include\space cannot~be~nested}\@eha } + { \@docinclude #1 } + } +\cs_gset:Npn \@docinclude #1 + { + \clearpage + \immediate\write\@mainaux{\string\@input{#1.aux}} + \@tempswatrue + \if@partsw + \@tempswafalse + \cs_set_nopar:Npx \@tempb{#1} + \@for\@tempa:=\@partlist\do + { + \ifx\@tempa\@tempb\@tempswatrue\fi + } + \fi + \if@tempswa + \cs_set_eq:NN \@auxout \@partaux + \immediate\openout\@partaux #1.aux + \immediate\write\@partaux{\relax} + \cs_set_eq:NN \@ltxdoc@PrintIndex \PrintIndex + \cs_set_eq:NN \PrintIndex \relax + \cs_set_eq:NN \@ltxdoc@PrintChanges \PrintChanges + \cs_set_eq:NN \PrintChanges \relax + \cs_set_eq:NN \@ltxdoc@theglossary \theglossary + \cs_set_eq:NN \@ltxdoc@endtheglossary \endtheglossary + \part{\currentfile} + { + \cs_set_eq:NN \ttfamily\relax + \cs_gset_nopar:Npx \filekey + { \filekey, \thepart = { \ttfamily \currentfile } } + } + \DocInput{\currentfile} + \cs_set_eq:NN \PrintIndex \@ltxdoc@PrintIndex + \cs_set_eq:NN \PrintChanges \@ltxdoc@PrintChanges + \cs_set_eq:NN \theglossary \@ltxdoc@theglossary + \cs_set_eq:NN \endtheglossary \@ltxdoc@endtheglossary + \clearpage + \@writeckpt{#1} + \immediate \closeout \@partaux + \else + \@nameuse{cp@#1} + \fi + \cs_set_eq:NN \@auxout \@mainaux + } +\cs_gset:Npn \codeline@wrindex #1 + { + \immediate\write\@indexfile + { + \string\indexentry{#1} + { \filesep \int_use:N \c@CodelineNo } + } + } +\tl_gclear:N \filesep +\cs_gset_nopar:Npn \docincludeaux + { + \tl_set:Nn \thepart { \alphalph { part } } + \tl_set:Nn \filesep { \thepart - } + \cs_set_eq:NN \filekey \use_none:n + \tl_gput_right:Nn \index@prologue + { + \cs_gset_nopar:Npn \@oddfoot + { + \parbox { \textwidth } + { + \strut \footnotesize + \raggedright { \bfseries File~Key: } ~ \filekey + } + } + \cs_set_eq:NN \@evenfoot \@oddfoot + } + \cs_gset_eq:NN \docincludeaux \relax + \cs_gset_nopar:Npn \@oddfoot + { + \cs_if_exist:cTF { ver @ \currentfile } + { File~\thepart :~{\ttfamily\currentfile}~ } + { + \GetFileInfo{\currentfile} + File~\thepart :~{\ttfamily\filename}~ + Date:~\ExplFileDate\ % space + Version~\ExplFileVersion + } + \hfill \thepage + } + \cs_set_eq:NN \@evenfoot \@oddfoot + } \group_begin: \char_set_catcode_escape:N \/ \char_set_catcode_other:N \^^A @@ -1007,457 +1410,371 @@ \char_set_lccode:nn { `\^^L } { `\{ } \char_set_lccode:nn { `\^^R } { `\} } \tl_to_lowercase:n - { - \group_end: - \cs_set_protected:Npn \xmacro@code - #1 ^^A ^^S^^S^^S^^S ^^Bend ^^Lmacrocode^^R - { \__codedoc_xmacro_code:n {#1} /end{macrocode} } - } + { + \group_end: + \cs_set_protected:Npn \xmacro@code + #1 ^^A ^^S^^S^^S^^S ^^Bend ^^Lmacrocode^^R + { \__codedoc_xmacro_code:n {#1} /end{macrocode} } + } \group_begin: \char_set_catcode_active:N \< \char_set_catcode_active:N \> \cs_new_protected:Npn \__codedoc_xmacro_code:n #1 - { - \tl_if_in:nnTF {#1} { < @ @ = } - { \__codedoc_xmacro_code:w #1 \q_stop } - { + { + \tl_if_in:nnTF {#1} { < @ @ = } + { \__codedoc_xmacro_code:w #1 \q_stop } + { + \tl_set:Nn \l__codedoc_tmpa_tl {#1} + \__codedoc_replace_at_at:N \l__codedoc_tmpa_tl + \tl_use:N \l__codedoc_tmpa_tl + } + } + \cs_new_protected:Npn \__codedoc_xmacro_code:w #1 < @ @ = #2 > #3 \q_stop + { \tl_set:Nn \l__codedoc_tmpa_tl {#1} \__codedoc_replace_at_at:N \l__codedoc_tmpa_tl - \tl_use:N \l__codedoc_tmpa_tl - } - } - \cs_new_protected:Npn \__codedoc_xmacro_code:w #1 < @ @ = #2 > #3 \q_stop - { - \tl_set:Nn \l__codedoc_tmpa_tl {#1} - \__codedoc_replace_at_at:N \l__codedoc_tmpa_tl - \tl_gset:Nn \g__codedoc_module_name_tl {#2} - \tl_put_right:Nn \l__codedoc_tmpa_tl { < @ @ = #2 > } + \tl_gset:Nn \g__codedoc_module_name_tl {#2} + \tl_put_right:Nn \l__codedoc_tmpa_tl { < @ @ = #2 > } - \tl_set:Nn \l__codedoc_tmpb_tl {#3} - \__codedoc_replace_at_at:N \l__codedoc_tmpb_tl - \tl_put_right:No \l__codedoc_tmpa_tl { \l__codedoc_tmpb_tl } + \tl_set:Nn \l__codedoc_tmpb_tl {#3} + \__codedoc_replace_at_at:N \l__codedoc_tmpb_tl + \tl_put_right:No \l__codedoc_tmpa_tl { \l__codedoc_tmpb_tl } - \tl_use:N \l__codedoc_tmpa_tl - } + \tl_use:N \l__codedoc_tmpa_tl + } \group_end: -\newcommand*{\DescribeOption} - { - \leavevmode - \@bsphack - \begingroup - \MakePrivateLetters - \Describe@Option - } -\newcommand*{\Describe@Option}[1] - { - \endgroup - \marginpar{ - \raggedleft - \PrintDescribeEnv{#1} - } - \SpecialOptionIndex{#1} - \@esphack - \ignorespaces - } -\newcommand*{\SpecialOptionIndex}[1] - { - \@bsphack - \begingroup - \HD@target - \let\HDorg@encapchar\encapchar - \edef\encapchar usage - { - \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage} - } - \index - { - #1\actualchar{\protect\ttfamily#1}~(option) - \encapchar usage - } - \index - { - options:\levelchar#1\actualchar{\protect\ttfamily#1} - \encapchar usage - } - \endgroup - \@esphack - } -\font\manual=manfnt -\cs_set_nopar:Npn \dbend { {\manual\char127} } -\newenvironment {danger} - { - \begin{trivlist}\item[]\noindent - \begingroup\hangindent=2pc\hangafter=-2 - \cs_set_nopar:Npn \par{\endgraf\endgroup} - \hbox to0pt{\hskip-\hangindent\dbend\hfill}\ignorespaces - } - { - \par\end{trivlist} - } -\newenvironment {ddanger} - { - \begin{trivlist}\item[]\noindent - \begingroup\hangindent=3.5pc\hangafter=-2 - \cs_set_nopar:Npn \par{\endgraf\endgroup} - \hbox to0pt{\hskip-\hangindent\dbend\kern2pt\dbend\hfill}\ignorespaces - }{ - \par\end{trivlist} - } -\newenvironment{TemplateInterfaceDescription}[1] - { - \subsection{The~object~type~`#1'} - \begingroup - \@beginparpenalty\@M - \description - \def\TemplateArgument##1##2{\item[Arg:~##1]##2\par} - \def\TemplateSemantics - { - \enddescription\endgroup - \subsubsection*{Semantics:} - } - } - { - \par\bigskip - } -\newenvironment{TemplateDescription}[2] +\iow_new:N \g__codedoc_func_iow +\tl_new:N \l__codedoc_doc_def_tl +\tl_new:N \l__codedoc_doc_undef_tl +\tl_new:N \l__codedoc_undoc_def_tl +\cs_new_protected_nopar:Npn \__codedoc_show_functions_defined: { - \subsection{The~template~`#2'~(object~type~#1)} - \subsubsection*{Attributes:} - \begingroup - \@beginparpenalty\@M - \description - \def\TemplateKey##1##2##3##4 - { - \item[##1~(##2)]##3% - \ifx\TemplateKey##4\TemplateKey\else - \hfill\penalty500\hbox{}\hfill Default:~##4% - \nobreak\hskip-\parfillskip\hskip0pt\relax - \fi - \par - } - \def\TemplateSemantics - { - \enddescription\endgroup - \subsubsection*{Semantics~\&~Comments:} - } + \bool_if:nT + { \g__codedoc_typeset_implementation_bool && \g__codedoc_checkfunc_bool } + { + \iow_term:x { \c__codedoc_iow_separator_tl \iow_newline: } + \iow_open:Nn \g__codedoc_func_iow { \c_job_name_tl .cmds } + + \tl_clear:N \l__codedoc_doc_def_tl + \tl_clear:N \l__codedoc_doc_undef_tl + \tl_clear:N \l__codedoc_undoc_def_tl + \seq_map_inline:Nn \g_doc_functions_seq + { + \seq_if_in:NnTF \g_doc_macros_seq {##1} + { + \tl_put_right:Nx \l__codedoc_doc_def_tl + { ##1 \iow_newline: } + \iow_now:Nn \g__codedoc_func_iow { > ~ ##1 } + } + { + \tl_put_right:Nx \l__codedoc_doc_undef_tl + { ##1 \iow_newline: } + \iow_now:Nn \g__codedoc_func_iow { ! ~ ##1 } + } + } + \seq_map_inline:Nn \g_doc_macros_seq + { + \seq_if_in:NnF \g_doc_functions_seq {##1} + { + \tl_put_right:Nx \l__codedoc_undoc_def_tl + { ##1 \iow_newline: } + \iow_now:Nn \g__codedoc_func_iow { ? ~ ##1 } + } + } + \__codedoc_functions_typeout:nN + { + Functions~both~documented~and~defined: \iow_newline: + (In~order~of~being~documented) + } + \l__codedoc_doc_def_tl + \__codedoc_functions_typeout:nN + { Functions~documented~but~not~defined: } + \l__codedoc_doc_undef_tl + \__codedoc_functions_typeout:nN + { Functions~defined~but~not~documented: } + \l__codedoc_undoc_def_tl + + \iow_close:N \g__codedoc_func_iow + \iow_term:x { \c__codedoc_iow_separator_tl } + } } - {\par\bigskip} -\newenvironment{InstanceDescription}[4][xxxxxxxxxxxxxxx] +\AtEndDocument { \__codedoc_show_functions_defined: } +\cs_new_protected:Npn \__codedoc_functions_typeout:nN #1#2 + { + \tl_if_empty:NF #2 + { + \typeout + { + \c__codedoc_iow_midrule_tl \iow_newline: + #1 \iow_newline: + \c__codedoc_iow_midrule_tl \iow_newline: + #2 + } + \tl_clear:N #2 + } + } +\cs_new_protected_nopar:Npn \__codedoc_show_not_tested: + { + \bool_if:NT \g__codedoc_checktest_bool + { + \tl_clear:N \l__codedoc_tmpa_tl + \prop_if_empty:NF \g__codedoc_missing_tests_prop + { + \cs_set:Npn \__codedoc_tmpa:w ##1##2 + { + \iow_newline: + \space\space\space\space \exp_not:n {##1} + \clist_map_function:nN {##2} \__codedoc_tmpb:w + } + \cs_set:Npn \__codedoc_tmpb:w ##1 + { + \iow_newline: + \space\space\space\space\space\space * ~ ##1 + } + \tl_put_right:Nx \l__codedoc_tmpa_tl + { + \iow_newline: \iow_newline: + The~ following~ macro(s)~ have~ incomplete~ tests: + \iow_newline: + \prop_map_function:NN + \g__codedoc_missing_tests_prop \__codedoc_tmpa:w + } + } + \seq_if_empty:NF \g__codedoc_not_tested_seq + { + \cs_set:Npn \__codedoc_tmpa:w ##1 + { \clist_map_function:nN {##1} \__codedoc_tmpb:w } + \cs_set:Npn \__codedoc_tmpb:w ##1 + { + \iow_newline: + \space\space\space\space ##1 + } + \tl_put_right:Nx \l__codedoc_tmpa_tl + { + \iow_newline: + \iow_newline: + The~ following~ macro(s)~ do~ not~ have~ any~ tests: + \iow_newline: + \seq_map_function:NN + \g__codedoc_not_tested_seq \__codedoc_tmpa:w + } + } + \tl_if_empty:NF \l__codedoc_tmpa_tl + { + \int_set:Nn \l__codedoc_tmpa_int { \etex_interactionmode:D } + \errorstopmode + \ClassError { l3doc } { \l__codedoc_tmpa_tl } { } + \int_set:Nn \etex_interactionmode:D { \l__codedoc_tmpa_int } + } + } + } +\AtEndDocument { \__codedoc_show_not_tested: } +\g@addto@macro \theindex { \MakePrivateLetters } +\cs_gset:Npn \verbatimchar {&} +\setcounter { IndexColumns } { 2 } +\IndexPrologue + { + \part*{Index} + \markboth{Index}{Index} + \addcontentsline{toc}{part}{Index} + The~italic~numbers~denote~the~pages~where~the~ + corresponding~entry~is~described,~ + numbers~underlined~point~to~the~definition,~ + all~others~indicate~the~places~where~it~is~used. + } +\cs_gset_protected:Npn \SpecialIndex #1 { - \subsubsection{The~instance~`#3'~(template~#2/#4)} - \subsubsection*{Attribute~values:} - \begingroup - \@beginparpenalty\@M - \def\InstanceKey##1##2{\>\textbf{##1}\>##2\\} - \def\InstanceSemantics{\endtabbing\endgroup - \vskip-30pt\vskip0pt - \subsubsection*{Layout~description~\&~Comments:}} - \tabbing - xxxx\=#1\=\kill - } - {\par\bigskip} -\cs_set_nopar:Npn \AlsoImplementation - { - \bool_set_true:N \g__codedoc_implementation_bool - \cs_set:Npn \StopEventually ##1 - { \@bsphack - \cs_gset_nopar:Npn \Finale { ##1 \check@checksum } - \init@checksum + \__codedoc_special_index:nn {#1} { } \@esphack - } - } -\AlsoImplementation -\cs_set_nopar:Npn \OnlyDescription - { - \@bsphack - \bool_set_false:N \g__codedoc_implementation_bool - \cs_set:Npn \StopEventually ##1 { ##1 \endinput } - \@esphack - } -\cs_set_eq:NN \Finale \relax -\cs_set_nopar:Npn \partname{File} -\cs_set:Npn \DocInput #1 - { - \clist_map_inline:nn {#1} - { - \clist_put_right:Nn \g_docinput_clist {##1} - \tl_gclear:N \g__codedoc_module_name_tl - \MakePercentIgnore - \input{##1} - \MakePercentComment - } - } -\cs_set:Npn \DocInputAgain - { - \clist_map_inline:Nn \g_docinput_clist - { - \MakePercentIgnore - \tl_gclear:N \g__codedoc_module_name_tl - \input{##1} - \MakePercentComment - } - } -\cs_set_nopar:Npn \partname{File} -\newcommand*{\DocInclude}[1] - { - \relax\clearpage - \docincludeaux - \IfFileExists{#1.fdd} - { \cs_set_nopar:Npn \currentfile{#1.fdd} } - { \cs_set_nopar:Npn \currentfile{#1.dtx} } - \ifnum\@auxout=\@partaux - \@latexerr{\string\include\space cannot~be~nested}\@eha - \else - \@docinclude #1 - \fi - } -\cs_set_nopar:Npn \@docinclude #1 - { - \clearpage - \immediate\write\@mainaux{\string\@input{#1.aux}} - \@tempswatrue - \if@partsw - \@tempswafalse - \cs_set_nopar:Npx \@tempb{#1} - \@for\@tempa:=\@partlist\do - { - \ifx\@tempa\@tempb\@tempswatrue\fi - } - \fi - \if@tempswa - \cs_set_eq:NN \@auxout\@partaux - \immediate\openout\@partaux #1.aux - \immediate\write\@partaux{\relax} - \cs_set_eq:NN \@ltxdoc@PrintIndex\PrintIndex - \cs_set_eq:NN \PrintIndex\relax - \cs_set_eq:NN \@ltxdoc@PrintChanges\PrintChanges - \cs_set_eq:NN \PrintChanges\relax - \cs_set_eq:NN \@ltxdoc@theglossary\theglossary - \cs_set_eq:NN \@ltxdoc@endtheglossary\endtheglossary - \part{\currentfile} - { - \cs_set_eq:NN \ttfamily\relax - \cs_gset_nopar:Npx \filekey{\filekey, \thepart={\ttfamily\currentfile}} - } - \DocInput{\currentfile} - \cs_set_eq:NN \PrintIndex\@ltxdoc@PrintIndex - \cs_set_eq:NN \PrintChanges\@ltxdoc@PrintChanges - \cs_set_eq:NN \theglossary\@ltxdoc@theglossary - \cs_set_eq:NN \endtheglossary\@ltxdoc@endtheglossary - \clearpage - \@writeckpt{#1} - \immediate\closeout\@partaux - \else - \@nameuse{cp@#1} - \fi - \cs_set_eq:NN \@auxout\@mainaux - } -\cs_gset_nopar:Npn \codeline@wrindex #1 - { - \immediate\write\@indexfile - { - \string\indexentry{#1} - { \filesep \int_use:N \c@CodelineNo } - } - } -\cs_set_eq:NN \filesep \@empty -\cs_set_nopar:Npn \docincludeaux - { - \cs_set_nopar:Npn \thepart {\alphalph{part}} - \cs_set_nopar:Npn \filesep {\thepart-} - \cs_set_eq:NN \filekey\@gobble - \g@addto@macro\index@prologue - { - \cs_gset_nopar:Npn\@oddfoot - { - \parbox{\textwidth} - { - \strut\footnotesize - \raggedright{\bfseries File~Key:}~\filekey - } - } - \cs_set_eq:NN \@evenfoot\@oddfoot - } - \cs_gset_eq:NN \docincludeaux\relax - \cs_gset_nopar:Npn\@oddfoot - { - \expandafter\ifx\csname ver@\currentfile\endcsname\relax - File~\thepart :~{\ttfamily\currentfile}~ - \else - \GetFileInfo{\currentfile} - File~\thepart :~{\ttfamily\filename}~ - Date:~\ExplFileDate\ % space - Version~\ExplFileVersion - \fi - \hfill\thepage - } - \cs_set_eq:NN \@evenfoot \@oddfoot - } -\iow_new:N \g__codedoc_func_iow -\cs_new_nopar:Npn \__codedoc_show_functions_defined: - { - \bool_if:nT { \g__codedoc_implementation_bool && \g__codedoc_checkfunc_bool } - { - \typeout{ ======================================== ^^J } - \iow_open:Nn \g__codedoc_func_iow { \c_job_name_tl .cmds } - - \tl_clear:N \l__codedoc_tmpa_tl - \seq_map_inline:Nn \g_doc_functions_seq - { - \seq_if_in:NnT \g_doc_macros_seq {##1} - { - \tl_put_right:Nn \l__codedoc_tmpa_tl { ##1 ^^J } - \iow_now:Nn \g__codedoc_func_iow { > ~ ##1 } - } - } - - \__codedoc_functions_typeout:n - { - Functions~both~documented~and~defined:^^J - (In~order~of~being~documented) - } - - \seq_map_inline:Nn \g_doc_functions_seq - { - \seq_if_in:NnF \g_doc_macros_seq {##1} - { - \tl_put_right:Nn \l__codedoc_tmpa_tl { ##1 ^^J } - \iow_now:Nn \g__codedoc_func_iow { ! ~ ##1} - } - } - \__codedoc_functions_typeout:n { Functions~documented~but~not~defined: } - - \seq_map_inline:Nn \g_doc_macros_seq - { - \seq_if_in:NnF \g_doc_functions_seq {##1} - { - \tl_put_right:Nn \l__codedoc_tmpa_tl { ##1 ^^J } - \iow_now:Nn \g__codedoc_func_iow { ? ~ ##1} - } - } - \__codedoc_functions_typeout:n { Functions~defined~but~not~documented: } - - \iow_close:N \g__codedoc_func_iow - \typeout{ ======================================== } - } -} -\AtEndDocument{ \__codedoc_show_functions_defined: } -\cs_set_nopar:Npn \__codedoc_functions_typeout:n #1 - { - \tl_if_empty:NF \l__codedoc_tmpa_tl - { - \typeout - { - -------------------------------------- ^^J #1 ^^J - -------------------------------------- ^^J \l__codedoc_tmpa_tl - } - \tl_clear:N \l__codedoc_tmpa_tl - } - } -\cs_new:Npn \__codedoc_show_not_tested: - { - \bool_if:NT \g__codedoc_checktest_bool - { - \bool_if:nT { !(\seq_if_empty_p:N \g__codedoc_not_tested_seq) || - !(\prop_if_empty_p:N \g__codedoc_missing_tests_prop) } - { - \tl_clear:N \l__codedoc_tmpa_tl - \prop_if_empty:NF \g__codedoc_missing_tests_prop - { - \tl_put_right:Nn \l__codedoc_tmpa_tl - { - ^^J^^JThe~ following~ macro(s)~ have~ incomplete~ tests:^^J - } - \prop_map_inline:Nn \g__codedoc_missing_tests_prop - { - \tl_put_right:Nn \l__codedoc_tmpa_tl - {^^J\space\space\space\space ##1 - ^^J\space\space\space\space\space\space ##2} - } - } - \seq_if_empty:NF \g__codedoc_not_tested_seq - { - \tl_put_right:Nn \l__codedoc_tmpa_tl - { - ^^J^^J - The~ following~ macro(s)~ do~ not~ have~ any~ tests:^^J - } - \seq_map_inline:Nn \g__codedoc_not_tested_seq - { - \clist_map_inline:nn {##1} - { - \tl_put_right:Nn \l__codedoc_tmpa_tl {^^J\space\space\space\space ####1} - } - } - \int_set:Nn \l_tmpa_int {\etex_interactionmode:D} - \errorstopmode - \ClassError{l3doc}{\l__codedoc_tmpa_tl}{} - \int_set:Nn \etex_interactionmode:D {\l_tmpa_int} - } - } - } - } -\AtEndDocument{ \__codedoc_show_not_tested: } -\g@addto@macro\theindex{\MakePrivateLetters} -\cs_set:Npn \verbatimchar {&} -\setcounter{IndexColumns}{2} -\IndexPrologue - { - \part*{Index} - \markboth{Index}{Index} - \addcontentsline{toc}{part}{Index} - The~italic~numbers~denote~the~pages~where~the~ - corresponding~entry~is~described,~ - numbers~underlined~point~to~the~definition,~ - all~others~indicate~the~places~where~it~is~used. - } - -\cs_set_nopar:Npn \__codedoc_special_main_index:n #1 - { - \HD@target - \index - { - \@gobble#1 - \actualchar - \string\verb\quotechar*\verbatimchar#1\verbatimchar - \encapchar - hdclindex{\the\c@HD@hypercount}{usage} - } - } -\cs_generate_variant:Nn \__codedoc_special_main_index:n { o , x } -\msg_new:nnn {l3doc} {print-index-howto} - { - Generate~the~index~by~executing\\ - \iow_indent:n { makeindex~-s~gind.ist~-o~\c_job_name_tl .ind~\c_job_name_tl .idx } - } -\tl_gput_right:Nn \PrintIndex { \AtEndDocument{ \msg_info:nn {l3doc} {print-index-howto} } } + } +\msg_new:nnn { l3doc } { print-index-howto } + { + Generate~the~index~by~executing\\ + \iow_indent:n + { makeindex~-s~gind.ist~-o~\c_job_name_tl.ind~\c_job_name_tl.idx } + } +\tl_gput_right:Nn \PrintIndex + { \AtEndDocument { \msg_info:nn { l3doc } { print-index-howto } } } +\cs_gset_protected:Npn \it@is@a #1 + { + \use:x + { + \__codedoc_special_index_module:nnnn + { \quotechar #1 } + { \quotechar \bslash \quotechar #1 } + { } + { } + } + } +\cs_new_protected:Npn \__codedoc_special_index:nn #1#2 + { + \__codedoc_key_get:n {#1} + \__codedoc_special_index_module:ooon + { \l__codedoc_index_key_tl } + { \l__codedoc_index_macro_tl } + { \l__codedoc_index_module_tl } + {#2} + } +\cs_generate_variant:Nn \__codedoc_special_index:nn { o } +\tl_new:N \l__codedoc_index_escaped_macro_tl +\cs_new_protected:Npn \__codedoc_special_index_module:nnnn #1#2#3#4 + { + \use:x + { + \exp_not:n { \__codedoc_special_index_aux:nnnnn {#1} {#2} } + \str_case_x:nnF {#3} + { + { } { { } { } } + { TeX } + { + { TeX~and~LaTeX2e~commands } + { \string\TeX{}~and~\string\LaTeXe{}~commands: } + } + } + { { #3~commands } { \string\pkg{#3}~commands: } } + } + {#4} + } +\cs_generate_variant:Nn \__codedoc_special_index_module:nnnn { ooo } +\cs_new_protected:Npn \__codedoc_special_index_aux:nnnnn #1#2#3#4#5 + { + \HD@target + \__codedoc_special_index_set:Nn \l__codedoc_index_escaped_macro_tl {#2} + \index + { + \tl_if_empty:nF { #3 #4 } + { #3 \actualchar #4 \levelchar } + #1 + \actualchar + { + \token_to_str:N \verbatim@font \c_space_tl + \l__codedoc_index_escaped_macro_tl + } + \encapchar + hdclindex{\the\c@HD@hypercount}{#5} + } + } +\cs_generate_variant:Nn \__codedoc_special_index_aux:nnnnn { o } +\cs_new_protected:Npn \__codedoc_special_index_set:Nn #1#2 + { + \tl_set:Nx #1 { \tl_to_str:n {#2} } + \int_compare:nNnTF { \tl_count:n {#2} } < { \tl_count:N #1 } + { + \tl_set:Nn #1 {#2} + \tl_replace_all:Non #1 + { \c__codedoc_backslash_tl } + { \token_to_str:N \bslash \c_space_tl } + } + { + \exp_args:Nx \tl_map_inline:nn + { \tl_to_str:N \verbatimchar \token_to_str:N _ } + { + \tl_replace_all:Nnn #1 {##1} + { + \verbatimchar \c__codedoc_backslash_tl ##1 + \token_to_str:N \verb \quotechar * \verbatimchar + } + } + \tl_map_inline:nn { \actualchar \encapchar \levelchar } + { + \tl_replace_all:Nxn #1 + { \tl_to_str:N ##1 } { \quotechar \tl_to_str:N ##1 } + } + \tl_set:Nx #1 + { + \token_to_str:N \verb \quotechar * \verbatimchar + #1 \verbatimchar + } + } + } +\cs_new_protected:Npn \__codedoc_key_get:n #1 + { + \tl_set:Nn \l__codedoc_index_macro_tl {#1} + \tl_set:Nx \l__codedoc_index_key_tl { \tl_to_str:n {#1} } + \tl_clear:N \l__codedoc_index_module_tl + \tl_if_head_eq_charcode:oNT + { \l__codedoc_index_key_tl } \c__codedoc_backslash_token + { \__codedoc_key_pop: } + \tl_if_in:NoTF \l__codedoc_index_key_tl { \token_to_str:N : } + { \__codedoc_key_expl: } + { + \tl_if_in:NoTF \l__codedoc_index_key_tl { \token_to_str:N _ } + { \__codedoc_key_expl: } + { + \tl_if_in:NoT \l__codedoc_index_key_tl { \token_to_str:N @ } + { \tl_set:Nn \l__codedoc_index_module_tl { TeX } } + } + } + } +\cs_new_protected_nopar:Npn \__codedoc_key_pop: + { + \tl_set:Nx \l__codedoc_index_key_tl + { \tl_tail:N \l__codedoc_index_key_tl } + } +\cs_new_protected_nopar:Npn \__codedoc_key_expl: + { + \tl_if_head_eq_charcode:oNTF { \l__codedoc_index_key_tl } . + { \__codedoc_key_pop: } + { + \exp_args:Nx \tl_if_head_eq_charcode:nNT + { \exp_args:No \str_tail:n \l__codedoc_index_key_tl } _ + { + \tl_if_head_eq_charcode:oNTF { \l__codedoc_index_key_tl } _ + { + \__codedoc_key_pop: + \__codedoc_key_pop: + } + { + \__codedoc_key_pop: + \__codedoc_key_pop: + \tl_if_head_eq_charcode:oNT { \l__codedoc_index_key_tl } _ + { \__codedoc_key_pop: } + } + } + } + \__codedoc_key_get_module: + } +\cs_new_protected_nopar:Npn \__codedoc_key_get_module: + { + \tl_set_eq:NN \l__codedoc_index_module_tl \l__codedoc_index_key_tl + \exp_args:No \__codedoc_key_get_module_aux:n { \token_to_str:N : } + \exp_args:No \__codedoc_key_get_module_aux:n { \token_to_str:N _ } + } +\cs_new_protected:Npn \__codedoc_key_get_module_aux:n #1 + { + \cs_set:Npn \__codedoc_tmpa:w ##1 #1 ##2 \q_stop { \exp_not:n {##1} } + \tl_set:Nx \l__codedoc_index_module_tl + { \exp_after:wN \__codedoc_tmpa:w \l__codedoc_index_module_tl #1 \q_stop } + } \GlossaryPrologue - { - \part*{Change~History} - {\GlossaryParms\ttfamily\hyphenchar\font=`\-} - \markboth{Change~History}{Change~History} - \addcontentsline{toc}{part}{Change~History} - } -\msg_new:nnn {l3doc} {print-changes-howto} - { - Generate~the~change~list~by~executing\\ - \iow_indent:n { makeindex~-s~gglo.ist~-o~\c_job_name_tl .gls~\c_job_name_tl .glo } - } -\tl_gput_right:Nn \PrintChanges { \AtEndDocument{ \msg_info:nn {l3doc} {print-changes-howto} } } -\bool_if:NTF \g__codedoc_full_bool - { - \RecordChanges - \CodelineIndex - \EnableCrossrefs - \AlsoImplementation - } - { - \CodelineNumbered - \DisableCrossrefs - \OnlyDescription - } + { + \part*{Change~History} + {\GlossaryParms\ttfamily\hyphenchar\font=`\-} + \markboth{Change~History}{Change~History} + \addcontentsline{toc}{part}{Change~History} + } +\msg_new:nnn { l3doc } { print-changes-howto } + { + Generate~the~change~list~by~executing\\ + \iow_indent:n + { makeindex~-s~gglo.ist~-o~\c_job_name_tl.gls~\c_job_name_tl.glo } + } +\tl_gput_right:Nn \PrintChanges + { \AtEndDocument { \msg_info:nn { l3doc } { print-changes-howto } } } +\bool_if:NTF \g__codedoc_typeset_implementation_bool + { + \RecordChanges + \CodelineIndex + \EnableCrossrefs + \AlsoImplementation + } + { + \CodelineNumbered + \DisableCrossrefs + \OnlyDescription + } %% %% %% End of file `l3doc.cls'. |