|
37 | 37 | % active links. Some work, some don't.
|
38 | 38 | %
|
39 | 39 | \let\py@OldContentsline=\contentsline
|
| 40 | + % |
| 41 | + % Macro that takes two args: the name to link to and the content of |
| 42 | + % the link. This takes care of the PDF magic, getting the colors |
| 43 | + % the same for each link, and avoids having lots of garbage all over |
| 44 | + % this style file. |
| 45 | + \newcommand{\py@linkToName}[2]{% |
| 46 | + \pdfannotlink attr{/Border [0 0 0]} goto name{#1}% |
| 47 | + \py@LinkColor#2\py@NormalColor% |
| 48 | + \pdfendlink% |
| 49 | + } |
40 | 50 | % Compute the padded page number separately since we end up with a pair of
|
41 | 51 | % \relax tokens; this gets the right string computed and works.
|
42 | 52 | \renewcommand{\contentsline}[3]{%
|
43 | 53 | \def\my@pageno{\py@targetno{#3}}%
|
44 |
| - \py@OldContentsline{#1}{% |
45 |
| - \pdfannotlink attr{/Border [0 0 0]} goto name{page\my@pageno}% |
46 |
| - \py@LinkColor#2\py@NormalColor% |
47 |
| - \pdfendlink% |
48 |
| - }{#3}% |
| 54 | + \py@OldContentsline{#1}{\py@linkToName{page\my@pageno}{#2}}{#3}% |
49 | 55 | }
|
50 | 56 | \AtEndDocument{
|
51 | 57 | \InputIfFileExists{\jobname.bkm}{\pdfcatalog{/PageMode /UseOutlines}}{}
|
|
232 | 238 | % name, at least if we're building PDF:
|
233 | 239 | \@ifundefined{pdfannotlink}{%
|
234 | 240 | \newcommand{\refmodule}[2][\py@modulebadkey]{\module{#2}}
|
235 |
| -}{\newcommand{\refmodule}[2][\py@modulebadkey]{% |
| 241 | +}{% |
| 242 | + \newcommand{\refmodule}[2][\py@modulebadkey]{% |
236 | 243 | \ifx\py@modulebadkey#1\def\py@modulekey{#2}\else\def\py@modulekey{#1}\fi%
|
237 |
| - {\pdfannotlink attr{/Border [0 0 0]} goto name{label-module-\py@modulekey}% |
238 |
| - \py@LinkColor\module{#2}\py@NormalColor% |
239 |
| - \pdfendlink% |
240 |
| - }% |
| 244 | + \py@linkToName{label-module-\py@modulekey}{\module{#2}}% |
241 | 245 | }
|
242 | 246 | }
|
243 | 247 |
|
|
362 | 366 | \@ifundefined{pdfoutput}{
|
363 | 367 | \newcommand{\py@ModSynopsisSummary}[4]{\bfcode{#2} & #4\\}
|
364 | 368 | }{
|
365 |
| - \newcommand{\py@ModSynopsisSummary}[4]{ |
366 |
| - {\pdfannotlink attr{/Border [0 0 0]} goto name{label-module-#1} |
367 |
| - \py@LinkColor \bfcode{#2} \py@NormalColor |
368 |
| - \pdfendlink}& #4\\} |
| 369 | + \newcommand{\py@ModSynopsisSummary}[4]{% |
| 370 | + \py@linkToName{label-module-#1}{\bfcode{#2}} & #4\\ |
| 371 | + } |
369 | 372 | }
|
370 | 373 | \newenvironment{synopsistable}{
|
371 | 374 | % key, name, type, synopsis
|
|
807 | 810 | \par%
|
808 | 811 | \ifx\py@modulebadkey#1\def\py@modulekey{#2}\else\def\py@modulekey{#1}\fi%
|
809 | 812 | \ref{module-\py@modulekey}:\quad %
|
810 |
| - {\pdfannotlink attr{/Border [0 0 0]} goto name{label-module-\py@modulekey}% |
811 |
| - \py@LinkColor Module \module{#2} \py@NormalColor% |
812 |
| - \pdfendlink% |
813 |
| - }% |
| 813 | + \py@linkToName{label-module-\py@modulekey}{ Module \module{#2} } |
814 | 814 | \quad (#3)%
|
815 | 815 | }
|
816 | 816 | }
|
|
0 commit comments