diff Doc/texinputs/python.sty @ 25048:d0413de143ec 2.1

Back-port the \ulink macro to the documentation package for Python 2.1.x since a documentation patch included \ulink. Adding this here makes back-porting further documentation patches easier than having to remove \ulink from the patches. Closes SF bug #598996.
author Fred Drake <fdrake@acm.org>
date Tue, 27 Aug 2002 19:50:42 +0000
parents b664b02c3e91
children
line wrap: on
line diff
--- a/Doc/texinputs/python.sty	Tue Aug 27 18:41:26 2002 +0000
+++ b/Doc/texinputs/python.sty	Tue Aug 27 19:50:42 2002 +0000
@@ -856,6 +856,21 @@
 % Note that \longprogramopt provides the '--'!
 \newcommand{\longprogramopt}[1]{\strong{-{}-#1}}
 
+% \ulink{link text}{URL}
+\@ifundefined{pdfannotlink}{
+  \newcommand{\ulink}[2]{#1}
+}{
+  % The \noindent here is a hack -- we're forcing pdfTeX into
+  % horizontal mode since \pdfstartlink requires that.
+  \newcommand{\ulink}[2]{\noindent{%
+    \pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#2)}%
+    \py@LinkColor%                              color of the link text
+    #1%
+    \py@NormalColor%                    Turn it back off; these are declarative
+    \pdfendlink}%                       and don't appear bound to the current
+  }%                                    formatting "box".
+}
+
 % cited titles:  \citetitle{Title of Work}
 %       online:  \citetitle[url-to-resource]{Title of Work}
 \newcommand{\citetitle}[2][URL]{\emph{#2}}