Debian Codegraph @

texmf-dist/doc/latex/expkv-bundle/preamble-l3doctweaks.tex

raw
1 \ExplSyntaxOn
2 \cs_new_protected:Npn \__expkvdoc_patchfootnote:% >>=
3 {
4 \cs_set:Npx \footnote
5 {
6 \exp_not:n { \ClassError {expkvdoc} {Footnote~ in~ function} {} }
7 \exp_not:o { \footnote }
8 }
9 }% =<<
10 \AddToHook{env/function/begin}{\__expkvdoc_patchfootnote:}
11
12 \group_begin:
13 \cs_set_protected:Npn \__expkvdoc_tmp:nN #1#2
14 {
15 \__kernel_tl_set:Nx #2 { \tl_to_str:n {#1} }
16 \tl_replace_all:NVn #2 \c_underscore_str { / }
17 \tl_remove_all:NV #2 \c_backslash_str
18 \tl_put_left:Nn #2 { doc/function// }
19 }
20 \cs_if_eq:NNTF \__expkvdoc_tmp:nN \__codedoc_get_hyper_target:nN
21 {
22 \cs_gset:Npn \__codedoc_get_hyper_target:nN #1#2
23 {
24 \__kernel_tl_set:Nx #2 { \tl_to_str:n {#1} }
25 \tl_replace_all:Nxn #2 { \c_underscore_str } { / }
26 \tl_remove_all:Nx #2 { \c_backslash_str }
27 \tl_put_left:Nx #2 { doc/function/ \g__expkvdoc_module_str / }
28 }
29 }
30 {
31 \ClassWarning{expkvdoc}
32 {
33 Didn't~ patch~ l3doc's~ hyper~ targets.~ You~ might~ get~ duplicate~
34 labels.
35 }
36 }
37 \group_end:
38
39 \ExplSyntaxOff