Debian Codegraph @

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