Kaydet (Commit) cdd6e4d7 authored tarafından Fred Drake's avatar Fred Drake

- fix up internal hyperlink generation in PDF formatting so that links at

  the beginning of a paragraph do not generate errors; this affected
  things like \refmodule when it came first in a paragraph
- clean up the .sty file to separate out the treatment of the start
  of a new paragraph
üst cf05f472
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
%\RequirePackage{showkeys} %\RequirePackage{showkeys}
%\RequirePackage{showidx} %\RequirePackage{showidx}
% If we ever want to indent paragraphs, this needs to be changed.
% This is used inside the macros defined here instead of coding
% \noindent directly.
\let\py@parindent=\noindent
% for PDF output, use maximal compression & a lot of other stuff % for PDF output, use maximal compression & a lot of other stuff
% (test for PDF recommended by Tanmoy Bhattacharya <tanmoy@qcd.lanl.gov>) % (test for PDF recommended by Tanmoy Bhattacharya <tanmoy@qcd.lanl.gov>)
% %
...@@ -56,12 +61,19 @@ ...@@ -56,12 +61,19 @@
\let\pdfstartlink=\pdfannotlink \let\pdfstartlink=\pdfannotlink
}{} }{}
% %
% The \py@parindent here is a hack -- we're forcing pdfTeX into
% horizontal mode since \pdfstartlink requires that.
\def\py@pdfstartlink{%
\ifvmode\py@parindent\fi%
\pdfstartlink%
}
%
% Macro that takes two args: the name to link to and the content of % Macro that takes two args: the name to link to and the content of
% the link. This takes care of the PDF magic, getting the colors % the link. This takes care of the PDF magic, getting the colors
% the same for each link, and avoids having lots of garbage all over % the same for each link, and avoids having lots of garbage all over
% this style file. % this style file.
\newcommand{\py@linkToName}[2]{% \newcommand{\py@linkToName}[2]{%
\pdfstartlink attr{/Border [0 0 0]} goto name{#1}% \py@pdfstartlink attr{/Border [0 0 0]} goto name{#1}%
\py@LinkColor#2\py@NormalColor% \py@LinkColor#2\py@NormalColor%
\pdfendlink% \pdfendlink%
} }
...@@ -857,8 +869,7 @@ ...@@ -857,8 +869,7 @@
% but only if we actually used hyperref: % but only if we actually used hyperref:
\ifpdf \ifpdf
\newcommand{\url}[1]{{% \newcommand{\url}[1]{{%
\noindent% \py@pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}%
\pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}%
\py@LinkColor% color of the link text \py@LinkColor% color of the link text
\py@smallsize\sf #1% \py@smallsize\sf #1%
\py@NormalColor% Turn it back off; these are declarative \py@NormalColor% Turn it back off; these are declarative
...@@ -933,11 +944,9 @@ ...@@ -933,11 +944,9 @@
% \ulink{link text}{URL} % \ulink{link text}{URL}
\ifpdf \ifpdf
% The \noindent here is a hack -- we're forcing pdfTeX into \newcommand{\ulink}[2]{{%
% horizontal mode since \pdfstartlink requires that.
% For PDF, we *should* only generate a link when the URL is absolute. % For PDF, we *should* only generate a link when the URL is absolute.
\newcommand{\ulink}[2]{\noindent{% \py@pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#2)}%
\pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#2)}%
\py@LinkColor% color of the link text \py@LinkColor% color of the link text
#1% #1%
\py@NormalColor% Turn it back off; these are declarative \py@NormalColor% Turn it back off; these are declarative
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment