Debian Codegraph @

texmf-dist/tex/latex/l3kernel/l3doc.cls

raw
1 %%
2 %% This is file `l3doc.cls',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% l3doc.dtx (with options: `class')
8 %%
9 %% Copyright (C) 1990-2026 The LaTeX Project
10 %%
11 %% It may be distributed and/or modified under the conditions of
12 %% the LaTeX Project Public License (LPPL), either version 1.3c of
13 %% this license or (at your option) any later version. The latest
14 %% version of this license is in the file:
15 %%
16 %% https://www.latex-project.org/lppl.txt
17 %%
18 %% This file is part of the "l3kernel bundle" (The Work in LPPL)
19 %% and all files in that bundle must be distributed together.
20 %%
21 %% File: l3doc.dtx
22 \RequirePackage{calc}
23 \ProvidesExplClass{l3doc}{2026-05-15}{}
24 {L3 Experimental documentation class}
25 \clist_new:N \g_docinput_clist
26 \seq_new:N \g_doc_functions_seq
27 \seq_new:N \g_doc_macros_seq
28 \bool_new:N \l__codedoc_detect_internals_bool
29 \bool_set_true:N \l__codedoc_detect_internals_bool
30 \tl_new:N \l__codedoc_detect_internals_tl
31 \tl_new:N \l__codedoc_detect_internals_cs_tl
32 \coffin_new:N \l__codedoc_output_coffin
33 \coffin_new:N \l__codedoc_functions_coffin
34 \coffin_new:N \l__codedoc_descr_coffin
35 \coffin_new:N \l__codedoc_syntax_coffin
36 \box_new:N \g__codedoc_syntax_box
37 \bool_new:N \l__codedoc_in_function_bool
38 \bool_new:N \l__codedoc_long_name_bool
39 \dim_new:N \l__codedoc_trial_width_dim
40 \int_new:N \l__codedoc_nested_macro_int
41 \bool_new:N \l__codedoc_macro_tested_bool
42 \prop_new:N \g__codedoc_missing_tests_prop
43 \seq_new:N \g__codedoc_not_tested_seq
44 \seq_new:N \g__codedoc_testfiles_seq
45 \bool_new:N \l__codedoc_macro_deprecated_bool
46 \bool_new:N \l__codedoc_macro_internal_bool
47 \bool_new:N \l__codedoc_macro_nodoc_bool
48 \bool_new:N \l__codedoc_macro_TF_bool
49 \bool_new:N \l__codedoc_macro_pTF_bool
50 \bool_new:N \l__codedoc_macro_noTF_bool
51 \bool_new:N \l__codedoc_macro_EXP_bool
52 \bool_new:N \l__codedoc_macro_rEXP_bool
53 \bool_new:N \l__codedoc_macro_var_bool
54 \tl_new:N \l__codedoc_override_module_tl
55 \tl_set:Nn \l__codedoc_override_module_tl { \q_no_value }
56 \tl_new:N \l__codedoc_macro_documented_tl
57 \bool_new:N \g__codedoc_lmodern_bool
58 \bool_new:N \g__codedoc_checkfunc_bool
59 \bool_new:N \g__codedoc_checktest_bool
60 \bool_new:N \g__codedoc_kernel_bool
61 \bool_new:N \g__codedoc_cs_break_bool
62 \bool_new:N \g__codedoc_show_notes_bool
63 \bool_gset_true:N \g__codedoc_cs_break_bool
64 \tl_new:N \l__codedoc_tmpa_tl
65 \tl_new:N \l__codedoc_tmpb_tl
66 \int_new:N \l__codedoc_tmpa_int
67 \int_new:N \l__codedoc_tmpa_seq
68 \tl_new:N \l__codedoc_names_block_tl
69 \seq_new:N \g__codedoc_variants_seq
70 \bool_new:N \l__codedoc_names_verb_bool
71 \seq_new:N \l__codedoc_names_seq
72 \seq_new:N \g__codedoc_nested_names_seq
73 \tl_new:N \l__codedoc_index_macro_tl
74 \tl_new:N \l__codedoc_index_key_tl
75 \tl_new:N \l__codedoc_index_module_tl
76 \tl_new:N \l__codedoc_macro_do_not_index_tl
77 \bool_new:N \l__codedoc_index_internal_bool
78 \tl_new:N \g__codedoc_module_name_tl
79 \box_new:N \l__codedoc_macro_box
80 \box_new:N \l__codedoc_macro_index_box
81 \int_new:N \l__codedoc_macro_int
82 \tl_new:N \l__codedoc_cmd_tl
83 \tl_new:N \l__codedoc_cmd_index_tl
84 \tl_new:N \l__codedoc_cmd_module_tl
85 \bool_new:N \l__codedoc_cmd_noindex_bool
86 \bool_new:N \l__codedoc_cmd_replace_bool
87 \bool_new:N \l__codedoc_in_implementation_bool
88 \bool_new:N \g__codedoc_typeset_documentation_bool
89 \bool_new:N \g__codedoc_typeset_implementation_bool
90 \bool_gset_true:N \g__codedoc_typeset_documentation_bool
91 \bool_gset_true:N \g__codedoc_typeset_implementation_bool
92 \tl_new:N \g__codedoc_base_name_tl
93 \clist_new:N \l__codedoc_function_label_clist
94 \bool_new:N \l__codedoc_no_label_bool
95 \tl_new:N \l__codedoc_date_added_tl
96 \tl_new:N \l__codedoc_date_updated_tl
97 \tl_new:N \l__codedoc_macro_argument_tl
98 \cs_new_eq:NN \__codedoc_tmpa:w ?
99 \cs_new_eq:NN \__codedoc_tmpb:w ?
100 \cs_generate_variant:Nn \seq_set_split:Nnn { NoV }
101 \cs_generate_variant:Nn \tl_to_str:n { f }
102 \prg_new_protected_conditional:Npnn \__codedoc_if_almost_str:n #1 { TF , T , F }
103 {
104 \int_compare:nNnTF
105 { \tl_count:n {#1} }
106 < { \tl_count:e { \tl_to_str:f {#1} } }
107 { \prg_return_false: }
108 { \prg_return_true: }
109 }
110 \prg_generate_conditional_variant:Nnn \__codedoc_if_almost_str:n { V } { T }
111 \cs_new_protected:Npn \__codedoc_trim_right:Nn #1#2
112 {
113 \cs_set:Npn \__codedoc_tmp:w ##1 #2 ##2 \q_stop { \exp_not:n {##1} }
114 \__kernel_tl_set:Nx #1 { \exp_after:wN \__codedoc_tmp:w #1 #2 \q_stop }
115 }
116 \cs_generate_variant:Nn \__codedoc_trim_right:Nn { No }
117 \prg_new_protected_conditional:Npnn \__codedoc_str_if_begin:nn #1#2 { TF , T , F }
118 {
119 \tl_if_in:ooTF
120 { \exp_after:wN \scan_stop: \tl_to_str:n {#1} }
121 { \exp_after:wN \scan_stop: \tl_to_str:n {#2} }
122 { \prg_return_true: }
123 { \prg_return_false: }
124 }
125 \prg_generate_conditional_variant:Nnn \__codedoc_str_if_begin:nn
126 { oo } { TF , T , F }
127 \cs_new_protected:Npn \__codedoc_replace_at_at:N #1
128 {
129 \tl_if_empty:NF \g__codedoc_module_name_tl
130 {
131 \exp_args:NNo \__codedoc_replace_at_at_aux:Nn
132 #1 \g__codedoc_module_name_tl
133 }
134 }
135 \cs_new_protected:Npe \__codedoc_replace_at_at_aux:Nn #1#2
136 {
137 \tl_replace_all:Nnn #1 { \token_to_str:N @ } { @ }
138 \tl_replace_all:Nnn #1 { \token_to_str:N _ } { _ }
139 \tl_replace_all:Nnn #1 { @ @ @ @ } { \token_to_str:N a a }
140 \tl_replace_all:Nnn #1 { _ _ @ @ } { _ _ #2 }
141 \tl_replace_all:Nnn #1 { _ @ @ } { _ _ #2 }
142 \tl_replace_all:Nnn #1 { @ @ } { _ _ #2 }
143 \tl_replace_all:Nnn #1 { \token_to_str:N a a } { @ @ }
144 }
145 \cs_new_protected:Npn \__codedoc_detect_internals:N #1
146 {
147 \bool_if:NT \l__codedoc_detect_internals_bool
148 { \__codedoc_detect_internals_aux:N #1 }
149 }
150 \group_begin:
151 \char_set_catcode_active:N \^^M
152 \cs_new_protected:Npn \__codedoc_detect_internals_aux:N #1
153 {
154 \tl_set_eq:NN \l__codedoc_detect_internals_tl #1
155 \tl_replace_all:NVn \l__codedoc_detect_internals_tl \c_underscore_str { _ }
156 \seq_set_split:NnV \l__codedoc_tmpa_seq { _ _ } \l__codedoc_detect_internals_tl
157 \seq_pop_left:NN \l__codedoc_tmpa_seq \l__codedoc_detect_internals_tl
158 \seq_map_variable:NNn \l__codedoc_tmpa_seq \l__codedoc_detect_internals_tl
159 {
160 \__codedoc_trim_right:No \l__codedoc_detect_internals_tl
161 \c_catcode_active_space_tl
162 \__codedoc_trim_right:Nn \l__codedoc_detect_internals_tl ^^M
163 \__codedoc_if_detect_internals_ok:NF \l__codedoc_detect_internals_tl
164 {
165 \tl_set_eq:NN \l__codedoc_detect_internals_cs_tl \l__codedoc_detect_internals_tl
166 \__codedoc_trim_right:Nn \l__codedoc_detect_internals_tl _
167 \__codedoc_trim_right:Nn \l__codedoc_detect_internals_tl :
168 \__codedoc_trim_right:No \l__codedoc_detect_internals_tl { \token_to_str:N : }
169 \msg_warning:nneee { l3doc } { foreign-internal }
170 { \tl_to_str:N \l__codedoc_detect_internals_cs_tl }
171 { \tl_to_str:N \l__codedoc_detect_internals_tl }
172 { \tl_to_str:N \g__codedoc_module_name_tl }
173 }
174 }
175 }
176 \group_end:
177 \prg_new_protected_conditional:Npnn \__codedoc_if_detect_internals_ok:N #1 { F }
178 {
179 \__codedoc_str_if_begin:ooTF {#1} { \g__codedoc_module_name_tl _ }
180 { \prg_return_true: }
181 {
182 \__codedoc_str_if_begin:ooTF {#1} { \g__codedoc_module_name_tl : }
183 { \prg_return_true: }
184 {
185 \bool_if:NTF \g__codedoc_kernel_bool
186 {
187 \__codedoc_str_if_begin:ooTF {#1} { kernel _ }
188 { \prg_return_true: }
189 { \prg_return_false: }
190 }
191 { \prg_return_false: }
192 }
193 }
194 }
195 \cs_new:Npn \__codedoc_signature_base_form:n #1
196 { \__codedoc_signature_base_form_aux:n #1 \q_stop }
197 \cs_new:Npn \__codedoc_signature_base_form_aux:n #1
198 {
199 \str_case:nnTF {#1}
200 {
201 { N } { N }
202 { c } { N }
203 { n } { n }
204 { o } { n }
205 { f } { n }
206 { e } { n }
207 { x } { n }
208 { V } { n }
209 { v } { n }
210 }
211 { \__codedoc_signature_base_form_aux:n }
212 { \__codedoc_signature_base_form_aux:w #1 }
213 }
214 \cs_new:Npn \__codedoc_signature_base_form_aux:w #1 \q_stop
215 { \exp_not:n {#1} }
216 \cs_new:Npn \__codedoc_predicate_from_base:n #1
217 {
218 \__codedoc_get_function_name:n {#1}
219 \tl_to_str:n { _p: }
220 \__codedoc_get_function_signature:n {#1}
221 }
222 \cs_new:Npn \__codedoc_get_function_name:n #1
223 { \__codedoc_split_function_do:nn {#1} { \use_i:nnn } }
224 \cs_new:Npn \__codedoc_get_function_signature:n #1
225 { \__codedoc_split_function_do:nn {#1} { \use_ii:nnn } }
226 \cs_set_protected:Npn \__codedoc_tmpa:w #1
227 {
228 \cs_new:Npn \__codedoc_split_function_do:nn ##1
229 {
230 \exp_after:wN \__codedoc_split_function_auxi:w
231 \tl_to_str:n {##1} \q_mark \c_true_bool
232 #1 \q_mark \c_false_bool
233 \q_stop
234 }
235 \cs_new:Npn \__codedoc_split_function_auxi:w
236 ##1 #1 ##2 \q_mark ##3##4 \q_stop ##5
237 { \__codedoc_split_function_auxii:w {##5} ##1 \q_mark \q_stop {##2} ##3 }
238 \cs_new:Npn \__codedoc_split_function_auxii:w
239 ##1##2 \q_mark ##3 \q_stop
240 { ##1 {##2} }
241 }
242 \exp_args:No \__codedoc_tmpa:w { \token_to_str:N : }
243 \cs_generate_variant:Nn \__codedoc_split_function_do:nn { o }
244 \cs_new_protected:Npn \__codedoc_key_get_base:nN #1#2
245 {
246 \__codedoc_if_almost_str:nTF {#1}
247 {
248 \__codedoc_key_get_base_TF:nN {#1} \l__codedoc_tmpa_tl
249 \__kernel_tl_set:Nx #2
250 { \__codedoc_split_function_do:on \l__codedoc_tmpa_tl { \__codedoc_base_form_aux:nnN } }
251 }
252 { \tl_set:Nn #2 {#1} }
253 }
254 \cs_new:Npe \__codedoc_key_get_base_TF:nN #1#2
255 {
256 \__kernel_tl_set:Nx #2 { \exp_not:N \tl_to_str:n {#1} }
257 \tl_if_in:NoF #2 { \tl_to_str:n {:} }
258 { \exp_not:N \prg_break: }
259 \tl_if_in:onT { #2 z } { \tl_to_str:n {TF} z }
260 { \exp_not:N \prg_break: }
261 \tl_if_in:onT { #2 z } { \tl_to_str:n {T} z }
262 {
263 \tl_put_right:Nn #2 { \tl_to_str:n {F} }
264 \exp_not:N \prg_break:
265 }
266 \tl_if_in:onT { #2 z } { \tl_to_str:n {F} z }
267 {
268 \tl_put_right:Nn #2 { z }
269 \tl_replace_once:Nnn #2 { \tl_to_str:n {F} z } { \tl_to_str:n {TF} }
270 \exp_not:N \prg_break:
271 }
272 \exp_not:N \prg_break_point:
273 }
274 \cs_new:Npn \__codedoc_base_form_aux:nnN #1#2#3
275 {
276 \exp_not:n {#1}
277 \bool_if:NT #3
278 {
279 \token_to_str:N :
280 \bool_lazy_or:nnTF
281 { \str_if_eq_p:nn { #1 ~ } { \exp_args } }
282 { \str_if_eq_p:nn { #1 ~ } { \exp_last_unbraced } }
283 { \exp_not:n {#2} }
284 { \__codedoc_signature_base_form:n {#2} }
285 }
286 }
287 \cs_new_protected:Npn \__codedoc_base_form_signature_do:nnn #1#2#3
288 {
289 \__codedoc_split_function_do:nn {#1}
290 { \__codedoc_base_form_aux:nnnnnN {#1} {#2} {#3} }
291 }
292 \cs_new_protected:Npn \__codedoc_base_form_aux:nnnnnN #1#2#3#4#5#6
293 {
294 \bool_if:NTF #6
295 {
296 \tl_if_head_eq_charcode:nNTF {#4} :
297 { #2 {#1} }
298 {
299 \use:e
300 {
301 \exp_not:n {#3}
302 { \__codedoc_base_form_aux:nnN {#4} {#5} #6 }
303 }
304 {#4} {#5}
305 }
306 }
307 { #2 {#1} }
308 }
309 \prg_new_conditional:Npnn \__codedoc_date_compare:nNn #1#2#3 { TF , T , F , p }
310 { \__codedoc_date_compare_aux:w #1--- \q_mark #2 #3--- \q_stop }
311 \cs_new:Npn \__codedoc_date_compare_aux:w
312 #1 - #2 - #3 - #4 \q_mark #5 #6 - #7 - #8 - #9 \q_stop
313 {
314 \__codedoc_date_compare_aux:nnnNnnn
315 { \tl_if_empty:nTF {#1} { 0 } {#1} }
316 { \tl_if_empty:nTF {#2} { 0 } {#2} }
317 { \tl_if_empty:nTF {#3} { 0 } {#3} }
318 #5
319 { \tl_if_empty:nTF {#6} { 0 } {#6} }
320 { \tl_if_empty:nTF {#7} { 0 } {#7} }
321 { \tl_if_empty:nTF {#8} { 0 } {#8} }
322 }
323 \cs_new:Npn \__codedoc_date_compare_aux:nnnNnnn #1#2#3#4#5#6#7
324 {
325 \int_compare:nNnTF {#1} = {#5}
326 {
327 \int_compare:nNnTF {#2} = {#6}
328 {
329 \int_compare:nNnTF {#3} #4 {#7}
330 { \prg_return_true: } { \prg_return_false: }
331 }
332 {
333 \int_compare:nNnTF {#2} #4 {#6}
334 { \prg_return_true: } { \prg_return_false: }
335 }
336 }
337 {
338 \int_compare:nNnTF {#1} #4 {#5}
339 { \prg_return_true: } { \prg_return_false: }
340 }
341 \use_none:n
342 \q_stop
343 }
344 \cs_new:Npn \__codedoc_gprop_name:n #1 { g__codedoc ~ \tl_to_str:n {#1} }
345 \cs_new:Npn \__codedoc_lseq_name:n #1 { l__codedoc ~ \tl_to_str:n {#1} }
346 \msg_new:nnnn { l3doc } { no-signature-TF }
347 { Function/macro~'#1'~cannot~be~turned~into~a~conditional. }
348 {
349 A~function~or~macro~environment~with~option~pTF,~TF~or~noTF~
350 received~the~argument~'#1'.~This~function's~name~has~no~
351 ':'~hence~it~is~not~clear~where~to~add~'_p'~or~'TF'.~
352 Please~follow~expl3~naming~conventions.
353 }
354 \msg_new:nnn { l3doc } { date-format }
355 { The~date~'#1'~should~be~given~in~YYYY-MM-DD~format. }
356 \msg_new:nnn { l3doc } { future-date }
357 { The~added/updated~date~'#2'~of~'#1'~is~in~the~future. }
358 \msg_new:nnn { l3doc } { syntax-nested-function }
359 {
360 The~'syntax'~environment~should~be~used~in~the~
361 innermost~'function'~environment.
362 }
363 \msg_new:nnn { l3doc } { multiple-syntax }
364 {
365 The~'syntax'~environment~should~only~be~used~once~in~
366 a~'function'~environment.
367 }
368 \msg_new:nnn { l3doc } { deprecated-option }
369 { The~option~'#1'~has~been~deprecated~for~'#2'. }
370 \msg_new:nnn { l3doc } { foreign-internal }
371 {
372 A~control~sequence~of~the~form~'...__#1'~was~used.~
373 It~should~only~be~used~in~the~module~'#2'
374 \tl_if_empty:nF {#3} { ,~not~in~'#3' } .
375 }
376 \DeclareKeys [ l3doc / options ]
377 {
378 a5paper .code:n = \@latexerr { Option~not~supported } { } ,
379 full .code:n =
380 {
381 \bool_gset_true:N \g__codedoc_typeset_documentation_bool
382 \bool_gset_true:N \g__codedoc_typeset_implementation_bool
383 } ,
384 onlydoc .code:n =
385 {
386 \bool_gset_true:N \g__codedoc_typeset_documentation_bool
387 \bool_gset_false:N \g__codedoc_typeset_implementation_bool
388 } ,
389 check .bool_gset:N = \g__codedoc_checkfunc_bool ,
390 checktest .bool_gset:N = \g__codedoc_checktest_bool ,
391 kernel .bool_gset:N = \g__codedoc_kernel_bool ,
392 stdmodule .bool_gset_inverse:N = \g__codedoc_kernel_bool ,
393 lm-default .bool_gset:N = \g__codedoc_lmodern_bool ,
394 cs-break .bool_gset_inverse:N = \g__codedoc_cs_break_bool ,
395 cs-break-nohyphen .code:n = \PassOptionsToPackage{nohyphen}{underscore} ,
396 show-notes .bool_gset:N = \g__codedoc_show_notes_bool,
397 hide-notes .bool_gset_inverse:N = \g__codedoc_show_notes_bool ,
398 base-date .tl_set:N = \l__codedoc_base_date_tl ,
399 }
400 \DeclareUnknownKeyHandler [ l3doc / options ]
401 { \PassOptionsToClass { \CurrentOption } { article } }
402 \SetKeys [ l3doc / options ]
403 { full , check = false , checktest = false , lm-default , base-date = 2020-02-02 }
404 \PassOptionsToClass { a4paper } { article }
405 \msg_new:nnn { l3doc } { input-cfg }
406 { Local~config~file~l3doc.cfg~loaded. }
407 \file_if_exist:nT { l3doc.cfg }
408 {
409 \file_input:n { l3doc.cfg }
410 \cs_if_exist:cF { ExplMakeTitle }
411 { \msg_info:nn { l3doc } { input-cfg } }
412 }
413 \ProcessKeyOptions [ l3doc / options ]
414 \LoadClass{article}
415 \RequirePackage{doc}
416 \RequirePackage
417 {
418 array,
419 alphalph,
420 amsmath,
421 amssymb,
422 booktabs,
423 color,
424 colortbl,
425 hologo,
426 enumitem,
427 pifont,
428 textcomp,
429 trace,
430 csquotes,
431 fancyvrb,
432 underscore,
433 verbatim
434 }
435 \raggedbottom
436 \bool_if:NT \g__codedoc_lmodern_bool
437 {
438 \sys_if_engine_opentype:TF
439 {
440 \group_begin:
441 \ttfamily
442 \DeclareFontShape{TU}{lmtt}{m}{it}
443 {<-> \UnicodeFontFile{lmmonoslant10-regular}{}}{}
444 \group_end:
445 }
446 {
447 \RequirePackage[T1]{fontenc}
448 \RequirePackage{lmodern}
449 \group_begin:
450 \ttfamily
451 \DeclareFontShape{T1}{lmtt}{m}{it}{<->ec-lmtto10}{}
452 \group_end:
453 }
454 }
455 \RequirePackage{hypdoc}
456 \cs_gset:Npn \MakePrivateLetters
457 {
458 \char_set_catcode_letter:N \@
459 \char_set_catcode_letter:N \_
460 \char_set_catcode_letter:N \:
461 }
462 \setcounter{StandardModuleDepth}{1}
463 \@addtoreset{CodelineNo}{part}
464 \tl_replace_once:Nnn \theCodelineNo
465 { \HDorg@theCodelineNo }
466 { \textcolor[gray]{0.5} { \sffamily\tiny\arabic{CodelineNo} } }
467 \fvset{gobble=2}
468 \cs_gset_eq:NN \verbatim \Verbatim
469 \cs_gset_eq:NN \endverbatim \endVerbatim
470 \cs_set_protected:Npn \ifnot@excluded
471 {
472 \exp_args:Nee \expanded@notin
473 { \c_backslash_str \tl_to_str:N \macro@namepart , }
474 { \exp_args:NV \tl_to_str:n \index@excludelist }
475 }
476 \cs_new:Npn \pdfstringnewline { : ~ }
477 \DeclareExpandableDocumentCommand
478 { \__codedoc_pdfstring_newline:w } { s o m } { \pdfstringnewline #3 }
479 \pdfstringdefDisableCommands
480 { \cs_set_eq:NN \\ \__codedoc_pdfstring_newline:w }
481 \setlength \textwidth { 385pt }
482 \addtolength \marginparwidth { 30pt }
483 \addtolength \oddsidemargin { 20pt }
484 \addtolength \evensidemargin { 20pt }
485 \cs_new_eq:NN \__codedoc_oldlist:nn \list
486 \cs_gset:Npn \list #1 #2
487 { \__codedoc_oldlist:nn {#1} { #2 \dim_zero:N \listparindent } }
488 \setlength \parindent { 2em }
489 \setlength \itemindent { 0pt }
490 \setlength \parskip { 0pt plus 3pt minus 0pt }
491 \tl_gset:Nn \partname {File}
492 \@addtoreset{section}{part}
493 \cs_gset:Npn \l@section #1#2
494 {
495 \ifnum \c@tocdepth >\z@
496 \addpenalty\@secpenalty
497 \addvspace{1.0em \@plus\p@}
498 \setlength\@tempdima{2.5em} % was 1.5em
499 \begingroup
500 \parindent \z@ \rightskip \@pnumwidth
501 \parfillskip -\@pnumwidth
502 \leavevmode \bfseries
503 \advance\leftskip\@tempdima
504 \hskip -\leftskip
505 #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
506 \endgroup
507 \fi
508 }
509 \cs_gset:Npn \l@subsection
510 { \@dottedtocline{2}{2.5em}{2.3em} } % #2 = 1.5em
511 \AtBeginDocument
512 {
513 \MakeShortVerb \"
514 \MakeShortVerb \|
515 }
516 \AtEndDocument
517 {
518 \DeleteShortVerb \"
519 \DeleteShortVerb \|
520 }
521 \providecommand*\eTeX{\hologo{eTeX}}
522 \providecommand*\IniTeX{\hologo{iniTeX}}
523 \providecommand*\Lua{Lua}
524 \providecommand*\LuaTeX{\hologo{LuaTeX}}
525 \providecommand*\pdfTeX{\hologo{pdfTeX}}
526 \providecommand*\XeTeX{\hologo{XeTeX}}
527 \providecommand*\pTeX{p\kern-.2em\hologo{TeX}}
528 \providecommand*\upTeX{up\kern-.2em\hologo{TeX}}
529 \providecommand*\epTeX{$\varepsilon$-\pTeX}
530 \providecommand*\eupTeX{$\varepsilon$-\upTeX}
531 \providecommand*\ConTeXt{\hologo{ConTeXt}}
532 \DeclareDocumentCommand \cmd { O{} m }
533 { \__codedoc_cmd:no {#1} { \token_to_str:N #2 } }
534 \DeclareDocumentCommand \cs { O{} m }
535 { \__codedoc_cmd:no {#1} { \c_backslash_str #2 } }
536 \DeclareDocumentCommand \tn { O{} m }
537 {
538 \__codedoc_cmd:no
539 { module = TeX , replace = false , #1 }
540 { \c_backslash_str #2 }
541 }
542 \DeclareDocumentCommand \meta { m }
543 { \texttt{ \__codedoc_meta:n {#1} } }
544 \DeclareExpandableDocumentCommand
545 { \__codedoc_pdfstring_cmd:w } { o m } { \token_to_str:N #2 }
546 \DeclareExpandableDocumentCommand
547 { \__codedoc_pdfstring_cs:w } { o m } { \textbackslash \tl_to_str:n {#2} }
548 \cs_new:Npn \__codedoc_pdfstring_meta:w #1
549 { < \tl_to_str:n {#1} > }
550 \pdfstringdefDisableCommands
551 {
552 \cs_set_eq:NN \cmd \__codedoc_pdfstring_cmd:w
553 \cs_set_eq:NN \cs \__codedoc_pdfstring_cs:w
554 \cs_set_eq:NN \tn \__codedoc_pdfstring_cs:w
555 \cs_set_eq:NN \meta \__codedoc_pdfstring_meta:w
556 \cs_set_eq:NN \__codedoc_meta:n \__codedoc_pdfstring_meta:w
557 }
558 \newcommand\Arg[1]
559 { \texttt{\char`\{} \__codedoc_meta:n {#1} \texttt{\char`\}} }
560 \providecommand\marg[1]{ \Arg{#1} }
561 \providecommand\oarg[1]{ \texttt[ \__codedoc_meta:n {#1} \texttt] }
562 \providecommand\parg[1]{ \texttt( \__codedoc_meta:n {#1} \texttt) }
563 \DeclareRobustCommand \file {\nolinkurl}
564 \DeclareRobustCommand \env {\texttt}
565 \DeclareRobustCommand \pkg {\textsf}
566 \DeclareRobustCommand \cls {\textsf}
567 \NewDocumentCommand \EnableDocumentation { }
568 { \bool_gset_true:N \g__codedoc_typeset_documentation_bool }
569 \NewDocumentCommand \EnableImplementation { }
570 { \bool_gset_true:N \g__codedoc_typeset_implementation_bool }
571 \NewDocumentCommand \DisableDocumentation { }
572 { \bool_gset_false:N \g__codedoc_typeset_documentation_bool }
573 \NewDocumentCommand \DisableImplementation { }
574 { \bool_gset_false:N \g__codedoc_typeset_implementation_bool }
575 \NewDocumentEnvironment { documentation } { }
576 {
577 \bool_if:NTF \g__codedoc_typeset_documentation_bool
578 { \bool_set_false:N \l__codedoc_in_implementation_bool }
579 { \comment }
580 }
581 { \bool_if:NF \g__codedoc_typeset_documentation_bool { \endcomment } }
582 \NewDocumentEnvironment { implementation } { }
583 {
584 \bool_if:NTF \g__codedoc_typeset_implementation_bool
585 { \bool_set_true:N \l__codedoc_in_implementation_bool }
586 { \comment }
587 }
588 { \bool_if:NF \g__codedoc_typeset_implementation_bool { \endcomment } }
589 \DeclareDocumentEnvironment { variable } { O{} +v }
590 {
591 \bool_if:NTF \l__codedoc_in_implementation_bool
592 { \__codedoc_macro:nnw { var , #1 } {#2} }
593 { \__codedoc_function:nnw {#1} {#2} }
594 }
595 {
596 \bool_if:NTF \l__codedoc_in_implementation_bool
597 { \__codedoc_macro_end: }
598 { \__codedoc_function_end: }
599 }
600 \DeclareDocumentEnvironment { function } { O{} +v }
601 { \__codedoc_function:nnw {#1} {#2} }
602 { \__codedoc_function_end: }
603 \DeclareDocumentEnvironment { macro } { O{} +v }
604 { \__codedoc_macro:nnw {#1} {#2} }
605 { \__codedoc_macro_end: }
606 \NewDocumentEnvironment { syntax } { }
607 { \__codedoc_syntax:w }
608 {
609 \__codedoc_syntax_end:
610 \ignorespacesafterend
611 }
612 \NewDocumentEnvironment { texnote } { }
613 {
614 \endgraf
615 \vspace{3mm}
616 \small\textbf{\TeX~hackers~note:}
617 }
618 {
619 \vspace{3mm}
620 }
621 \NewDocumentEnvironment { arguments } { }
622 {
623 \enumerate [
624 nolistsep ,
625 label = \texttt{\#\arabic*} ~ : ,
626 labelsep = * ,
627 ]
628 }
629 {
630 \endenumerate
631 }
632 \NewDocumentCommand { \CodedocExplain } { }
633 { \CodedocExplainEXP \ \CodedocExplainREXP \ \CodedocExplainTF }
634 \NewDocumentCommand { \CodedocExplainEXP } { }
635 {
636 \raisebox{\baselineskip}[0pt][0pt]{\hypertarget{expstar}{}}%
637 \write \@auxout { \def \string \Codedoc@expstar { } }
638 \__codedoc_typeset_exp:\ indicates~fully~expandable~functions,~which~
639 can~be~used~within~an~\texttt{e}-type~argument~(inside~an~\tn{expanded}),~
640 \texttt{x}-type~argument~(in~plain~\TeX{}~terms,~inside~an~\tn{edef}),~
641 as~well~as~within~an~\texttt{f}-type~argument.
642 }
643 \NewDocumentCommand { \CodedocExplainREXP } { }
644 {
645 \raisebox{\baselineskip}[0pt][0pt]{\hypertarget{rexpstar}{}}%
646 \write \@auxout { \def \string \Codedoc@rexpstar { } }
647 \__codedoc_typeset_rexp:\ indicates~
648 restricted~expandable~functions,~which~can~be~used~within~an~
649 \texttt{x}-type~argument~or~an~\texttt{e}-type~argument,~
650 but~cannot~be~fully~expanded~within~an~\texttt{f}-type~argument.
651 }
652 \NewDocumentCommand { \CodedocExplainTF } { }
653 {
654 \raisebox{\baselineskip}[0pt][0pt]{\hypertarget{explTF}{}}%
655 \write \@auxout { \def \string \Codedoc@explTF { } }
656 \__codedoc_typeset_TF:\ indicates~conditional~(\texttt{if})~functions~
657 whose~variants~with~\texttt{T},~\texttt{F}~and~\texttt{TF}~
658 argument~specifiers~expect~different~
659 \enquote{true}/\enquote{false}~branches.
660 }
661 \keys_define:nn { l3doc/cmd }
662 {
663 index .tl_set:N = \l__codedoc_cmd_index_tl ,
664 module .tl_set:N = \l__codedoc_cmd_module_tl ,
665 no-index .bool_set:N = \l__codedoc_cmd_noindex_bool ,
666 replace .bool_set:N = \l__codedoc_cmd_replace_bool ,
667 }
668 \cs_new_protected:Npn \__codedoc_cmd:nn #1#2
669 {
670 \bool_set_false:N \l__codedoc_cmd_noindex_bool
671 \bool_set_true:N \l__codedoc_cmd_replace_bool
672 \tl_set:Nn \l__codedoc_cmd_index_tl { \q_no_value }
673 \tl_set:Nn \l__codedoc_cmd_module_tl { \q_no_value }
674 \keys_set:nn { l3doc/cmd } {#1}
675 \tl_set:Nn \l__codedoc_cmd_tl {#2}
676 \bool_if:NT \l__codedoc_cmd_replace_bool
677 {
678 \tl_set_rescan:Nnn \l__codedoc_tmpb_tl { } { _ }
679 \tl_replace_all:NVn \l__codedoc_cmd_tl \l__codedoc_tmpb_tl { _ }
680 \__codedoc_replace_at_at:N \l__codedoc_cmd_tl
681 \tl_replace_all:NnV \l__codedoc_cmd_tl { _ } \l__codedoc_tmpb_tl
682 }
683 \mode_if_math:T { \mbox }
684 {
685 \bool_if:NT \l__codedoc_allow_indexing_bool { \__codedoc_target: }
686 \verbatim@font
687 \__codedoc_if_almost_str:VT \l__codedoc_cmd_tl
688 {
689 \__kernel_tl_set:Nx \l__codedoc_cmd_tl { \tl_to_str:N \l__codedoc_cmd_tl }
690 \bool_if:NT \g__codedoc_cs_break_bool
691 {
692 \regex_replace_all:nnN
693 { ([^\\\_]\_*) \_ ([^\_]) }
694 { \1 \c{BreakableUnderscore} \2 }
695 \l__codedoc_cmd_tl
696 }
697 }
698 \tl_replace_all:Nnn \l__codedoc_cmd_tl { ~ } { \@xobeysp }
699 \l__codedoc_cmd_tl
700 \@
701 }
702 \bool_if:NT \l__codedoc_allow_indexing_bool
703 {
704 \bool_if:NF \l__codedoc_cmd_noindex_bool
705 {
706 \quark_if_no_value:NF \l__codedoc_cmd_index_tl
707 {
708 \__kernel_tl_set:Nx \l__codedoc_cmd_tl
709 { \c_backslash_str \exp_not:o { \l__codedoc_cmd_index_tl } }
710 }
711 \exp_args:No \__codedoc_key_get:n { \l__codedoc_cmd_tl }
712 \quark_if_no_value:NF \l__codedoc_cmd_module_tl
713 {
714 \__kernel_tl_set:Nx \l__codedoc_index_module_tl
715 { \tl_to_str:N \l__codedoc_cmd_module_tl }
716 }
717 \__codedoc_special_index_module:ooonN
718 { \l__codedoc_index_key_tl }
719 { \l__codedoc_index_macro_tl }
720 { \l__codedoc_index_module_tl }
721 { usage }
722 \l__codedoc_index_internal_bool
723 }
724 }
725 }
726 \cs_generate_variant:Nn \__codedoc_cmd:nn { no }
727 \cs_new_protected:Npn \__codedoc_meta:n #1
728 {
729 \tl_set:Nn \l__codedoc_tmpa_tl {#1}
730 \tl_map_inline:nn
731 { { 3 } { 4 } { 7 } { 8 } { 11 } { 12 } { 13 } }
732 {
733 \tl_set_rescan:Nnn \l__codedoc_tmpb_tl
734 { \char_set_catcode:nn { `_ } {##1} } { _ }
735 \tl_replace_all:NVn \l__codedoc_tmpa_tl \l__codedoc_tmpb_tl
736 { \__codedoc_ensuremath_sb:n }
737 }
738 \exp_args:NV \__codedoc_meta_original:n \l__codedoc_tmpa_tl
739 }
740 \cs_new_protected:Npn \__codedoc_ensuremath_sb:n #1
741 { \ensuremath { \sb {#1} } }
742 \cs_new_protected:Npn \__codedoc_meta_original:n #1
743 {
744 \ensuremath \langle
745 \mode_if_math:T { \nfss@text }
746 {
747 \meta@font@select
748 \edef \meta@hyphen@restore
749 { \hyphenchar \the \font \the \hyphenchar \font }
750 \hyphenchar \font \m@ne
751 \language \l@nohyphenation
752 #1 \/
753 \meta@hyphen@restore
754 }
755 \ensuremath \rangle
756 }
757 \cs_new_protected:Npn \__codedoc_typeset_exp:
758 {
759 \cs_if_exist:NTF \Codedoc@expstar
760 { \hyperlink { expstar } }
761 { \mbox }
762 {$\star$}
763 }
764 \cs_new_protected:Npn \__codedoc_typeset_rexp:
765 {
766 \cs_if_exist:NTF \Codedoc@rexpstar
767 { \hyperlink { rexpstar } }
768 { \mbox }
769 { \ding { 73 } } % hollow star
770 }
771 \cs_new_protected:Npn \__codedoc_typeset_TF:
772 {
773 \cs_if_exist:NTF \Codedoc@explTF
774 { \hyperlink { explTF } }
775 { \mbox }
776 {
777 \itshape TF
778 \makebox[0pt][r]
779 {
780 \underline { \phantom{\itshape TF} \kern-0.1em }
781 }
782 }
783 }
784 \cs_new_protected:Npn \__codedoc_typeset_aux:n #1
785 {
786 { \color[gray]{0.5} #1 }
787 }
788 \cs_new_protected:Npn \__codedoc_get_hyper_target:nN #1#2
789 {
790 \__kernel_tl_set:Nx #2 { \tl_to_str:n {#1} }
791 \tl_replace_all:NVn #2 \c_underscore_str { / }
792 \tl_remove_all:NV #2 \c_backslash_str
793 \tl_put_left:Nn #2 { doc/function// }
794 }
795 \cs_generate_variant:Nn \__codedoc_get_hyper_target:nN { o , e }
796 \cs_new_protected:Npn \__codedoc_names_get_seq:nN #1#2
797 {
798 \bool_if:NTF \l__codedoc_names_verb_bool
799 {
800 \seq_clear:N #2
801 \seq_put_right:No #2 { \tl_to_str:n {#1} }
802 }
803 {
804 \tl_set:Nn \l__codedoc_tmpa_tl {#1}
805 \tl_remove_all:Ne \l__codedoc_tmpa_tl
806 { \exp_not:N \obeyedline \c_percent_str }
807 \tl_remove_all:Ne \l__codedoc_tmpa_tl
808 { \exp_not:N \obeyedline }
809 \__kernel_tl_set:Nx \l__codedoc_tmpa_tl { \tl_to_str:N \l__codedoc_tmpa_tl }
810 \tl_remove_all:Ne \l__codedoc_tmpa_tl
811 { \iow_char:N \^^M \c_percent_str }
812 \tl_remove_all:Ne \l__codedoc_tmpa_tl { \tl_to_str:n { ^ ^ A } }
813 \tl_remove_all:Ne \l__codedoc_tmpa_tl { \iow_char:N \^^I }
814 \tl_remove_all:Ne \l__codedoc_tmpa_tl { \iow_char:N \^^M }
815 \__codedoc_detect_internals:N \l__codedoc_tmpa_tl
816 \__codedoc_replace_at_at:N \l__codedoc_tmpa_tl
817 \exp_args:NNe \seq_set_from_clist:Nn #2
818 { \tl_to_str:N \l__codedoc_tmpa_tl }
819 }
820 }
821 \cs_new_protected:Npn \__codedoc_names_parse:
822 {
823 \tl_clear:N \l__codedoc_names_block_tl
824 \seq_map_function:NN
825 \l__codedoc_names_seq
826 \__codedoc_names_parse_one:n
827 }
828 \cs_new_protected:Npn \__codedoc_names_parse_one:n #1
829 {
830 \__codedoc_split_function_do:nn {#1}
831 { \__codedoc_names_parse_one_aux:nnNn }
832 {#1}
833 }
834 \cs_new_protected:Npn \__codedoc_names_parse_one_aux:nnNn #1#2#3#4
835 {
836 \bool_if:NTF #3
837 {
838 \tl_if_head_eq_charcode:nNTF {#2} :
839 { \__codedoc_names_parse_aux:nnn {#4} {#4} { \scan_stop: } }
840 {
841 \exp_args:Ne \__codedoc_names_parse_aux:nnn
842 { \__codedoc_base_form_aux:nnN {#1} {#2} #3 }
843 {#1} {#2}
844 }
845 }
846 {
847 \bool_if:NT \l__codedoc_macro_TF_bool
848 { \msg_error:nne { l3doc } { no-signature-TF } {#4} }
849 \__codedoc_names_parse_aux:nnn {#4} {#4} { \scan_stop: }
850 }
851 }
852 \cs_new_protected:Npn \__codedoc_names_parse_aux:nnn #1
853 { \exp_args:Nc \__codedoc_names_parse_aux:Nnn { \__codedoc_lseq_name:n {#1} } }
854 \cs_new_protected:Npn \__codedoc_names_parse_aux:Nnn #1#2#3
855 {
856 \tl_if_in:NnF \l__codedoc_names_block_tl {#1}
857 {
858 \tl_put_right:Nn \l__codedoc_names_block_tl {#1}
859 \seq_clear_new:N #1
860 \seq_put_right:Nn #1 {#2}
861 }
862 \seq_put_right:Nn #1 {#3}
863 }
864 \cs_new_protected:Npn \__codedoc_names_typeset:
865 {
866 \tl_map_function:NN \l__codedoc_names_block_tl
867 \__codedoc_names_typeset_auxi:n
868 }
869 \cs_new_protected:Npn \__codedoc_names_typeset_auxi:n #1
870 {
871 \seq_pop:NN #1 \l__codedoc_tmpa_tl
872 \tl_gset_eq:NN \g__codedoc_base_name_tl \l__codedoc_tmpa_tl
873 \tl_greplace_all:NnV \g__codedoc_base_name_tl
874 { ~ } \c_catcode_other_space_tl
875 \seq_get:NN #1 \l__codedoc_tmpa_tl
876 \str_if_eq:VnTF \l__codedoc_tmpa_tl { \scan_stop: }
877 {
878 \seq_gclear:N \g__codedoc_variants_seq
879 \__codedoc_names_typeset_auxii:e { \g__codedoc_base_name_tl }
880 }
881 {
882 \seq_gset_eq:NN \g__codedoc_variants_seq #1
883 \seq_gpop:NN \g__codedoc_variants_seq \l__codedoc_tmpb_tl
884 \__codedoc_names_typeset_auxii:e
885 { \g__codedoc_base_name_tl : \l__codedoc_tmpb_tl }
886 }
887 }
888 \cs_new_protected:Npn \__codedoc_names_typeset_auxii:n #1
889 {
890 \bool_if:NT \l__codedoc_macro_pTF_bool
891 {
892 \__codedoc_names_typeset_block:eN
893 { \__codedoc_predicate_from_base:n {#1} }
894 \c_false_bool
895 }
896 \bool_if:NT \l__codedoc_macro_noTF_bool
897 { \__codedoc_names_typeset_block:nN {#1} \c_false_bool }
898 \__codedoc_names_typeset_block:nN {#1} \l__codedoc_macro_TF_bool
899 }
900 \cs_generate_variant:Nn \__codedoc_names_typeset_auxii:n { e }
901 \cs_new_protected:Npn \__codedoc_names_typeset_block:nN
902 {
903 \int_compare:nNnTF \l__codedoc_nested_macro_int = 0
904 { \__codedoc_typeset_function_block:nN }
905 { \__codedoc_macro_typeset_block:nN }
906 }
907 \cs_generate_variant:Nn \__codedoc_names_typeset_block:nN { e }
908 \prg_new_conditional:Npnn \__codedoc_if_macro_internal:n #1 { p , T , F , TF }
909 {
910 \bool_if:NTF \l__codedoc_macro_internal_bool
911 { \prg_return_true: }
912 {
913 \tl_if_empty:eTF
914 {
915 \exp_after:wN \__codedoc_if_macro_internal_aux:w
916 \tl_to_str:n { #1 ~ __ }
917 }
918 { \prg_return_false: } { \prg_return_true: }
919 }
920 }
921 \exp_last_unbraced:NNNNo
922 \cs_new:Npn \__codedoc_if_macro_internal_aux:w #1 { \tl_to_str:n { __ } } { }
923 \cs_new_protected:Npn \__codedoc_names_block_base_map:N #1
924 {
925 \tl_map_inline:Nn \l__codedoc_names_block_tl
926 {
927 \group_begin:
928 \seq_set_eq:NN \l__codedoc_tmpa_seq ##1
929 \seq_pop:NN \l__codedoc_tmpa_seq \l__codedoc_tmpa_tl
930 \seq_get:NN \l__codedoc_tmpa_seq \l__codedoc_tmpb_tl
931 \exp_args:NNe
932 \group_end:
933 #1
934 {
935 \l__codedoc_tmpa_tl
936 \str_if_eq:VnF \l__codedoc_tmpb_tl { \scan_stop: }
937 { : \l__codedoc_tmpb_tl }
938 \bool_if:NT \l__codedoc_macro_TF_bool { TF }
939 }
940 }
941 }
942 \keys_define:nn { l3doc/function }
943 {
944 TF .value_forbidden:n = true ,
945 TF .code:n =
946 {
947 \bool_set_true:N \l__codedoc_macro_TF_bool
948 } ,
949 EXP .value_forbidden:n = true ,
950 EXP .code:n =
951 {
952 \bool_set_true:N \l__codedoc_macro_EXP_bool
953 \bool_set_false:N \l__codedoc_macro_rEXP_bool
954 } ,
955 rEXP .value_forbidden:n = true ,
956 rEXP .code:n =
957 {
958 \bool_set_false:N \l__codedoc_macro_EXP_bool
959 \bool_set_true:N \l__codedoc_macro_rEXP_bool
960 } ,
961 pTF .value_forbidden:n = true ,
962 pTF .code:n =
963 {
964 \bool_set_true:N \l__codedoc_macro_pTF_bool
965 \bool_set_true:N \l__codedoc_macro_TF_bool
966 \bool_set_true:N \l__codedoc_macro_EXP_bool
967 \bool_set_false:N \l__codedoc_macro_rEXP_bool
968 } ,
969 noTF .value_forbidden:n = true ,
970 noTF .code:n =
971 {
972 \bool_set_true:N \l__codedoc_macro_noTF_bool
973 \bool_set_true:N \l__codedoc_macro_TF_bool
974 } ,
975 added .code:n = { \__codedoc_date_set_past:Nn \l__codedoc_date_added_tl {#1} },
976 updated .code:n = { \__codedoc_date_set_past:Nn \l__codedoc_date_updated_tl {#1} } ,
977 deprecated .bool_set:N = \l__codedoc_macro_deprecated_bool ,
978 no-user-doc .bool_set:N = \l__codedoc_macro_nodoc_bool ,
979 tested .code:n = { } ,
980 label .code:n =
981 {
982 \clist_set:Nn \l__codedoc_function_label_clist {#1}
983 \bool_set_true:N \l__codedoc_no_label_bool
984 } ,
985 verb .value_forbidden:n = true ,
986 verb .bool_set:N = \l__codedoc_names_verb_bool ,
987 module .tl_set:N = \l__codedoc_override_module_tl ,
988 }
989 \cs_new_protected:Npn \__codedoc_date_set:Nn #1#2
990 {
991 \tl_set:Nn #1 {#2}
992 \regex_replace_once:nnNF
993 { \A(\d\d\d\d)[-/](\d\d?)[-/](\d\d?)\Z } { \1-\2-\3 } #1
994 {
995 \msg_error:nnn { l3doc } { date-format } {#2}
996 \tl_set:Nn #1 { 1970-01-01 }
997 }
998 }
999 \cs_new_protected:Npn \__codedoc_date_set_past:Nn #1#2
1000 {
1001 \__codedoc_date_set:Nn #1 {#2}
1002 \exp_args:No \__codedoc_date_compare:nNnT
1003 {#1} > { \c_sys_year_int - \c_sys_month_int - \c_sys_day_int }
1004 {
1005 \msg_error:nnee { l3doc } { future-date }
1006 { \tl_to_str:N \l__codedoc_macro_argument_tl }
1007 {#1}
1008 }
1009 }
1010 \cs_new_protected:Npn \__codedoc_function:nnw #1#2
1011 {
1012 \__codedoc_function_typeset_start:
1013 \__codedoc_function_init:
1014 \tl_set:Nn \l__codedoc_macro_argument_tl {#2}
1015 \keys_set:nn { l3doc/function } {#1}
1016 \__codedoc_names_get_seq:nN {#2} \l__codedoc_names_seq
1017 \__codedoc_names_parse:
1018 \__codedoc_function_typeset:
1019 \__codedoc_function_reset:
1020 \__codedoc_function_descr_start:w
1021 }
1022 \cs_new_protected:Npn \__codedoc_function_end:
1023 {
1024 \__codedoc_function_descr_stop:
1025 \__codedoc_function_assemble:
1026 \__codedoc_function_typeset_stop:
1027 }
1028 \cs_new_protected:Npn \__codedoc_function_typeset_start:
1029 {
1030 \par \bigskip \noindent
1031 }
1032 \cs_new_protected:Npn \__codedoc_function_typeset_stop:
1033 {
1034 \par
1035 \dim_set:Nn \prevdepth { \coffin_dp:N \l__codedoc_descr_coffin }
1036 \allowbreak
1037 }
1038 \cs_new_protected:Npn \__codedoc_function_init:
1039 {
1040 \box_if_empty:NF \g__codedoc_syntax_box
1041 { \msg_error:nn { l3doc } { syntax-nested-function } }
1042 \coffin_clear:N \l__codedoc_descr_coffin
1043 \box_gclear:N \g__codedoc_syntax_box
1044 \coffin_clear:N \l__codedoc_syntax_coffin
1045 \coffin_clear:N \l__codedoc_functions_coffin
1046 \bool_set_false:N \l__codedoc_macro_TF_bool
1047 \bool_set_false:N \l__codedoc_macro_pTF_bool
1048 \bool_set_false:N \l__codedoc_macro_noTF_bool
1049 \bool_set_false:N \l__codedoc_macro_EXP_bool
1050 \bool_set_false:N \l__codedoc_macro_rEXP_bool
1051 \bool_set_false:N \l__codedoc_no_label_bool
1052 \bool_set_false:N \l__codedoc_names_verb_bool
1053 \bool_set_true:N \l__codedoc_in_function_bool
1054 \clist_clear:N \l__codedoc_function_label_clist
1055 \tl_set:Nn \l__codedoc_override_module_tl { \q_no_value }
1056 \char_set_active_eq:NN \< \__codedoc_shorthand_meta:
1057 \char_set_catcode_active:N \<
1058 }
1059 \cs_new_protected:Npn \__codedoc_shorthand_meta:
1060 { \mode_if_math:TF { < } { \__codedoc_shorthand_meta:w } }
1061 \cs_new_protected_nopar:Npn \__codedoc_shorthand_meta:w #1 > { \meta {#1} }
1062 \cs_new_protected:Npn \__codedoc_function_reset:
1063 {
1064 \tl_set:Nn \l__codedoc_override_module_tl { \q_no_value }
1065 }
1066 \cs_new_protected:Npn \__codedoc_function_typeset:
1067 {
1068 \dim_zero:N \l__codedoc_trial_width_dim
1069 \hcoffin_set:Nn \l__codedoc_functions_coffin { \__codedoc_typeset_functions: }
1070 \dim_set:Nn \l__codedoc_trial_width_dim
1071 { \coffin_wd:N \l__codedoc_functions_coffin }
1072 \bool_set:Nn \l__codedoc_long_name_bool
1073 { \dim_compare_p:nNn \l__codedoc_trial_width_dim > \marginparwidth }
1074 }
1075 \cs_new_protected:Npn \__codedoc_function_descr_start:w
1076 {
1077 \vcoffin_set:Nnw \l__codedoc_descr_coffin { \textwidth }
1078 \noindent \ignorespaces
1079 }
1080 \cs_new_protected:Npn \__codedoc_function_descr_stop:
1081 { \vcoffin_set_end: }
1082 \cs_new_protected:Npn \__codedoc_function_assemble:
1083 {
1084 \hcoffin_set:Nn \l__codedoc_syntax_coffin
1085 { \box_use_drop:N \g__codedoc_syntax_box }
1086 \bool_if:NTF \l__codedoc_long_name_bool
1087 {
1088 \coffin_join:NnnNnnnn
1089 \l__codedoc_output_coffin {hc} {vc}
1090 \l__codedoc_syntax_coffin {l} {T}
1091 {0pt} {0pt}
1092 \coffin_join:NnnNnnnn
1093 \l__codedoc_output_coffin {l} {t}
1094 \l__codedoc_functions_coffin {r} {t}
1095 {-\marginparsep} {0pt}
1096 \coffin_join:NnnNnnnn
1097 \l__codedoc_output_coffin {l} {b}
1098 \l__codedoc_descr_coffin {l} {t}
1099 {\marginparwidth + \marginparsep} {-\medskipamount}
1100 \coffin_typeset:Nnnnn \l__codedoc_output_coffin
1101 {\l__codedoc_descr_coffin-l} {\l__codedoc_descr_coffin-t}
1102 {0pt} {0pt}
1103 }
1104 {
1105 \coffin_join:NnnNnnnn
1106 \l__codedoc_output_coffin {hc} {vc}
1107 \l__codedoc_syntax_coffin {l} {t}
1108 {0pt} {0pt}
1109 \coffin_join:NnnNnnnn
1110 \l__codedoc_output_coffin {l} {b}
1111 \l__codedoc_descr_coffin {l} {t}
1112 {0pt} {-\medskipamount}
1113 \coffin_join:NnnNnnnn
1114 \l__codedoc_output_coffin {l} {t}
1115 \l__codedoc_functions_coffin {r} {t}
1116 {-\marginparsep} {0pt}
1117 \coffin_typeset:Nnnnn \l__codedoc_output_coffin
1118 {\l__codedoc_syntax_coffin-l} {\l__codedoc_syntax_coffin-T}
1119 {0pt} {0pt}
1120 }
1121 }
1122 \cs_new_protected:Npn \__codedoc_typeset_functions:
1123 {
1124 \small\ttfamily
1125 \__codedoc_target:
1126 \Hy@MakeCurrentHref { HD. \int_use:N \c@HD@hypercount }
1127 \__codedoc_date_compare:VNVF \l__codedoc_date_added_tl > \l__codedoc_base_date_tl
1128 { \tl_clear:N \l__codedoc_date_added_tl }
1129 \__codedoc_date_compare:VNVF \l__codedoc_date_updated_tl > \l__codedoc_base_date_tl
1130 { \tl_clear:N \l__codedoc_date_updated_tl }
1131 \begin{tabular} [t] { @{} l @{} >{\hspace{\tabcolsep}} r @{} }
1132 \toprule
1133 \__codedoc_function_extra_labels:
1134 \__codedoc_names_typeset:
1135 \__codedoc_typeset_dates:
1136 \bottomrule
1137 \end{tabular}
1138 \normalfont\normalsize
1139 }
1140 \cs_generate_variant:Nn \__codedoc_date_compare:nNnF { VNV }
1141 \cs_new_protected:Npn \__codedoc_typeset_function_block:nN #1#2
1142 {
1143 \__codedoc_function_index:e
1144 { #1 \bool_if:NT #2 { \tl_to_str:n {TF} } }
1145 \__codedoc_function_label:eN {#1} #2
1146 #1
1147 \bool_if:NT #2 { \__codedoc_typeset_TF: }
1148 \__codedoc_typeset_expandability:
1149 \seq_if_empty:NF \g__codedoc_variants_seq
1150 { \__codedoc_typeset_variant_list:nN {#1} #2 }
1151 \\
1152 }
1153 \cs_new_protected:Npn \__codedoc_function_index:n #1
1154 {
1155 \seq_gput_right:Nn \g_doc_functions_seq {#1}
1156 \__codedoc_special_index:nn {#1} { usage }
1157 }
1158 \cs_generate_variant:Nn \__codedoc_function_index:n { e }
1159 \cs_new_protected:Npn \__codedoc_typeset_expandability:
1160 {
1161 &
1162 \bool_if:NT \l__codedoc_macro_EXP_bool { \__codedoc_typeset_exp: }
1163 \bool_if:NT \l__codedoc_macro_rEXP_bool { \__codedoc_typeset_rexp: }
1164 }
1165 \cs_new_protected:Npn \__codedoc_typeset_variant_list:nN #1#2
1166 {
1167 \\
1168 \__codedoc_typeset_aux:n { \__codedoc_get_function_name:n {#1} }
1169 :
1170 \int_compare:nTF { \seq_count:N \g__codedoc_variants_seq == 1 }
1171 {
1172 \seq_use:Nn \g__codedoc_variants_seq { }
1173 \bool_if:NT #2 { \__codedoc_typeset_TF: }
1174 }
1175 {
1176 \hbox_set:Nn \l_tmpa_box
1177 { \seq_use:Nn \g__codedoc_variants_seq { \textrm| \nolinebreak[2] } }
1178 \textrm(
1179 \dim_compare:nNnTF { \box_wd:N \l_tmpa_box } > { .4\columnwidth }
1180 {
1181 \parbox[t]{.4\columnwidth}
1182 {
1183 \raggedright
1184 \hbox_unpack_drop:N \l_tmpa_box
1185 \textrm)
1186 \bool_if:NT #2 { \__codedoc_typeset_TF: }
1187 }
1188 }
1189 {
1190 \hbox_unpack_drop:N \l_tmpa_box
1191 \textrm)
1192 \bool_if:NT #2 { \__codedoc_typeset_TF: }
1193 }
1194 }
1195 \__codedoc_typeset_expandability:
1196 }
1197 \cs_new_protected:Npn \__codedoc_function_extra_labels:
1198 {
1199 \bool_if:NT \l__codedoc_no_label_bool
1200 {
1201 \clist_map_inline:Nn \l__codedoc_function_label_clist
1202 {
1203 \__codedoc_get_hyper_target:oN { \token_to_str:N ##1 }
1204 \l__codedoc_tmpa_tl
1205 \exp_args:No \label { \l__codedoc_tmpa_tl }
1206 }
1207 }
1208 }
1209 \cs_new_protected:Npn \__codedoc_function_label:nN #1#2
1210 {
1211 \bool_if:NF \l__codedoc_no_label_bool
1212 {
1213 \__codedoc_get_hyper_target:eN
1214 {
1215 \exp_not:n {#1}
1216 \bool_if:NT #2 { \tl_to_str:n {TF} }
1217 }
1218 \l__codedoc_tmpa_tl
1219 \exp_args:No \label { \l__codedoc_tmpa_tl }
1220 }
1221 }
1222 \cs_generate_variant:Nn \__codedoc_function_label:nN { e }
1223 \cs_new:Npn \__codedoc_typeset_dates:
1224 {
1225 \bool_lazy_and:nnF
1226 { \tl_if_empty_p:N \l__codedoc_date_added_tl }
1227 { \tl_if_empty_p:N \l__codedoc_date_updated_tl }
1228 { \midrule }
1229 \tl_if_empty:NF \l__codedoc_date_added_tl
1230 {
1231 \multicolumn { 2 } { @{} r @{} }
1232 { \scriptsize New: \, \l__codedoc_date_added_tl } \\
1233 }
1234 \tl_if_empty:NF \l__codedoc_date_updated_tl
1235 {
1236 \multicolumn { 2 } { @{} r @{} }
1237 { \scriptsize Updated: \, \l__codedoc_date_updated_tl } \\
1238 }
1239 }
1240 \dim_new:N \l__codedoc_syntax_dim
1241 \cs_new_protected:Npn \__codedoc_syntax:w
1242 {
1243 \box_if_empty:NF \g__codedoc_syntax_box
1244 { \msg_error:nn { l3doc } { multiple-syntax } }
1245 \dim_set:Nn \l__codedoc_syntax_dim
1246 {
1247 \textwidth
1248 \bool_if:NT \l__codedoc_long_name_bool
1249 { + \marginparwidth - \l__codedoc_trial_width_dim }
1250 }
1251 \hbox_gset:Nw \g__codedoc_syntax_box
1252 \small \ttfamily
1253 \arrayrulecolor{white}
1254 \begin{tabular} { @{} l @{} }
1255 \toprule
1256 \begin{minipage}[t]{\l__codedoc_syntax_dim}
1257 \raggedright
1258 \obeyspaces
1259 \obeylines
1260 }
1261 \cs_new_protected:Npn \__codedoc_syntax_end:
1262 {
1263 \end{minipage}
1264 \end{tabular}
1265 \arrayrulecolor{black}
1266 \hbox_gset_end:
1267 \bool_if:NF \l__codedoc_in_function_bool
1268 {
1269 \begin{quote}
1270 \mode_leave_vertical:
1271 \box_use_drop:N \g__codedoc_syntax_box
1272 \end{quote}
1273 }
1274 }
1275 \keys_define:nn { l3doc/macro }
1276 {
1277 aux .value_forbidden:n = true ,
1278 aux .code:n =
1279 {
1280 \msg_warning:nnnn { l3doc } { deprecated-option }
1281 { aux } { function/macro }
1282 } ,
1283 deprecated .bool_set:N = \l__codedoc_macro_deprecated_bool ,
1284 internal .value_forbidden:n = true ,
1285 internal .code:n =
1286 { \bool_set_true:N \l__codedoc_macro_internal_bool } ,
1287 int .value_forbidden:n = true ,
1288 int .code:n =
1289 { \bool_set_true:N \l__codedoc_macro_internal_bool } ,
1290 no-user-doc .bool_set:N = \l__codedoc_macro_nodoc_bool ,
1291 var .value_forbidden:n = true ,
1292 var .code:n =
1293 { \bool_set_true:N \l__codedoc_macro_var_bool } ,
1294 TF .value_forbidden:n = true ,
1295 TF .code:n =
1296 { \bool_set_true:N \l__codedoc_macro_TF_bool } ,
1297 pTF .value_forbidden:n = true ,
1298 pTF .code:n =
1299 {
1300 \bool_set_true:N \l__codedoc_macro_TF_bool
1301 \bool_set_true:N \l__codedoc_macro_pTF_bool
1302 \bool_set_true:N \l__codedoc_macro_EXP_bool
1303 \bool_set_false:N \l__codedoc_macro_rEXP_bool
1304 } ,
1305 noTF .value_forbidden:n = true ,
1306 noTF .code:n =
1307 {
1308 \bool_set_true:N \l__codedoc_macro_TF_bool
1309 \bool_set_true:N \l__codedoc_macro_noTF_bool
1310 } ,
1311 EXP .value_forbidden:n = true ,
1312 EXP .code:n =
1313 {
1314 \bool_set_true:N \l__codedoc_macro_EXP_bool
1315 \bool_set_false:N \l__codedoc_macro_rEXP_bool
1316 } ,
1317 rEXP .value_forbidden:n = true ,
1318 rEXP .code:n =
1319 {
1320 \bool_set_false:N \l__codedoc_macro_EXP_bool
1321 \bool_set_true:N \l__codedoc_macro_rEXP_bool
1322 } ,
1323 tested .code:n =
1324 {
1325 \bool_set_true:N \l__codedoc_macro_tested_bool
1326 } ,
1327 added .code:n = {} , % TODO
1328 updated .code:n = {} , % TODO
1329 verb .bool_set:N = \l__codedoc_names_verb_bool ,
1330 module .tl_set:N = \l__codedoc_override_module_tl ,
1331 documented-as .tl_set:N = \l__codedoc_macro_documented_tl ,
1332 do-not-index .value_required:n = true ,
1333 do-not-index .tl_set:N = \l__codedoc_macro_do_not_index_tl ,
1334 % do-not-index .default:n = \q_no_value ,
1335 }
1336 \cs_new_protected:Npn \__codedoc_macro:nnw #1#2
1337 {
1338 \__codedoc_macro_init:
1339 \tl_set:Nn \l__codedoc_macro_argument_tl {#2}
1340 \keys_set:nn { l3doc/macro } {#1}
1341 \__codedoc_names_get_seq:nN {#2} \l__codedoc_names_seq
1342 \__codedoc_names_parse:
1343 \__codedoc_macro_exclude_index:
1344 \__codedoc_macro_save_names:
1345 \__codedoc_names_typeset:
1346 \__codedoc_macro_dump:
1347 \__codedoc_macro_reset:
1348 }
1349 \cs_new_protected:Npn \__codedoc_macro_init:
1350 {
1351 \int_incr:N \l__codedoc_nested_macro_int
1352 \bool_set_false:N \l__codedoc_macro_deprecated_bool
1353 \bool_set_false:N \l__codedoc_macro_internal_bool
1354 \bool_set_false:N \l__codedoc_macro_TF_bool
1355 \bool_set_false:N \l__codedoc_macro_pTF_bool
1356 \bool_set_false:N \l__codedoc_macro_noTF_bool
1357 \bool_set_false:N \l__codedoc_macro_EXP_bool
1358 \bool_set_false:N \l__codedoc_macro_rEXP_bool
1359 \bool_set_false:N \l__codedoc_macro_var_bool
1360 \bool_set_false:N \l__codedoc_macro_tested_bool
1361 \bool_set_false:N \l__codedoc_names_verb_bool
1362 \tl_set:Nn \l__codedoc_override_module_tl { \q_no_value }
1363 \tl_clear:N \l__codedoc_macro_documented_tl
1364 \cs_set_eq:NN \testfile \__codedoc_print_testfile:n
1365 \box_clear:N \l__codedoc_macro_index_box
1366 \vbox_set:Nn \l__codedoc_macro_box
1367 {
1368 \hbox:n
1369 {
1370 \strut
1371 \int_compare:nNnT \l__codedoc_macro_int = 0 { \__codedoc_target: }
1372 }
1373 \vskip \int_eval:n { \l__codedoc_macro_int - 1 } \baselineskip
1374 }
1375 }
1376 \cs_new_protected:Npn \__codedoc_macro_reset:
1377 {
1378 \tl_set:Nn \l__codedoc_override_module_tl { \q_no_value }
1379 }
1380 \cs_new_protected:Npn \__codedoc_macro_save_names:
1381 {
1382 \tl_if_empty:NTF \l__codedoc_macro_documented_tl
1383 { \__codedoc_names_block_base_map:N \__codedoc_macro_save_names_aux:n }
1384 {
1385 \seq_gput_right:Ne \g__codedoc_nested_names_seq
1386 {
1387 \exp_after:wN \__codedoc_macro_save_names_aux:w
1388 \l__codedoc_macro_documented_tl \q__codedoc_stop
1389 }
1390 }
1391 }
1392 \cs_new:Npn \__codedoc_macro_save_names_aux:w #1#2 \q__codedoc_stop
1393 { \token_to_str:N #1 \tl_to_str:n {#2} }
1394 \cs_new_protected:Npn \__codedoc_macro_save_names_aux:n #1
1395 { \seq_gput_right:Nn \g__codedoc_nested_names_seq {#1} }
1396 \cs_new_protected:Npn \__codedoc_macro_exclude_index:
1397 {
1398 \tl_if_empty:NF \l__codedoc_macro_do_not_index_tl
1399 {
1400 \tl_set_rescan:NnV \l__codedoc_macro_do_not_index_tl
1401 { \MakePrivateLetters \catcode`\\12 }
1402 \l__codedoc_macro_do_not_index_tl
1403 \exp_args:NNV \seq_set_from_clist:Nn
1404 \l__codedoc_tmpa_seq \l__codedoc_macro_do_not_index_tl
1405 \__kernel_tl_set:Nx \l__codedoc_macro_do_not_index_tl
1406 { \seq_use:Nn \l__codedoc_tmpa_seq { , } }
1407 \exp_args:NV \DoNotIndex \l__codedoc_macro_do_not_index_tl
1408 }
1409 }
1410 \cs_new_protected:Npn \__codedoc_macro_dump:
1411 {
1412 \topsep\MacroTopsep
1413 \trivlist
1414 \cs_set:Npn \makelabel ##1
1415 {
1416 \llap
1417 {
1418 \hbox_unpack_drop:N \l__codedoc_macro_index_box
1419 \vtop to \baselineskip
1420 {
1421 \vbox_unpack_drop:N \l__codedoc_macro_box
1422 \vss
1423 }
1424 }
1425 }
1426 \item [ ]
1427 }
1428 \cs_new_protected:Npn \__codedoc_macro_typeset_block:nN #1#2
1429 {
1430 \__codedoc_macro_single:nNN {#1} \c_true_bool #2
1431 \seq_if_empty:NF \g__codedoc_variants_seq
1432 {
1433 \__codedoc_macro_typeset_variant_list:eN
1434 { \__codedoc_get_function_name:n {#1} } #2
1435 }
1436 }
1437 \cs_new_protected:Npn \__codedoc_macro_typeset_variant_list:nN #1#2
1438 {
1439 \seq_map_inline:Nn \g__codedoc_variants_seq
1440 { \__codedoc_macro_single:nNN { #1 : ##1 } \c_false_bool #2 }
1441 }
1442 \cs_generate_variant:Nn \__codedoc_macro_typeset_variant_list:nN { e }
1443 \cs_new_protected:Npn \__codedoc_macro_single:nNN #1#2#3
1444 {
1445 \tl_set:Nn \saved@macroname {#1}
1446 \__codedoc_macro_typeset_one:nN {#1} #3
1447 \bool_if:NT #3 { \DoNotIndex {#1} }
1448 \exp_args:Ne \__codedoc_macro_index:nN
1449 { #1 \bool_if:NT #3 { \tl_to_str:n { TF } } }
1450 #2
1451 }
1452 \cs_new_protected:Npn \__codedoc_macro_index:nN #1#2
1453 {
1454 \DoNotIndex {#1}
1455 \bool_if:NT #2
1456 {
1457 \bool_lazy_any:nF
1458 {
1459 { \__codedoc_if_macro_internal_p:n {#1} }
1460 { \l__codedoc_macro_deprecated_bool }
1461 { \l__codedoc_macro_nodoc_bool }
1462 }
1463 { \seq_gput_right:Nn \g_doc_macros_seq {#1} }
1464 \hbox_set:Nw \l__codedoc_macro_index_box
1465 \hbox_unpack_drop:N \l__codedoc_macro_index_box
1466 \int_gincr:N \c@CodelineNo
1467 \__codedoc_special_index:nn {#1} { main }
1468 \int_gdecr:N \c@CodelineNo
1469 \exp_args:NNNo \hbox_set_end:
1470 \tl_set:Nn \saved@indexname { \l__codedoc_index_key_tl }
1471 }
1472 }
1473 \cs_new_protected:Npn \__codedoc_macro_typeset_one:nN #1#2
1474 {
1475 \vbox_set:Nn \l__codedoc_macro_box
1476 {
1477 \vbox_unpack_drop:N \l__codedoc_macro_box
1478 \hbox { \llap { \__codedoc_print_macroname:nN {#1} #2
1479 \MacroFont \
1480 } }
1481 }
1482 \int_incr:N \l__codedoc_macro_int
1483 }
1484 \cs_new_protected:Npn \__codedoc_print_macroname:nN #1#2
1485 {
1486 \strut
1487 \__codedoc_get_hyper_target:eN
1488 {
1489 \exp_not:n {#1}
1490 \bool_if:NT #2 { \tl_to_str:n {TF} }
1491 }
1492 \l__codedoc_tmpa_tl
1493 \cs_if_exist:cTF { r@ \l__codedoc_tmpa_tl }
1494 { \exp_last_unbraced:NNo \hyperref [ \l__codedoc_tmpa_tl ] }
1495 { \use:n }
1496 {
1497 \int_compare:nTF { \str_count:n {#1} <= 28 }
1498 { \MacroFont } { \MacroLongFont }
1499 \tl_set:Nn \l__codedoc_tmpa_tl {#1}
1500 \tl_replace_all:NnV \l__codedoc_tmpa_tl
1501 { ~ } \c_catcode_other_space_tl
1502 \__codedoc_print_macroname_aux:on
1503 \l__codedoc_tmpa_tl { \bool_if:NT #2 { \__codedoc_typeset_TF: } }
1504 }
1505 }
1506 \cs_new_protected:Npn \__codedoc_print_macroname_aux:nn #1#2
1507 {
1508 \__codedoc_if_macro_internal:nTF {#1}
1509 { \__codedoc_typeset_aux:n { #1 #2 } } { #1 #2 }
1510 }
1511 \cs_generate_variant:Nn \__codedoc_print_macroname_aux:nn { o }
1512 \providecommand \MacroLongFont
1513 {
1514 \fontfamily{lmtt}\fontseries{lc}\small
1515 }
1516 \cs_new_protected:Npn \__codedoc_print_testfile:n #1
1517 {
1518 \bool_set_true:N \l__codedoc_macro_tested_bool
1519 \tl_if_eq:nnF {#1} {*}
1520 {
1521 \seq_if_in:NnF \g__codedoc_testfiles_seq {#1}
1522 {
1523 \seq_gput_right:Nn \g__codedoc_testfiles_seq {#1}
1524 \par
1525 \__codedoc_print_testfile_aux:n {#1}
1526 }
1527 }
1528 }
1529 \cs_new_protected:Npn \__codedoc_print_testfile_aux:n #1
1530 {
1531 \footnotesize
1532 (
1533 \textit
1534 {
1535 The~ test~ suite~ for~ this~ command,~
1536 and~ others~ in~ this~ file,~ is~ \textsf{#1}
1537 }.
1538 )\par
1539 }
1540 \DeclareDocumentCommand \TestFiles {m}
1541 {
1542 \par
1543 \textit
1544 {
1545 The~ following~ test~ files~ are~
1546 used~ for~ this~ code:~ \textsf{#1}.
1547 }
1548 \par \ignorespaces
1549 }
1550 \DeclareDocumentCommand \UnitTested { } { \testfile* }
1551 \DeclareDocumentCommand \TestMissing { m }
1552 { \__codedoc_test_missing:n {#1} }
1553 \cs_new_protected:Npn \__codedoc_test_missing:n #1
1554 {
1555 \__codedoc_test_missing_aux:Nen
1556 \g__codedoc_missing_tests_prop
1557 { \seq_use:Nn \l__codedoc_names_seq { , } }
1558 { { \g_file_curr_name_str \c_space_tl (#1) } }
1559 }
1560 \cs_new_protected:Npn \__codedoc_test_missing_aux:Nnn #1#2#3
1561 {
1562 \prop_get:NnNTF #1 {#2} \l__codedoc_tmpa_tl
1563 { \tl_put_right:Nn \l__codedoc_tmpa_tl { , #3 } }
1564 { \tl_set:Nn \l__codedoc_tmpa_tl {#3} }
1565 \prop_put:Nno #1 {#2} \l__codedoc_tmpa_tl
1566 }
1567 \cs_generate_variant:Nn \__codedoc_test_missing_aux:Nnn { Ne }
1568 \cs_new_protected:Npn \__codedoc_macro_end:
1569 {
1570 \endtrivlist
1571 \__codedoc_macro_end_check_tested:
1572 \int_compare:nNnT \l__codedoc_nested_macro_int = 1
1573 { \__codedoc_macro_end_style:n { \__codedoc_print_end_definition: } }
1574 }
1575 \cs_new_protected:Npn \__codedoc_macro_end_check_tested:
1576 {
1577 \bool_lazy_all:nT
1578 {
1579 { \g__codedoc_checktest_bool }
1580 { ! \l__codedoc_macro_var_bool }
1581 { ! \l__codedoc_macro_tested_bool }
1582 }
1583 {
1584 \seq_set_filter:NNn \l__codedoc_tmpa_seq \l__codedoc_names_seq
1585 { ! \__codedoc_if_macro_internal_p:n {##1} }
1586 \seq_gput_right:Ne \g__codedoc_not_tested_seq
1587 {
1588 \seq_use:Nn \l__codedoc_tmpa_seq { , }
1589 \bool_if:NTF \l__codedoc_macro_pTF_bool {~(pTF)}
1590 { \bool_if:NT \l__codedoc_macro_TF_bool {~(TF)} }
1591 }
1592 }
1593 }
1594 \cs_new_protected:Npn \__codedoc_macro_end_style:n #1
1595 {
1596 \nobreak \noindent
1597 { \footnotesize ( \emph{#1} ) \par }
1598 }
1599 \cs_new_protected:Npn \__codedoc_macro_end_wrap_item:n #1
1600 {
1601 \tl_set:Nn \l__codedoc_tmpa_tl {#1}
1602 \tl_replace_all:NVn \l__codedoc_tmpa_tl
1603 \c_underscore_str { \_ }
1604 \texttt { \l__codedoc_tmpa_tl }
1605 }
1606 \cs_new_protected:Npn \__codedoc_print_end_definition:
1607 {
1608 \seq_set_map:NNn \l__codedoc_tmpa_seq
1609 \g__codedoc_nested_names_seq
1610 { \__codedoc_macro_end_wrap_item:n {##1} }
1611 End~ of~ definition~ for~
1612 \int_compare:nTF { \seq_count:N \l__codedoc_tmpa_seq <= 3 }
1613 {
1614 \seq_use:Nnnn \l__codedoc_tmpa_seq
1615 { \,~and~ } { \,,~ } { \,,~and~ }
1616 }
1617 { \seq_item:Nn \l__codedoc_tmpa_seq {1}\,~and~others }
1618 \@.
1619 \__codedoc_print_documented:
1620 }
1621 \cs_new_protected:Npn \__codedoc_print_documented:
1622 {
1623 \seq_gset_filter:NNn \g__codedoc_nested_names_seq
1624 \g__codedoc_nested_names_seq
1625 {
1626 ! \bool_lazy_any_p:n
1627 {
1628 { \__codedoc_if_macro_internal_p:n {##1} }
1629 { \l__codedoc_macro_deprecated_bool }
1630 { \l__codedoc_macro_nodoc_bool }
1631 }
1632 }
1633 \seq_if_empty:NF \g__codedoc_nested_names_seq
1634 {
1635 \int_set:Nn \l__codedoc_tmpa_int
1636 { \seq_count:N \g__codedoc_nested_names_seq }
1637 \int_compare:nNnTF \l__codedoc_tmpa_int = 1 {~This~} {~These~}
1638 \bool_if:NTF \l__codedoc_macro_var_bool {variable} {function}
1639 \int_compare:nNnTF \l__codedoc_tmpa_int = 1 {~is~} {s~are~}
1640 documented~on~page~
1641 \__codedoc_get_hyper_target:eN
1642 { \seq_item:Nn \g__codedoc_nested_names_seq { 1 } }
1643 \l__codedoc_tmpa_tl
1644 \exp_args:Ne \pageref { \l__codedoc_tmpa_tl } .
1645 }
1646 \seq_gclear:N \g__codedoc_nested_names_seq
1647 }
1648 \NewDocElement[idxtype = option, idxgroup = options]{Option}{optionenv}
1649 \font \manual = manfnt \scan_stop:
1650 \cs_gset:Npn \dbend { {\manual\char127} }
1651 \newenvironment {danger}
1652 {
1653 \begin{trivlist}\item[]\noindent
1654 \begingroup\hangindent=2pc\hangafter=-2
1655 \cs_set:Npn \par{\endgraf\endgroup}
1656 \hbox to0pt{\hskip-\hangindent\dbend\hfill}\ignorespaces
1657 }
1658 {
1659 \par\end{trivlist}
1660 }
1661 \newenvironment {ddanger}
1662 {
1663 \begin{trivlist}\item[]\noindent
1664 \begingroup\hangindent=3.5pc\hangafter=-2
1665 \cs_set:Npn \par{\endgraf\endgroup}
1666 \hbox to0pt{\hskip-\hangindent\dbend\kern2pt\dbend\hfill}\ignorespaces
1667 }{
1668 \par\end{trivlist}
1669 }
1670 \bool_if:NTF \g__codedoc_show_notes_bool
1671 {
1672 \NewDocumentCommand\NB{mm}
1673 {
1674 (\emph{Note}\footnote{\ttfamily [#1]:~\detokenize{#2}})
1675 }
1676 }
1677 {
1678 \NewDocumentCommand\NB{mm}{}
1679 }
1680 \bool_if:NTF \g__codedoc_show_notes_bool
1681 {
1682 \NewDocumentEnvironment{NOTE}{m}
1683 {
1684 \par\noindent (\emph{Note}~[\texttt{#1}]:\par
1685 \verbatim
1686 }
1687 {
1688 \endverbatim
1689 \par\noindent \emph{Note~end})\par
1690 }
1691 }
1692 {
1693 \NewDocumentEnvironment{NOTE}{m}{\comment}{\endcomment}
1694 }
1695 \providecommand\Hy@footnote@currentHref{}
1696 \prop_new:N\g__codedoc_fnmark_prop
1697 \cs_new_protected:Npn \__codedoc_fn_store:
1698 {
1699 \prop_gput:Nee\g__codedoc_fnmark_prop
1700 {fn\int_use:N\c@footnote}{{\Hy@footnote@currentHref}{\int_use:N\c@footnote}}
1701 }
1702 \cs_new_protected:Npn \__codedoc_fn_restore:n #1
1703 {
1704 \prop_get:NnN \g__codedoc_fnmark_prop {fn#1}\l__codedoc_tmpa_tl
1705 \tl_gset:Ne\Hy@footnote@currentHref
1706 {\exp_last_unbraced:NV\use_i:nn \l__codedoc_tmpa_tl }
1707 \setcounter{footnote}{\exp_last_unbraced:NV\use_ii:nn \l__codedoc_tmpa_tl}
1708 }
1709
1710 \cs_generate_variant:Nn \hook_gput_next_code:nn {ne}
1711 \cs_new_protected:Npn \__codedoc_fn_footnote:nn #1 #2
1712 {
1713 \footnotemark
1714 \__codedoc_fn_store:
1715 \hook_gput_next_code:ne {env/#1/after}
1716 {\exp_not:N\__codedoc_fn_restore:n{\int_use:N\c@footnote}{\exp_not:n{\footnotetext{#2}}}}}
1717
1718 \AddToHook{env/function/begin}{\def\footnote{\__codedoc_fn_footnote:nn{function}}}
1719 \AddToHook{env/variable/begin}{\def\footnote{\__codedoc_fn_footnote:nn{variable}}}
1720 \newenvironment{TemplateInterfaceDescription}[1]
1721 {
1722 \subsection{The~template~type~`#1'}
1723 \begingroup
1724 \@beginparpenalty\@M
1725 \description
1726 \def\TemplateArgument##1##2{\item[Arg:~##1]##2\par}
1727 \def\TemplateSemantics
1728 {
1729 \enddescription\endgroup
1730 \subsubsection*{Semantics:}
1731 }
1732 }
1733 {
1734 \par\bigskip
1735 }
1736 \newenvironment{TemplateDescription}[2]
1737 {
1738 \subsection{The~template~`#2'~(template~type~#1)}
1739 \subsubsection*{Attributes:}
1740 \begingroup
1741 \@beginparpenalty\@M
1742 \description
1743 \def\TemplateKey##1##2##3##4
1744 {
1745 \item[##1~(##2)]##3%
1746 \ifx\TemplateKey##4\TemplateKey\else
1747 \hfill\penalty500\hbox{}\hfill Default:~##4%
1748 \nobreak\hskip-\parfillskip\hskip0pt\relax
1749 \fi
1750 \par
1751 }
1752 \def\TemplateSemantics
1753 {
1754 \enddescription\endgroup
1755 \subsubsection*{Semantics~\&~Comments:}
1756 }
1757 }
1758 { \par \bigskip }
1759 \newenvironment{InstanceDescription}[4][xxxxxxxxxxxxxxx]
1760 {
1761 \subsubsection{The~instance~`#3'~(template~#2/#4)}
1762 \subsubsection*{Attribute~values:}
1763 \begingroup
1764 \@beginparpenalty\@M
1765 \def\InstanceKey##1##2{\>\textbf{##1}\>##2\\}
1766 \def\InstanceSemantics{\endtabbing\endgroup
1767 \vskip-30pt\vskip0pt
1768 \subsubsection*{Layout~description~\&~Comments:}}
1769 \tabbing
1770 xxxx\=#1\=\kill
1771 }
1772 { \par \bigskip }
1773 \DeclareDocumentCommand \OnlyDescription { }
1774 { \bool_gset_false:N \g__codedoc_typeset_implementation_bool }
1775 \DeclareDocumentCommand \AlsoImplementation { }
1776 { \bool_gset_true:N \g__codedoc_typeset_implementation_bool }
1777 \DeclareDocumentCommand \StopEventually { m }
1778 {
1779 \bool_if:NTF \g__codedoc_typeset_implementation_bool
1780 {
1781 \@bsphack
1782 \tl_gset:Nn \g__codedoc_finale_tl { #1 \check@checksum }
1783 \init@checksum
1784 \@esphack
1785 }
1786 { #1 \endinput }
1787 }
1788 \cs_if_exist:NT \MaybeStop
1789 { \RenewCommandCopy \MaybeStop \StopEventually }
1790 \DeclareDocumentCommand \Finale { }
1791 { \tl_use:N \g__codedoc_finale_tl }
1792 \tl_new:N \g__codedoc_finale_tl
1793 \cs_new_protected:Npn \__codedoc_input:n #1
1794 {
1795 \tl_gclear:N \g__codedoc_module_name_tl
1796 \MakePercentIgnore
1797 \input{#1}
1798 \MakePercentComment
1799 }
1800 \DeclareDocumentCommand \DocInput { m }
1801 {
1802 \clist_map_inline:nn {#1}
1803 {
1804 \clist_gput_right:Nn \g_docinput_clist {##1}
1805 \__codedoc_input:n {##1}
1806 }
1807 }
1808 \DeclareDocumentCommand \DocInputAgain { }
1809 { \clist_map_function:NN \g_docinput_clist \__codedoc_input:n }
1810 \msg_new:nnn { l3doc } { missing-endgroup }
1811 {
1812 \str_if_eq:VnTF \@currenvir { document }
1813 {
1814 There~are~\int_use:N \tex_currentgrouplevel:D
1815 \c_space_tl unclosed~groups~in~#1.
1816 }
1817 {
1818 The~\@currenvir \c_space_tl environment~on~line~\@currenvline
1819 \c_space_tl doesn't~have~a~matching~\iow_char:N\\end{\@currenvir}.
1820 }
1821 }
1822 \NewDocumentCommand \DocInclude { m }
1823 {
1824 \relax\clearpage
1825 \docincludeaux
1826 \IfFileExists{#1.fdd}
1827 { \cs_set:Npn \currentfile{#1.fdd} }
1828 { \cs_set:Npn \currentfile{#1.dtx} }
1829 \int_compare:nNnTF \@auxout = \@partaux
1830 { \@latexerr{\string\include\space cannot~be~nested}\@eha }
1831 { \@docinclude {#1} }
1832 % check missing \endgroup, e.g., missing "\end{macro}" in time
1833 \int_compare:nNnF { \tex_currentgrouplevel:D } = { 0 }
1834 {
1835 \int_compare:nNnT { \tex_interactionmode:D } = { 0 }
1836 { \int_gset:Nn \tex_interactionmode:D { 1 } }
1837 \msg_fatal:nne { l3doc } { missing-endgroup } { \currentfile }
1838 }
1839 }
1840 \cs_gset:Npn \@docinclude #1
1841 {
1842 \clearpage
1843 \immediate\write\@mainaux{\string\@input{#1.aux}}
1844 \@tempswatrue
1845 \if@partsw
1846 \@tempswafalse
1847 \cs_set:Npe \@tempb {#1}
1848 \clist_map_inline:Nn \@partlist
1849 {
1850 \if_meaning:w \@tempa \@tempb
1851 \@tempswatrue
1852 \fi:
1853 }
1854 \fi
1855 \if@tempswa
1856 \cs_set_eq:NN \@auxout \@partaux
1857 \immediate\openout\@partaux #1.aux
1858 \immediate\write\@partaux{\relax}
1859 \cs_set_eq:NN \@ltxdoc@PrintIndex \PrintIndex
1860 \cs_set_eq:NN \PrintIndex \relax
1861 \cs_set_eq:NN \@ltxdoc@PrintChanges \PrintChanges
1862 \cs_set_eq:NN \PrintChanges \relax
1863 \cs_set_eq:NN \@ltxdoc@theglossary \theglossary
1864 \cs_set_eq:NN \@ltxdoc@endtheglossary \endtheglossary
1865 \part{\currentfile}
1866 {
1867 \cs_set_eq:NN \ttfamily\relax
1868 \cs_gset:Npe \filekey
1869 { \filekey,~ \thepart = { \ttfamily \currentfile } }
1870 }
1871 \DocInput{\currentfile}
1872 \cs_set_eq:NN \PrintIndex \@ltxdoc@PrintIndex
1873 \cs_set_eq:NN \PrintChanges \@ltxdoc@PrintChanges
1874 \cs_set_eq:NN \theglossary \@ltxdoc@theglossary
1875 \cs_set_eq:NN \endtheglossary \@ltxdoc@endtheglossary
1876 \clearpage
1877 \@writeckpt{#1}
1878 \immediate \closeout \@partaux
1879 \else
1880 \@nameuse{cp@#1}
1881 \fi
1882 \cs_set_eq:NN \@auxout \@mainaux
1883 }
1884 \cs_gset_protected:Npn \@wrindex #1
1885 {
1886 \protected@write \@indexfile {}
1887 { \string \indexentry {#1} { MMMMI - \thepage } }
1888 \endgroup \@esphack
1889 }
1890 \cs_gset_protected:Npn \codeline@wrindex #1
1891 {
1892 \immediate\write\@indexfile
1893 {
1894 \string\indexentry{#1}
1895 { MMMMV - \filesep \int_use:N \c@CodelineNo }
1896 }
1897 }
1898 \tl_clear_new:N \filesep
1899 \cs_new_protected:Npn \__codedoc_index_page_hc:nn #1#2
1900 {
1901 \protected@write \@indexfile {}
1902 {
1903 \string \indexentry { #1 \encapchar hdpindex{#2} }
1904 { MMMMI - \thepage }
1905 }
1906 }
1907 \cs_new_protected:Npn \__codedoc_index_codeline_hc:nn #1#2
1908 {
1909 \immediate\write\@indexfile
1910 {
1911 \string \indexentry { #1 \encapchar hdclindex{\the\c@HD@hypercount}{#2} }
1912 { MMMMV - \filesep \int_use:N \c@CodelineNo - MMMD - \the\c@HD@hypercount - M }
1913 }
1914 }
1915 \cs_gset:Npn \docincludeaux
1916 {
1917 \tl_set:Nn \thepart { \alphalph { part } }
1918 \tl_set:Nn \filesep { \thepart - }
1919 \cs_set_eq:NN \filekey \use_none:n
1920 \tl_gput_right:Nn \index@prologue
1921 {
1922 \cs_gset:Npn \@oddfoot
1923 {
1924 \parbox { \textwidth }
1925 {
1926 \strut \footnotesize
1927 \raggedright { \bfseries File~Key: } ~ \filekey
1928 }
1929 }
1930 \cs_set_eq:NN \@evenfoot \@oddfoot
1931 }
1932 \cs_gset_eq:NN \docincludeaux \relax
1933 \cs_gset:Npn \@oddfoot
1934 {
1935 \cs_if_exist:cTF { ver @ \currentfile }
1936 { File~\thepart :~{\ttfamily\currentfile}~ }
1937 {
1938 \GetFileInfo{\currentfile}
1939 File~\thepart :~{\ttfamily\filename}~
1940 Date:~\ExplFileDate\ % space
1941 Version~\ExplFileVersion
1942 }
1943 \hfill \thepage
1944 }
1945 \cs_set_eq:NN \@evenfoot \@oddfoot
1946 }
1947 \group_begin:
1948 \char_set_catcode_other:N \^^A
1949 \char_set_catcode_active:N \^^S
1950 \char_set_catcode_active:N \^^B
1951 \char_set_catcode_other:N \^^L
1952 \char_set_catcode_other:N \^^R
1953 \char_set_lccode:nn { `\^^A } { `\% }
1954 \char_set_lccode:nn { `\^^S } { `\ }
1955 \char_set_lccode:nn { `\^^B } { `\\ }
1956 \char_set_lccode:nn { `\^^L } { `\{ }
1957 \char_set_lccode:nn { `\^^R } { `\} }
1958 \tex_lowercase:D
1959 {
1960 \group_end:
1961 \cs_set_protected:Npn \xmacro@code
1962 #1 ^^A ^^S^^S^^S^^S ^^Bend ^^Lmacrocode^^R
1963 { \__codedoc_xmacro_code:n {#1} \end{macrocode} }
1964 }
1965 \group_begin:
1966 \char_set_catcode_active:N \<
1967 \char_set_catcode_active:N \>
1968 \cs_new_protected:Npn \__codedoc_xmacro_code:n #1
1969 {
1970 \tl_clear:N \l__codedoc_tmpa_tl
1971 \tl_if_in:nnTF {#1} { < @ @ = }
1972 { \__codedoc_xmacro_code:w #1 < @ @ = \q_recursion_tail > \q_recursion_stop }
1973 {
1974 \tl_set:Nn \l__codedoc_tmpa_tl {#1}
1975 \__codedoc_detect_internals:N \l__codedoc_tmpa_tl
1976 \__codedoc_replace_at_at:N \l__codedoc_tmpa_tl
1977 \tl_use:N \l__codedoc_tmpa_tl
1978 }
1979 }
1980 \cs_new_protected:Npn \__codedoc_xmacro_code:w #1 < @ @ = #2 >
1981 {
1982 % Add code before <@@=...>
1983 \tl_set:Nn \l__codedoc_tmpb_tl {#1}
1984 \__codedoc_detect_internals:N \l__codedoc_tmpb_tl
1985 \__codedoc_replace_at_at:N \l__codedoc_tmpb_tl
1986 \tl_put_right:NV \l__codedoc_tmpa_tl \l__codedoc_tmpb_tl
1987 % Check for \q_recursion_tail
1988 \quark_if_recursion_tail_stop_do:nn {#2}
1989 { \tl_use:N \l__codedoc_tmpa_tl }
1990 % Change module name and add <@@=#2> to typeset output
1991 \tl_gset:Nn \g__codedoc_module_name_tl {#2}
1992 \tl_put_right:Nn \l__codedoc_tmpa_tl { < \text { \verbatim@font @ @ = #2 } > }
1993 % Loop
1994 \__codedoc_xmacro_code:w
1995 }
1996 \group_end:
1997 \iow_new:N \g__codedoc_func_iow
1998 \tl_new:N \l__codedoc_doc_def_tl
1999 \tl_new:N \l__codedoc_doc_undef_tl
2000 \tl_new:N \l__codedoc_undoc_def_tl
2001 \tl_const:Nn \c__codedoc_iow_separator_tl { ---- }
2002 \tl_const:Nn \c__codedoc_iow_midrule_tl { -- }
2003 \cs_new_protected:Npn \__codedoc_show_functions_defined:
2004 {
2005 \bool_lazy_and:nnT
2006 { \g__codedoc_typeset_implementation_bool } { \g__codedoc_checkfunc_bool }
2007 {
2008 \iow_term:e { \c__codedoc_iow_separator_tl \iow_newline: }
2009 \iow_open:Nn \g__codedoc_func_iow { \c_sys_jobname_str .cmds }
2010
2011 \tl_clear:N \l__codedoc_doc_def_tl
2012 \tl_clear:N \l__codedoc_doc_undef_tl
2013 \tl_clear:N \l__codedoc_undoc_def_tl
2014 \seq_gremove_duplicates:N \g_doc_functions_seq
2015 \seq_gremove_duplicates:N \g_doc_macros_seq
2016 \seq_map_inline:Nn \g_doc_functions_seq
2017 {
2018 \seq_if_in:NnTF \g_doc_macros_seq {##1}
2019 {
2020 \tl_put_right:Ne \l__codedoc_doc_def_tl
2021 { \iow_newline: > ~ ##1 }
2022 }
2023 {
2024 \tl_put_right:Ne \l__codedoc_doc_undef_tl
2025 { \iow_newline: ! ~ ##1 }
2026 }
2027 }
2028 \seq_map_inline:Nn \g_doc_macros_seq
2029 {
2030 \seq_if_in:NnF \g_doc_functions_seq {##1}
2031 {
2032 \tl_put_right:Ne \l__codedoc_undoc_def_tl
2033 { \iow_newline: ? ~ ##1 }
2034 }
2035 }
2036 \__codedoc_functions_typeout:nN
2037 {
2038 Functions~both~documented~and~defined: \iow_newline:
2039 (In~order~of~being~documented)
2040 }
2041 \l__codedoc_doc_def_tl
2042 \__codedoc_functions_typeout:nN
2043 { Functions~documented~but~not~defined: }
2044 \l__codedoc_doc_undef_tl
2045 \__codedoc_functions_typeout:nN
2046 { Functions~defined~but~not~documented: }
2047 \l__codedoc_undoc_def_tl
2048
2049 \iow_close:N \g__codedoc_func_iow
2050 \iow_term:e { \c__codedoc_iow_separator_tl }
2051 }
2052 }
2053 \AtEndDocument { \__codedoc_show_functions_defined: }
2054 \cs_new_protected:Npn \__codedoc_functions_typeout:nN #1#2
2055 {
2056 \tl_if_empty:NF #2
2057 {
2058 \iow_now:Ne \g__codedoc_func_iow
2059 {
2060 \c__codedoc_iow_midrule_tl \iow_newline:
2061 #1 \iow_newline:
2062 \c__codedoc_iow_midrule_tl
2063 #2
2064 }
2065 \tl_clear:N #2
2066 }
2067 }
2068 \cs_new_protected:Npn \__codedoc_show_not_tested:
2069 {
2070 \bool_if:NT \g__codedoc_checktest_bool
2071 {
2072 \tl_clear:N \l__codedoc_tmpa_tl
2073 \prop_if_empty:NF \g__codedoc_missing_tests_prop
2074 {
2075 \cs_set:Npn \__codedoc_tmpa:w ##1##2
2076 {
2077 \iow_newline:
2078 \space\space\space\space \exp_not:n {##1}
2079 \clist_map_function:nN {##2} \__codedoc_tmpb:w
2080 }
2081 \cs_set:Npn \__codedoc_tmpb:w ##1
2082 {
2083 \iow_newline:
2084 \space\space\space\space\space\space * ~ ##1
2085 }
2086 \tl_put_right:Ne \l__codedoc_tmpa_tl
2087 {
2088 \iow_newline: \iow_newline:
2089 The~ following~ macro(s)~ have~ incomplete~ tests:
2090 \iow_newline:
2091 \prop_map_function:NN
2092 \g__codedoc_missing_tests_prop \__codedoc_tmpa:w
2093 }
2094 }
2095 \seq_if_empty:NF \g__codedoc_not_tested_seq
2096 {
2097 \cs_set:Npn \__codedoc_tmpa:w ##1
2098 { \clist_map_function:nN {##1} \__codedoc_tmpb:w }
2099 \cs_set:Npn \__codedoc_tmpb:w ##1
2100 {
2101 \iow_newline:
2102 \space\space\space\space ##1
2103 }
2104 \tl_put_right:Ne \l__codedoc_tmpa_tl
2105 {
2106 \iow_newline:
2107 \iow_newline:
2108 The~ following~ macro(s)~ do~ not~ have~ any~ tests:
2109 \iow_newline:
2110 \seq_map_function:NN
2111 \g__codedoc_not_tested_seq \__codedoc_tmpa:w
2112 }
2113 }
2114 \tl_if_empty:NF \l__codedoc_tmpa_tl
2115 {
2116 \int_set:Nn \l__codedoc_tmpa_int { \tex_interactionmode:D }
2117 \errorstopmode
2118 \ClassError { l3doc } { \l__codedoc_tmpa_tl } { }
2119 \int_gset:Nn \tex_interactionmode:D { \l__codedoc_tmpa_int }
2120 }
2121 }
2122 }
2123 \AtEndDocument { \__codedoc_show_not_tested: }
2124 \cs_new_protected:Npn \__codedoc_target:
2125 {
2126 \mode_leave_vertical:
2127 \group_begin:
2128 \HD@savedestfalse \HD@target
2129 \group_end:
2130 }
2131 \cs_set_nopar:Npe \theCodelineNo
2132 {
2133 \group_begin:
2134 \exp_not:N \HD@savedestfalse
2135 \exp_not:o \theCodelineNo
2136 \group_end:
2137 }
2138 \bool_new:N \l__codedoc_allow_indexing_bool
2139 \bool_set_true:N \l__codedoc_allow_indexing_bool
2140 \use:e
2141 {
2142 \exp_not:n { \cs_set_nopar:Npn \@starttoc #1 }
2143 {
2144 \group_begin:
2145 \bool_set_false:N \l__codedoc_allow_indexing_bool
2146 \exp_not:o { \@starttoc {#1} }
2147 \group_end:
2148 }
2149 }
2150 \g@addto@macro \theindex { \MakePrivateLetters }
2151 \cs_gset:Npn \verbatimchar {&}
2152 \setcounter { IndexColumns } { 2 }
2153 \IndexPrologue
2154 {
2155 \part*{Index}
2156 \markboth{Index}{Index}
2157 \addcontentsline{toc}{part}{Index}
2158 The~italic~numbers~denote~the~pages~where~the~
2159 corresponding~entry~is~described,~
2160 numbers~underlined~point~to~the~definition,~
2161 all~others~indicate~the~places~where~it~is~used.
2162 }
2163 \cs_gset_protected:Npn \SpecialIndex #1
2164 {
2165 \@bsphack
2166 \__codedoc_special_index:nn {#1} { }
2167 \@esphack
2168 }
2169 \msg_new:nnn { l3doc } { print-index-howto }
2170 {
2171 Generate~the~index~by~executing\\
2172 \iow_indent:n
2173 { makeindex~-s~gind.ist~-o~\c_sys_jobname_str.ind~\c_sys_jobname_str.idx }
2174 }
2175 \tl_gput_right:Nn \PrintIndex
2176 { \AtEndDocument { \msg_info:nn { l3doc } { print-index-howto } } }
2177 \cs_gset_protected:Npn \it@is@a #1
2178 {
2179 \use:e
2180 {
2181 \__codedoc_special_index_module:nnnnN
2182 {#1}
2183 { \bslash #1 }
2184 { }
2185 { }
2186 \c_false_bool
2187 }
2188 }
2189 \cs_new_protected:Npn \__codedoc_special_index:nn #1#2
2190 {
2191 \__codedoc_key_get:n {#1}
2192 \quark_if_no_value:NF \l__codedoc_override_module_tl
2193 { \tl_set_eq:NN \l__codedoc_index_module_tl \l__codedoc_override_module_tl }
2194 \__codedoc_special_index_module:ooonN
2195 { \l__codedoc_index_key_tl }
2196 { \l__codedoc_index_macro_tl }
2197 { \l__codedoc_index_module_tl }
2198 {#2}
2199 \l__codedoc_index_internal_bool
2200 }
2201 \tl_new:N \l__codedoc_index_escaped_macro_tl
2202 \tl_new:N \l__codedoc_index_escaped_key_tl
2203 \cs_new_protected:Npn \__codedoc_special_index_module:nnnnN #1#2#3#4#5
2204 {
2205 \use:e
2206 {
2207 \exp_not:n { \__codedoc_special_index_aux:nnnnnn {#1} {#2} }
2208 \tl_if_empty:nTF {#3}
2209 { { } { } { } }
2210 {
2211 \str_if_eq:nnTF {#3} { TeX }
2212 {
2213 { TeX~and~LaTeX2e }
2214 { \string\TeX{}~and~\string\LaTeXe{} }
2215 }
2216 {
2217 {#3}
2218 { \string\pkg{#3} }
2219 }
2220 { \bool_if:NT #5 { ~internal } ~commands: }
2221 }
2222 }
2223 {#4}
2224 }
2225 \cs_generate_variant:Nn \__codedoc_special_index_module:nnnnN { ooo }
2226 \cs_new_protected:Npn \__codedoc_special_index_aux:nnnnnn #1#2#3#4#5#6
2227 {
2228 \tl_set:Nn \l__codedoc_index_escaped_key_tl {#1}
2229 \__codedoc_quote_special_char:N \l__codedoc_index_escaped_key_tl
2230 \__codedoc_special_index_set:Nn \l__codedoc_index_escaped_macro_tl {#2}
2231 \str_if_eq:onTF { \@currenvir } { macrocode }
2232 { \__codedoc_index_codeline_hc:nn }
2233 {
2234 \str_case:nnF {#6}
2235 {
2236 { main } { \__codedoc_index_codeline_hc:nn }
2237 { usage } { \__codedoc_index_page_hc:nn }
2238 }
2239 { \__codedoc_target: \__codedoc_index_page_hc:nn }
2240 }
2241 {
2242 \tl_if_empty:nF { #3 #4 #5 }
2243 { #3 #5 \actualchar #4 #5 \levelchar }
2244 \l__codedoc_index_escaped_key_tl
2245 \actualchar
2246 {
2247 \token_to_str:N \verbatim@font \c_space_tl
2248 \l__codedoc_index_escaped_macro_tl
2249 }
2250 }
2251 {#6}
2252 }
2253 \group_begin:
2254 \char_set_active_eq:NN - \scan_stop:
2255 \tl_const:Ne \c__codedoc_active_minus_tl { \char_generate:nn { `- } { 13 } }
2256 \group_end:
2257 \cs_new_eq:NN \__codedoc_old_hdpindex:nn \hdpindex
2258 \cs_new_eq:NN \__codedoc_old_hdclindex:nnn \hdclindex
2259 \cs_gset_protected:Npn \hdpindex #1
2260 { \__codedoc_hdindex:nn { \__codedoc_old_hdpindex:nn {#1} } }
2261 \cs_gset_protected:Npn \hdclindex #1#2
2262 { \__codedoc_hdindex:nn { \__codedoc_old_hdclindex:nnn {#1} {#2} } }
2263 \cs_new_protected:Npn \__codedoc_hdindex:nn #1#2
2264 {
2265 \tl_set:Nn \l__codedoc_tmpa_tl {#2}
2266 \tl_replace_all:Nen \l__codedoc_tmpa_tl
2267 { \exp_not:V \c__codedoc_active_minus_tl \exp_not:V \c__codedoc_active_minus_tl }
2268 { -- }
2269 \seq_set_split:NnV \l__codedoc_tmpa_seq { -- } \l__codedoc_tmpa_tl
2270 \seq_set_map:NNn \l__codedoc_tmpa_seq \l__codedoc_tmpa_seq
2271 { \__codedoc_hdindex_aux:nn {#1} {##1} }
2272 \seq_use:Nn \l__codedoc_tmpa_seq { -- }
2273 }
2274 \cs_new_protected:Npn \__codedoc_hdindex_aux:nn #1#2
2275 {
2276 \tl_set:Nn \l__codedoc_tmpa_tl {#2}
2277 \tl_replace_all:Nnn \l__codedoc_tmpa_tl { MMMM } { \use_none:nn }
2278 \tl_if_in:NnT \l__codedoc_tmpa_tl { MMMD }
2279 {
2280 \tl_replace_all:Nen \l__codedoc_tmpa_tl
2281 { \exp_not:V \c__codedoc_active_minus_tl MMMD } { - MMMD }
2282 \tl_replace_all:Nnn \l__codedoc_tmpa_tl { - MMMD } { \__codedoc_hdindex_aux:w }
2283 }
2284 \use:e { \exp_not:n {#1} { \exp_not:V \l__codedoc_tmpa_tl } }
2285 }
2286 \cs_new_protected:Npn \__codedoc_hdindex_aux:w #1 M { }
2287 \cs_new_protected:Npn \__codedoc_special_index_set:Nn #1#2
2288 {
2289 \__kernel_tl_set:Nx #1 { \tl_to_str:n {#2} }
2290 \__codedoc_if_almost_str:nTF {#2}
2291 {
2292 \tl_replace_all:Nen #1 { \tl_to_str:n { __ } }
2293 {
2294 \verbatimchar
2295 \token_to_str:N \_ \token_to_str:N \_
2296 \token_to_str:N \verb * \verbatimchar
2297 }
2298 \exp_args:Ne \tl_map_inline:nn
2299 { \tl_to_str:N \verbatimchar \token_to_str:N _ }
2300 {
2301 \tl_replace_all:Nnn #1 {##1}
2302 {
2303 \verbatimchar \c_backslash_str ##1
2304 \token_to_str:N \verb * \verbatimchar
2305 }
2306 }
2307 \__kernel_tl_set:Nx #1
2308 {
2309 \token_to_str:N \verb * \verbatimchar
2310 #1 \verbatimchar
2311 }
2312 }
2313 {
2314 \tl_set:Nn #1 {#2}
2315 \tl_replace_all:NVn #1
2316 \c_backslash_str
2317 { \token_to_str:N \bslash \c_space_tl }
2318 }
2319 \__codedoc_quote_special_char:N #1
2320 }
2321 \cs_new_protected:Npn \__codedoc_quote_special_char:N #1
2322 {
2323 \tl_map_inline:nn { \quotechar \actualchar \encapchar \levelchar \bslash }
2324 {
2325 \tl_replace_all:Nen #1
2326 { \tl_to_str:N ##1 } { \quotechar \tl_to_str:N ##1 }
2327 }
2328 }
2329 \cs_new_protected:Npe \__codedoc_key_get:n #1
2330 {
2331 \exp_not:N \__codedoc_key_get_base:nN {#1} \exp_not:N \l__codedoc_index_macro_tl
2332 \__kernel_tl_set:Nx \exp_not:N \l__codedoc_index_key_tl
2333 { \exp_not:N \tl_to_str:N \exp_not:N \l__codedoc_index_macro_tl }
2334 \tl_clear:N \exp_not:N \l__codedoc_index_module_tl
2335 \tl_if_in:NnTF \exp_not:N \l__codedoc_index_key_tl { \tl_to_str:n { __ } }
2336 { \bool_set_true:N \exp_not:N \l__codedoc_index_internal_bool }
2337 { \bool_set_false:N \exp_not:N \l__codedoc_index_internal_bool }
2338 \exp_not:N \tl_if_head_eq_charcode:VNT
2339 \exp_not:N \l__codedoc_index_key_tl \c_backslash_str
2340 { \exp_not:N \__codedoc_key_pop: }
2341 \tl_if_in:NnTF \exp_not:N \l__codedoc_index_key_tl { \token_to_str:N : }
2342 { \exp_not:N \__codedoc_key_func: }
2343 {
2344 \tl_if_in:NnTF \exp_not:N \l__codedoc_index_key_tl { \token_to_str:N _ }
2345 { \exp_not:N \__codedoc_key_var: }
2346 {
2347 \tl_if_in:NnT \exp_not:N \l__codedoc_index_key_tl { \token_to_str:N @ }
2348 { \tl_set:Nn \exp_not:N \l__codedoc_index_module_tl { TeX } }
2349 }
2350 }
2351 }
2352 \cs_new_protected:Npn \__codedoc_key_pop:
2353 {
2354 \__kernel_tl_set:Nx \l__codedoc_index_key_tl
2355 { \tl_tail:N \l__codedoc_index_key_tl }
2356 }
2357 \cs_new_protected:Npn \__codedoc_key_trim_module:n #1
2358 {
2359 \cs_set:Npn \__codedoc_tmpa:w ##1 #1 ##2 \q_stop
2360 { \exp_not:n {##1} }
2361 \__kernel_tl_set:Nx \l__codedoc_index_module_tl
2362 { \exp_after:wN \__codedoc_tmpa:w \l__codedoc_index_module_tl #1 \q_stop }
2363 }
2364 \cs_new_protected:Npn \__codedoc_key_drop_underscores:
2365 {
2366 \tl_if_head_eq_charcode:VNT \l__codedoc_index_key_tl _
2367 { \__codedoc_key_pop: \__codedoc_key_drop_underscores: }
2368 }
2369 \cs_new_protected:Npn \__codedoc_key_func:
2370 {
2371 \tl_if_head_eq_charcode:VNT \l__codedoc_index_key_tl .
2372 { \__codedoc_key_pop: }
2373 \__codedoc_key_drop_underscores:
2374 \tl_set_eq:NN \l__codedoc_index_module_tl \l__codedoc_index_key_tl
2375 \exp_args:No \__codedoc_key_trim_module:n { \token_to_str:N : }
2376 \exp_args:No \__codedoc_key_trim_module:n { \token_to_str:N _ }
2377 }
2378 \cs_new_protected:Npn \__codedoc_key_var:
2379 {
2380 \exp_args:Ne \tl_if_head_eq_charcode:nNTF
2381 { \exp_args:No \str_tail:n \l__codedoc_index_key_tl } _
2382 {
2383 \str_case:en { \str_head:N \l__codedoc_index_key_tl }
2384 {
2385 { q } { \tl_set:Nn \l__codedoc_index_module_tl { quark } }
2386 { s } { \tl_set:Nn \l__codedoc_index_module_tl { scan } }
2387 }
2388 \__codedoc_key_pop:
2389 \__codedoc_key_pop:
2390 \__codedoc_key_drop_underscores:
2391 \tl_if_empty:NT \l__codedoc_index_module_tl
2392 {
2393 \seq_set_split:NoV \l__codedoc_tmpa_seq
2394 { \token_to_str:N _ } \l__codedoc_index_key_tl
2395 \seq_get_left:NN \l__codedoc_tmpa_seq \l__codedoc_index_module_tl
2396 \clist_if_in:NoT \g__codedoc_non_modules_clist \l__codedoc_index_module_tl
2397 {
2398 \seq_get_right:NN \l__codedoc_tmpa_seq \l__codedoc_index_module_tl
2399 \clist_if_in:NoT \g__codedoc_non_modules_clist \l__codedoc_index_module_tl
2400 {
2401 \tl_clear:N \l__codedoc_index_module_tl
2402 }
2403 }
2404 }
2405 }
2406 {
2407 \tl_set_eq:NN \l__codedoc_index_module_tl \l__codedoc_index_key_tl
2408 \exp_args:No \__codedoc_key_trim_module:n { \token_to_str:N _ }
2409 }
2410 }
2411 \clist_new:N \g__codedoc_non_modules_clist
2412 \clist_gset:Ne \g__codedoc_non_modules_clist
2413 {
2414 \tl_to_str:n
2415 {
2416 alignment, ampersand, atsign, backslash, catcode, circumflex,
2417 code, colon, document, dollar, e, empty, false, hash, inf,
2418 initex, job, left, log, math, mark, max, minus, nan, nil, no,
2419 novalue, other, parameter, percent, pi, recursion, right, space,
2420 stop, term, tilde, tmpa, tmpb, true, underscore, zero, one, two,
2421 three, four, five, six, seven, eight, nine, ten, eleven, twelve,
2422 thirteen, fourteen, fifteen, sixteen, thirty, hundred
2423 }
2424 }
2425 \GlossaryPrologue
2426 {
2427 \part*{Change~History}
2428 {\GlossaryParms\ttfamily\hyphenchar\font=`\-}
2429 \markboth{Change~History}{Change~History}
2430 \addcontentsline{toc}{part}{Change~History}
2431 }
2432 \msg_new:nnn { l3doc } { print-changes-howto }
2433 {
2434 Generate~the~change~list~by~executing\\
2435 \iow_indent:n
2436 { makeindex~-s~gglo.ist~-o~\c_sys_jobname_str.gls~\c_sys_jobname_str.glo }
2437 }
2438 \tl_gput_right:Nn \PrintChanges
2439 { \AtEndDocument { \msg_info:nn { l3doc } { print-changes-howto } } }
2440 \bool_if:NTF \g__codedoc_typeset_implementation_bool
2441 {
2442 \RecordChanges
2443 \CodelineIndex
2444 \EnableCrossrefs
2445 \AlsoImplementation
2446 }
2447 {
2448 \CodelineNumbered
2449 \DisableCrossrefs
2450 \OnlyDescription
2451 }
2452 %%
2453 %%
2454 %% End of file `l3doc.cls'.