Skip to content

Commit 4fa82fa

Browse files
committed
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.
1 parent 8bb9fe8 commit 4fa82fa

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Doc/perl/python.perl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,13 @@ sub do_cmd_rfc{
323323
. "$icon</a>" . $_);
324324
}
325325

326+
sub do_cmd_ulink{
327+
local($_) = @_;
328+
my $text = next_argument();
329+
my $url = next_argument();
330+
return "<a class=\"ulink\" href=\"$url\"\n >$text</a>" . $_;
331+
}
332+
326333
sub do_cmd_citetitle{
327334
local($_) = @_;
328335
my $url = next_optional_argument();

Doc/texinputs/python.sty

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,21 @@
856856
% Note that \longprogramopt provides the '--'!
857857
\newcommand{\longprogramopt}[1]{\strong{-{}-#1}}
858858

859+
% \ulink{link text}{URL}
860+
\@ifundefined{pdfannotlink}{
861+
\newcommand{\ulink}[2]{#1}
862+
}{
863+
% The \noindent here is a hack -- we're forcing pdfTeX into
864+
% horizontal mode since \pdfstartlink requires that.
865+
\newcommand{\ulink}[2]{\noindent{%
866+
\pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#2)}%
867+
\py@LinkColor% color of the link text
868+
#1%
869+
\py@NormalColor% Turn it back off; these are declarative
870+
\pdfendlink}% and don't appear bound to the current
871+
}% formatting "box".
872+
}
873+
859874
% cited titles: \citetitle{Title of Work}
860875
% online: \citetitle[url-to-resource]{Title of Work}
861876
\newcommand{\citetitle}[2][URL]{\emph{#2}}

0 commit comments

Comments
 (0)