|
26 | 26 | \newif\ifpy@doing@page@targets |
27 | 27 | \py@doing@page@targetsfalse |
28 | 28 |
|
| 29 | +\newif\ifpdf\pdffalse |
29 | 30 | \ifx\pdfoutput\undefined\else\ifcase\pdfoutput |
30 | 31 | \else |
| 32 | + \pdftrue |
31 | 33 | \input{pdfcolor} |
32 | 34 | \let\py@LinkColor=\NavyBlue |
33 | 35 | \let\py@NormalColor=\Black |
|
253 | 255 |
|
254 | 256 | % Refer to a module's documentation using a hyperlink of the module's |
255 | 257 | % name, at least if we're building PDF: |
256 | | -\@ifundefined{pdfannotlink}{% |
257 | | - \newcommand{\refmodule}[2][\py@modulebadkey]{\module{#2}} |
258 | | -}{% |
| 258 | +\ifpdf |
259 | 259 | \newcommand{\refmodule}[2][\py@modulebadkey]{% |
260 | 260 | \ifx\py@modulebadkey#1\def\py@modulekey{#2}\else\def\py@modulekey{#1}\fi% |
261 | 261 | \py@linkToName{label-module-\py@modulekey}{\module{#2}}% |
262 | 262 | } |
263 | | -} |
| 263 | +\else |
| 264 | + \newcommand{\refmodule}[2][\py@modulebadkey]{\module{#2}} |
| 265 | +\fi |
264 | 266 |
|
265 | 267 | % support for the module index |
266 | 268 | \newif\ifpy@UseModuleIndex |
|
434 | 436 | }{} |
435 | 437 | } |
436 | 438 |
|
437 | | -\@ifundefined{pdfoutput}{ |
438 | | - \newcommand{\py@ModSynopsisSummary}[4]{\bfcode{#2} & #4\\} |
439 | | -}{ |
| 439 | +\ifpdf |
440 | 440 | \newcommand{\py@ModSynopsisSummary}[4]{% |
441 | 441 | \py@linkToName{label-module-#1}{\bfcode{#2}} & #4\\ |
442 | 442 | } |
443 | | -} |
| 443 | +\else |
| 444 | + \newcommand{\py@ModSynopsisSummary}[4]{\bfcode{#2} & #4\\} |
| 445 | +\fi |
444 | 446 | \newenvironment{synopsistable}{ |
445 | 447 | % key, name, type, synopsis |
446 | 448 | \let\modulesynopsis=\py@ModSynopsisSummary |
|
784 | 786 |
|
785 | 787 | % Use this def/redef approach for \url{} since hyperref defined this already, |
786 | 788 | % but only if we actually used hyperref: |
787 | | -\@ifundefined{pdfannotlink}{ |
788 | | - \newcommand{\py@url}[1]{\mbox{\small\textsf{#1}}} |
789 | | -}{ |
790 | | - \newcommand{\py@url}[1]{{% |
| 789 | +\ifpdf |
| 790 | + \newcommand{\url}[1]{{% |
791 | 791 | \pdfannotlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}% |
792 | 792 | \py@LinkColor% color of the link text |
793 | | - \mbox{\small\textsf{#1}}% |
| 793 | + \small\sf #1% |
794 | 794 | \py@NormalColor% Turn it back off; these are declarative |
795 | 795 | \pdfendlink}% and don't appear bound to the current |
796 | 796 | }% formatting "box". |
797 | | -} |
798 | | -\let\url=\py@url |
| 797 | +\else |
| 798 | + \newcommand{\url}[1]{\mbox{\small\textsf{#1}}} |
| 799 | +\fi |
799 | 800 | \newcommand{\email}[1]{{\small\textsf{#1}}} |
800 | 801 | \newcommand{\newsgroup}[1]{{\small\textsf{#1}}} |
801 | 802 |
|
|
843 | 844 | }} |
844 | 845 | \newcommand{\envvar}[1]{% |
845 | 846 | #1% |
846 | | - \index{#1@{#1}}% |
| 847 | + \index{#1}% |
847 | 848 | \index{environment variables!{#1}}% |
848 | 849 | } |
849 | 850 | \newcommand{\makevar}[1]{#1} % variable in a Makefile |
|
859 | 860 | \newcommand{\programopt}[1]{\strong{#1}} |
860 | 861 | % Note that \longprogramopt provides the '--'! |
861 | 862 | \newcommand{\longprogramopt}[1]{\strong{-{}-#1}} |
| 863 | + |
862 | 864 | % \ulink{link text}{URL} |
863 | | -\newcommand{\ulink}[2]{#1} |
| 865 | +\ifpdf |
| 866 | + % The \noindent here is a hack -- we're forcing pdfTeX into |
| 867 | + % horizontal mode since \pdfannotlink requires that. |
| 868 | + \newcommand{\ulink}[2]{\noindent{% |
| 869 | + \pdfannotlink attr{/Border [0 0 0]} user{/S /URI /URI (#2)}% |
| 870 | + \py@LinkColor% color of the link text |
| 871 | + #1% |
| 872 | + \py@NormalColor% Turn it back off; these are declarative |
| 873 | + \pdfendlink}% and don't appear bound to the current |
| 874 | + }% formatting "box". |
| 875 | +\else |
| 876 | + \newcommand{\ulink}[2]{#1} |
| 877 | +\fi |
864 | 878 |
|
865 | 879 | % cited titles: \citetitle{Title of Work} |
866 | 880 | % online: \citetitle[url-to-resource]{Title of Work} |
867 | | -\newcommand{\citetitle}[2][URL]{\emph{#2}} |
| 881 | +\ifpdf |
| 882 | + \newcommand{\citetitle}[2][\py@modulebadkey]{% |
| 883 | + \ifx\py@modulebadkey#1\emph{#2}\else\ulink{\emph{#2}}{#1}\fi% |
| 884 | + } |
| 885 | +\else |
| 886 | + \newcommand{\citetitle}[2][URL]{#1} |
| 887 | +\fi |
| 888 | + |
868 | 889 |
|
869 | 890 |
|
870 | 891 | \newcommand{\grammartoken}[1]{\texttt{#1}} |
|
1019 | 1040 | % Note that the last parameter for \seemodule and \seetext should be complete |
1020 | 1041 | % sentences and be terminated with the proper punctuation. |
1021 | 1042 |
|
1022 | | -\@ifundefined{pdfannotlink}{% |
| 1043 | +\ifpdf |
1023 | 1044 | \newcommand{\py@seemodule}[3][\py@modulebadkey]{% |
1024 | 1045 | \par% |
1025 | 1046 | \ifx\py@modulebadkey#1\def\py@modulekey{#2}\else\def\py@modulekey{#1}\fi% |
1026 | 1047 | \begin{fulllineitems} |
1027 | | - \item[Module \module{#2} (section \ref{module-\py@modulekey}):] |
| 1048 | + \item[\py@linkToName{label-module-\py@modulekey}{Module \module{#2}} |
| 1049 | + (section \ref{module-\py@modulekey}):] |
1028 | 1050 | #3 |
1029 | 1051 | \end{fulllineitems} |
1030 | 1052 | } |
1031 | | -}{\newcommand{\py@seemodule}[3][\py@modulebadkey]{% |
| 1053 | +\else |
| 1054 | + \newcommand{\py@seemodule}[3][\py@modulebadkey]{% |
1032 | 1055 | \par% |
1033 | 1056 | \ifx\py@modulebadkey#1\def\py@modulekey{#2}\else\def\py@modulekey{#1}\fi% |
1034 | 1057 | \begin{fulllineitems} |
1035 | | - \item[\py@linkToName{label-module-\py@modulekey}{Module \module{#2}} |
1036 | | - (section \ref{module-\py@modulekey}):] |
| 1058 | + \item[Module \module{#2} (section \ref{module-\py@modulekey}):] |
1037 | 1059 | #3 |
1038 | 1060 | \end{fulllineitems} |
1039 | 1061 | } |
1040 | | -} |
| 1062 | +\fi |
| 1063 | + |
1041 | 1064 | % \seetitle[url]{title}{why it's interesting} |
1042 | 1065 | \newcommand{\py@seetitle}[3][\py@modulebadkey]{% |
1043 | 1066 | \par |
|
0 commit comments