]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Back-port the \ulink macro to the documentation package for Python 2.1.x
authorFred Drake <fdrake@acm.org>
Tue, 27 Aug 2002 19:50:42 +0000 (19:50 +0000)
committerFred Drake <fdrake@acm.org>
Tue, 27 Aug 2002 19:50:42 +0000 (19:50 +0000)
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.

Doc/perl/python.perl
Doc/texinputs/python.sty

index 529ceb9c5ba3c4b1f5f9b8bd57b5f15581afb23e..04f41d3af1997828ff564a929be70accba3a7ba7 100644 (file)
@@ -323,6 +323,13 @@ sub do_cmd_rfc{
             . "$icon</a>" . $_);
 }
 
+sub do_cmd_ulink{
+    local($_) = @_;
+    my $text = next_argument();
+    my $url = next_argument();
+    return "<a class=\"ulink\" href=\"$url\"\n  >$text</a>" . $_;
+}
+
 sub do_cmd_citetitle{
     local($_) = @_;
     my $url = next_optional_argument();
index e4c60b834b14abeaca76a448fa7e0191d3647bcf..3e173f057f95fb451e753d739e91de5319c31b68 100644 (file)
 % 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}}