Debian Codegraph @

texmf-dist/tex/generic/tex4ht/backref.4ht

raw
1 % backref.4ht (2021-12-20-13:57), generated from tex4ht-4ht.tex
2 % Copyright 2021 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 2021-12-20-13:57}
20
21 % patch command that inserts backlink destinations
22 \pend:defI\Hy@backout{%
23 % prevent duplicate backlink on the same page
24 \ifcsname bk##1\thepage\endcsname\else%
25 % insert link to the page
26 \html:addr\Link-{}{x\last:haddr}\EndLink%
27 % save link to the .xref file
28 \Tag{)Q##1\thepage}{x\last:haddr}%
29 % we need to save the link destination in .xref file
30 % too, otherwise \Link command would issue warning
31 \Tag{)Qx\last:haddr}{\FileNumber}%
32 \fi%
33 % declare this backlink destination as used, so we don't
34 % declare another one with the same name
35 \expandafter\def\csname bk##1\thepage\endcsname{}%
36 }
37
38 % redefine macro that puts out backlinks
39 \def\:tempa#1#2#3{%
40 % test if we saved link to the current bibitem and page
41 \ifTag{)Q\current:back:desc#1}{%
42 \Link{\LikeRef{)Q\current:back:desc#1}}{}#1\EndLink%
43 }%
44 {#1}% print just page number if there is no saved link
45 }%
46 \HLet\backrefxxx\:tempa
47
48 % save current bibkey for use in \backrefxxx
49 \pend:defI\BR@backref{\def\current:back:desc{##1}}
50
51 \Hinput{backref}
52 \endinput
53