summaryrefslogtreecommitdiff
path: root/macros/generic/expkv-bundle/preamble-l3doctweaks.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/generic/expkv-bundle/preamble-l3doctweaks.tex')
-rw-r--r--macros/generic/expkv-bundle/preamble-l3doctweaks.tex39
1 files changed, 39 insertions, 0 deletions
diff --git a/macros/generic/expkv-bundle/preamble-l3doctweaks.tex b/macros/generic/expkv-bundle/preamble-l3doctweaks.tex
new file mode 100644
index 0000000000..47d2c744a5
--- /dev/null
+++ b/macros/generic/expkv-bundle/preamble-l3doctweaks.tex
@@ -0,0 +1,39 @@
+\ExplSyntaxOn
+\cs_new_protected:Npn \__expkvdoc_patchfootnote:% >>=
+ {
+ \cs_set:Npx \footnote
+ {
+ \exp_not:n { \ClassError {expkvdoc} {Footnote~ in~ function} {} }
+ \exp_not:o { \footnote }
+ }
+ }% =<<
+\AddToHook{env/function/begin}{\__expkvdoc_patchfootnote:}
+
+\group_begin:
+\cs_set_protected:Npn \__expkvdoc_tmp:nN #1#2
+ {
+ \__kernel_tl_set:Nx #2 { \tl_to_str:n {#1} }
+ \tl_replace_all:Nxn #2 { \c_underscore_str } { / }
+ \tl_remove_all:Nx #2 { \c_backslash_str }
+ \tl_put_left:Nn #2 { doc/function// }
+ }
+\cs_if_eq:NNTF \__expkvdoc_tmp:nN \__codedoc_get_hyper_target:nN
+ {
+ \cs_gset:Npn \__codedoc_get_hyper_target:nN #1#2
+ {
+ \__kernel_tl_set:Nx #2 { \tl_to_str:n {#1} }
+ \tl_replace_all:Nxn #2 { \c_underscore_str } { / }
+ \tl_remove_all:Nx #2 { \c_backslash_str }
+ \tl_put_left:Nx #2 { doc/function/ \g__expkvdoc_module_str / }
+ }
+ }
+ {
+ \ClassWarning{expkvdoc}
+ {
+ Didn't~ patch~ l3doc's~ hyper~ targets.~ You~ might~ get~ duplicate~
+ labels.
+ }
+ }
+\group_end:
+
+\ExplSyntaxOff