LaTeX Style File: epydoc-default.sty

% epydoc-boxes.sty
%
% Authors: Jonathan Guyer <guyer@nist.gov>
%          Edward Loper <edloper@seas.upenn.edu>
% URL: <http://epydoc.sf.net>
%
% This LaTeX stylesheet (nearly) replicates the LaTeX output style
% generated by epydoc 3.0.  Function lists are displayed using
% a boxedminipage for each function.  Variable and Property lists
% are displayed using a longtable, with a row for each object.
%
% $Id:$
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{epydoc-boxes}[2008/02/26 v3.0.1 Epydoc Python Documentation]
% Pass options to the epydoc base package.
\RequirePackage{xkeyval}
\DeclareOptionX*{\PassOptionsToPackage{\CurrentOption}{epydoc-base}}
\ProcessOptionsX\relax
% Load the base epydoc package
\RequirePackage{epydoc-base}

% Use longtable for variable & property lists.
\RequirePackage{longtable}

% Double the standard size boxedminipage outlines.
\setlength{\fboxrule}{2\fboxrule}

% Set the width of the variable name cells in the variable & property
% tables.
\newlength{\EpydocVariableWidth}
\setlength{\EpydocVariableWidth}{.3\textwidth}

% ======================================================================
% Function Lists

% Put the function inside a boxedminipage.  Use a horizontal rule to
% separate the signature from the description elements.  Implementation
% note: the \@EpydocSeparator command adds a horizontal rule the first
% time it is called, and does nothing when called after that.
\renewenvironment{EpydocFunctionList}{%
    \def\@EpydocSeparator{%
       \vspace{-2\EpydocParskip}
       \rule{\dimexpr \textwidth-2\fboxsep}{0.5\fboxrule}
       \aftergroup\def\aftergroup\@EpydocSeparator%
             \aftergroup{\aftergroup}}%
    \newcommand{\EpydocFunction}[1]{{%
        \setkeys[Epydoc]{function}{##1}%
        \begin{boxedminipage}{\dimexpr \textwidth-2\fboxsep}
            {\Large\raggedright\cmdEpydoc@function@signature\par}
            \setlength{\parskip}{\EpydocParskip}
            \@ifundefined{cmdEpydoc@function@description}{}{%
                {\@EpydocSeparator}%
                \par\cmdEpydoc@function@description}%
            \@ifundefined{cmdEpydoc@function@parameters}{}{%
                {\@EpydocSeparator}%
                \par\cmdEpydoc@function@parameters}%
            \@ifundefined{cmdEpydoc@function@returntype}{
                \@ifundefined{cmdEpydoc@function@returndescr}{}{
                    {\@EpydocSeparator}%
                    \par\textbf{Return Value}%
                    \par\vspace{-\EpydocParskip}%
                    \begin{quote}\cmdEpydoc@function@returndescr\end{quote}}%
            }{
                {\@EpydocSeparator}%
                \par\textbf{Return Value}%
                \par\vspace{-\EpydocParskip}%
                \begin{quote}%
                  \@ifundefined{cmdEpydoc@function@returndescr}{
                      \textit{\cmdEpydoc@function@returntype}%
                  }{%
                      \cmdEpydoc@function@returndescr%
                        \textit{(type=\cmdEpydoc@function@returntype)}}%
                \end{quote}%
            }
            \@ifundefined{cmdEpydoc@function@raises}{}{%
                {\@EpydocSeparator}%
                \par\cmdEpydoc@function@raises}%
            \@ifundefined{cmdEpydoc@function@overrides}{}{%
                {\@EpydocSeparator}%
                \par\cmdEpydoc@function@overrides}%
            \@ifundefined{cmdEpydoc@function@metadata}{}{%
                \ifx\cmdEpydoc@property@metadata\empty\else
                    {\@EpydocSeparator}%
                    \par\cmdEpydoc@function@metadata%
                \fi}%
        \end{boxedminipage}\par}}}
  {}

% ======================================================================
% Multi-Page List (used to define EpydocVariableList etc)

% [xx] \textwidth is not the right size for the multicolumn..

% Define a base environment that we will use to put variable &
% property lists in a longtable.  This environment sets up the
% longtable environment, and redefines the \EpydocGroup and
% \EpydocInheritanceList commands to add a row to the table.
\newenvironment{@EpydocGeneralList}{%
    \renewcommand{\EpydocGroup}[1]{%
        \multicolumn{2}{@{\vrule width \fboxrule \hspace \tabcolsep}l
                        @{\hspace \tabcolsep \vrule width \fboxrule}}
            {\textbf{\textit{##1}}} \\
        \hline}%
    \renewcommand{\EpydocInheritanceList}[2]{%
        \multicolumn{2}{@{\vrule width \fboxrule \hspace \tabcolsep}
                        p{\dimexpr \textwidth -4\tabcolsep-7pt}
                        @{\hspace \tabcolsep \vrule width \fboxrule}}
            {\raggedright\textbf{Inherited from {##1}:\\##2}} \\
        \hline}%
    \setlength{\doublerulesep}{0pt}
    \begin{longtable}[l]{@{\vrule width \fboxrule \hspace \tabcolsep}
                         p{\EpydocVariableWidth}|
                         p{\dimexpr \textwidth%
                                -4\tabcolsep-7pt
                                -\EpydocVariableWidth}
                         @{\hspace \tabcolsep \vrule width \fboxrule}}
    % Set up the headers & footer (this makes the table span
    % multiple pages in a happy way).
    \hline \hline \rule{0pt}{\baselineskip} 
    \centering \Large \textbf{Name} &
    \centering \Large \textbf{Description} 
    \tabularnewline
    \hline \hline 
    \endhead%
    \hline\hline\multicolumn{2}{r}{%
        \small\textit{continued on next page}}\\\endfoot%
    \hline\hline
    \endlastfoot}
    {\end{longtable}}

% ======================================================================
% Variable Lists

\renewenvironment{EpydocVariableList}{%
    \newcommand{\EpydocVariable}[1]{{%
        \setkeys[Epydoc]{variable}{##1}%
        \raggedright\cmdEpydoc@variable@name &%
        \setkeys[Epydoc]{variable}{##1}%
        \setlength{\parskip}{\EpydocParskip}\raggedright%
        \@ifundefined{cmdEpydoc@variable@description}{}{%
            \cmdEpydoc@variable@description\relax}%
        \@ifundefined{cmdEpydoc@variable@value}{}{%
            \@ifundefined{cmdEpydoc@variable@description}{}{\par}%
            \textbf{Value:} \texttt{\cmdEpydoc@variable@value}}%
        \@ifundefined{cmdEpydoc@variable@type}{}{%
            \@ifundefined{cmdEpydoc@variable@description}{%
                \@ifundefined{cmdEpydoc@variable@value}{}{ }}{ }%
            \textit{(type=\texttt{\cmdEpydoc@variable@type})}}%
        \tabularnewline
        \hline}}%
    \begin{@EpydocGeneralList}%
    }
    {\end{@EpydocGeneralList}}

% By default, EpydocClassVariableList & EpydocInstanceVariableList are 
% just aliases for EpydocVaribleList.

% ======================================================================
% Property Lists

% Implementation node: \@EpydocSeparator evaluates to nothing on
% the first use, and to a paragraph break on subsequent uses.
\renewenvironment{EpydocPropertyList}{%
    \def\@EpydocSeparator{%
       \aftergroup\def\aftergroup\@EpydocSeparator\aftergroup{%
       \aftergroup\par%
       \aftergroup}}%
    \newcommand{\EpydocProperty}[1]{{%
        \setkeys[Epydoc]{property}{##1}%
        \raggedright\cmdEpydoc@property@name & %
        \setkeys[Epydoc]{property}{##1}%
        \setlength{\parskip}{\EpydocParskip}\raggedright%
        \@ifundefined{cmdEpydoc@property@description}{}{%
            {\@EpydocSeparator}%
            \cmdEpydoc@property@description\relax}%
        \@ifundefined{cmdEpydoc@property@type}{}{%
            {\@EpydocSeparator}%
            \textbf{Type:} \cmdEpydoc@property@type\relax}%
        \@ifundefined{cmdEpydoc@property@fget}{}{%
            {\@EpydocSeparator}%
            \textbf{Get:} \cmdEpydoc@property@fget\relax}%
        \@ifundefined{cmdEpydoc@property@fset}{}{%
            {\@EpydocSeparator}%
            \textbf{Set:} \cmdEpydoc@property@fset\relax}%
        \@ifundefined{cmdEpydoc@property@fdel}{}{%
            {\@EpydocSeparator}%
            \textbf{Delete:} \cmdEpydoc@property@fdel\relax}%
        \tabularnewline
        \hline}}
    \begin{@EpydocGeneralList}}
    {\end{@EpydocGeneralList}}

% This style file is a derivative work, based on a public domain style
% file that was originally developed at the National Institute of
% Standards and Technology by employees of the Federal Government in the
% course of their official duties.  NIST assumes no responsibility
% whatsoever for its use by other parties, and makes no guarantees,
% expressed or implied, about its quality, reliability, or any other
% characteristic.