Debian Codegraph @

texmf-dist/tex/generic/tex4ht/xrhyper-hooks.4ht

raw
1 % xrhyper-hooks.4ht (2025-06-06-09:56), generated from tex4ht-4ht.tex
2 % Copyright 2020-2025 TeX Users Group
3 %
4 % This work may be distributed and/or modified under the
5 % conditions of the LaTeX Project Public License, either
6 % version 1.3c of this license or (at your option) any
7 % later version. The latest version of this license is in
8 % http://www.latex-project.org/lppl.txt
9 % and version 1.3c or later is part of all distributions
10 % of LaTeX version 2005/12/01 or later.
11 %
12 % This work has the LPPL maintenance status "maintained".
13 %
14 % The Current Maintainer of this work
15 % is the TeX4ht Project <http://tug.org/tex4ht>.
16 %
17 % If you modify this program, changing the
18 % version identification would be appreciated.
19 \immediate\write-1{version 2025-06-06-09:56}
20
21 \ExplSyntaxOn
22 % detect )F[number]F- using l3regex
23 \regex_new:N \l_xref_filename
24 \regex_set:Nn \l_xref_filename {F\d+F}
25 % save all filenames declared in the xref file
26 \def\:extract:filename:from:xref#1#2#3{%
27 \regex_if_match:NnTF \l_xref_filename {#1}{%
28 \filename@parse{#2}
29 \expandafter\xdef\csname xr:dir:\filename@base\endcsname{\:tempa}
30 }{}
31 }
32 \def\:declare:xref:files#1#2{
33 \begingroup
34 % we need to find filenames of cutfiles
35 % we will use \filename@parse again, so we need to save the directory name
36 \edef\:tempa{#2}%
37 \def\:CrossWord##1##2##3{\:extract:filename:from:xref{##1}{##2}{\:tempa}}%
38 \catcode`\:=11% : is not letter at this moment
39 \InputIfFileExists{#1.xref}{}{}% load saved cross-references
40 \endgroup
41 }
42
43 \ExplSyntaxOff
44
45 \:AtEndOfPackage{\let\XR:\XR@
46 \def\XR@[#1][#2]#3{%
47 % save directory for the linked file
48 \filename@parse{#3}%
49 % \filename@base is filename, \filename@area directory
50 \expandafter\xdef\csname xr:dir:\filename@base\endcsname{\filename@area}%
51 \:declare:xref:files{\filename@area\filename@base}{\filename@area}% declare directory for cut files
52 \AtBeginDocument{\XR:[#1][#2]{#3}}
53 }%
54 }
55
56