epydoc-commits Mailing List for Python API documentation generation tool (Page 3)
Brought to you by:
edloper
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
(77) |
May
|
Jun
(6) |
Jul
(8) |
Aug
(91) |
Sep
(67) |
Oct
(4) |
Nov
|
Dec
(1) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(17) |
Feb
(135) |
Mar
(25) |
Apr
|
May
(1) |
Jun
(1) |
Jul
(7) |
Aug
|
Sep
(62) |
Oct
(1) |
Nov
(3) |
Dec
|
| 2008 |
Jan
(40) |
Feb
(102) |
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <ed...@us...> - 2008-02-23 20:10:27
|
Revision: 1762
http://epydoc.svn.sourceforge.net/epydoc/?rev=1762&view=rev
Author: edloper
Date: 2008-02-23 12:10:25 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
- DocstringLinker.url_for() is now an optional method
Modified Paths:
--------------
trunk/epydoc/src/epydoc/markup/__init__.py
Modified: trunk/epydoc/src/epydoc/markup/__init__.py
===================================================================
--- trunk/epydoc/src/epydoc/markup/__init__.py 2008-02-23 19:50:28 UTC (rev 1761)
+++ trunk/epydoc/src/epydoc/markup/__init__.py 2008-02-23 20:10:25 UTC (rev 1762)
@@ -453,7 +453,7 @@
@rtype: C{string}
@return: The translated index term.
"""
- raise NotImplementedError, 'DocstringLinker.translate_indexterm()'
+ raise NotImplementedError('DocstringLinker.translate_indexterm()')
def translate_identifier_xref(self, identifier, label=None):
"""
@@ -472,14 +472,15 @@
@rtype: C{string}
@return: The translated crossreference link.
"""
- raise NotImplementedError, 'DocstringLinker.translate_xref()'
+ raise NotImplementedError('DocstringLinker.translate_xref()')
def url_for(self, identifier):
"""
Given an identifier, return a URL pointing at that identifier.
- This is used to create hyperlinks in dotgraphs.
+ This is used to create hyperlinks in dotgraphs. This method
+ is *optional* -- i.e., it may raise NotImplementedError
"""
- raise NotImplementedError, 'DocstringLinker.url_for()'
+ raise NotImplementedError('DocstringLinker.url_for()')
##################################################
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 19:50:30
|
Revision: 1761
http://epydoc.svn.sourceforge.net/epydoc/?rev=1761&view=rev
Author: edloper
Date: 2008-02-23 11:50:28 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
- Added max_width and max_height attributes to DotGraph -- if the graph
is larger than this, then it will be scaled down. Default value is
6 inches wide by 8 inches tall.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/dotgraph.py
Modified: trunk/epydoc/src/epydoc/docwriter/dotgraph.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2008-02-23 19:33:37 UTC (rev 1760)
+++ trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2008-02-23 19:50:28 UTC (rev 1761)
@@ -84,7 +84,8 @@
DEFAULT_EDGE_DEFAULTS={'fontsize':10, 'fontname': 'Helvetica'}
def __init__(self, title, body='', node_defaults=None,
- edge_defaults=None, caption=None):
+ edge_defaults=None, caption=None,
+ max_width=6, max_height=8):
"""
Create a new `DotGraph`.
"""
@@ -109,7 +110,13 @@
graph.
:type: ``str``"""
+
+ self.max_width = max_width
+ """The maximum width of the graph (in inches)"""
+ self.max_height = max_height
+ """The maximum height of the graph (in inches)"""
+
self.node_defaults = node_defaults or self.DEFAULT_NODE_DEFAULTS
"""Default attribute values for nodes."""
@@ -329,6 +336,7 @@
to render this graph.
"""
lines = ['digraph %s {' % self.uid,
+ 'size="%d,%d"\n' % (self.max_width, self.max_height),
'node [%s]' % ','.join(['%s="%s"' % (k,v) for (k,v)
in self.node_defaults.items()]),
'edge [%s]' % ','.join(['%s="%s"' % (k,v) for (k,v)
@@ -1126,6 +1134,8 @@
return DotGraphEdge(start, end)
if isinstance(classes, ClassDoc): classes = [classes]
+ # [xx] this should be done earlier, and should generate a warning:
+ classes = [c for c in classes if c is not None]
graph = DotGraph('Class Hierarchy for %s' % name_list(classes, context),
body='ranksep=0.3\n',
edge_defaults={'sametail':True, 'dir':'none'})
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 19:33:40
|
Revision: 1760
http://epydoc.svn.sourceforge.net/epydoc/?rev=1760&view=rev
Author: edloper
Date: 2008-02-23 11:33:37 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
- Fixed bug in base style's def of EpydocProperty command
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/latex_sty.py
Modified: trunk/epydoc/src/epydoc/docwriter/latex_sty.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/latex_sty.py 2008-02-23 19:32:13 UTC (rev 1759)
+++ trunk/epydoc/src/epydoc/docwriter/latex_sty.py 2008-02-23 19:33:37 UTC (rev 1760)
@@ -487,25 +487,25 @@
\gdef\@EpydocPropertyGet{##4}%
\gdef\@EpydocPropertySet{##5}%
\gdef\@EpydocPropertyDel{##6}%
- {\Large\raggedright\@EpydocVariableName}
+ {\Large\raggedright\@EpydocPropertyName}
\begin{quote}
\setlength{\parskip}{\EpydocParskip}%
- \ifx\@EpydocVariableDescription\empty\else
+ \ifx\@EpydocPropertyDescription\empty\else
- \@EpydocVariableDescription\fi%
- \ifx\@EpydocVariableType\empty\else
+ \@EpydocPropertyDescription\fi%
+ \ifx\@EpydocPropertyType\empty\else
- \textbf{Type:} \@EpydocVariableType\fi%
- \ifx\@EpydocVariableGet\empty
+ \textbf{Type:} \@EpydocPropertyType\fi%
+ \ifx\@EpydocPropertyGet\empty
- \textbf{Get:} \texttt{\@EpydocVariableGet}\fi%
- \ifx\@EpydocVariableSet\empty
+ \textbf{Get:} \texttt{\@EpydocPropertyGet}\fi%
+ \ifx\@EpydocPropertySet\empty
- \textbf{Set:} \texttt{\@EpydocVariableSet}\fi%
- \ifx\@EpydocVariableDel\empty
+ \textbf{Set:} \texttt{\@EpydocPropertySet}\fi%
+ \ifx\@EpydocPropertyDel\empty
- \textbf{Delete:} \texttt{\@EpydocVariableDel}\fi%
+ \textbf{Delete:} \texttt{\@EpydocPropertyDel}\fi%
\end{quote}
}}
{}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 19:32:15
|
Revision: 1759
http://epydoc.svn.sourceforge.net/epydoc/?rev=1759&view=rev
Author: edloper
Date: 2008-02-23 11:32:13 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
- Removed stale code that was accidentally not deleted in previous checkin
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/latex.py
Modified: trunk/epydoc/src/epydoc/docwriter/latex.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/latex.py 2008-02-23 19:06:41 UTC (rev 1758)
+++ trunk/epydoc/src/epydoc/docwriter/latex.py 2008-02-23 19:32:13 UTC (rev 1759)
@@ -134,7 +134,7 @@
(ValueDoc.SUMMARY_REPR_LINELEN, ValueDoc.REPR_LINELEN,
ValueDoc.REPR_MAXLINES) = orig_valdoc_defaults
- def _write_sty(self, directory, stylesheet, filename='epydoc.sty'):
+ def _write_sty(self, directory, stylesheet):
"""
Copy the requested LaTeX stylesheet to the target directory.
The stylesheet can be specified as a name (i.e., a key from
@@ -170,31 +170,7 @@
else:
raise IOError("Can't find LaTeX style file: %r" % stylesheet)
-
- self._write_sty(directory, None, 'epydoc-default.sty')
-
-
-
- if stylesheet is None:
- sty = STYLESHEETS['base']
- elif os.path.exists(stylesheet):
- try: sty = open(stylesheet, 'rb').read()
- except: raise IOError("Can't open LaTeX style file: %r" %
- stylesheet)
- self._write_sty(directory, None, 'epydoc-default.sty')
- elif stylesheet in STYLESHEETS:
- sty = STYLESHEETS[stylesheet]
- if sty != STYLESHEETS['base']:
- self._write_sty(directory, None, 'epydoc-default.sty')
- else:
- raise IOError("Can't find LaTeX style file: %r" % stylesheet)
-
- # Write the stylesheet.
- out = open(os.path.join(directory, filename), 'wb')
- out.write(sty)
- out.close()
-
def _write(self, write_func, directory, filename, *args):
# Display our progress.
self._files_written += 1
@@ -302,9 +278,7 @@
out('\\usepackage[%s]{inputenc}\n' % self.get_latex_encoding())
# If we're generating hyperrefs, add the appropriate packages.
- # !!!!!!!!!!!!!!!!!!!!!!
- # !!! JEG - this needs to be the last thing in the preamble
- # !!!!!!!!!!!!!!!!!!!!!!
+ # Note: this needs to be the last thing in the preamble -JEG
if self._hyperref:
out('\\definecolor{UrlColor}{rgb}{0,0.08,0.45}\n')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 19:06:45
|
Revision: 1758
http://epydoc.svn.sourceforge.net/epydoc/?rev=1758&view=rev
Author: edloper
Date: 2008-02-23 11:06:41 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
- Added some preliminary code for using dot2tex. This feature is not
yet working (and therefore disabled).
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/dotgraph.py
Modified: trunk/epydoc/src/epydoc/docwriter/dotgraph.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2008-02-23 18:31:10 UTC (rev 1757)
+++ trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2008-02-23 19:06:41 UTC (rev 1758)
@@ -28,6 +28,11 @@
from epydoc.util import *
from epydoc.compat import * # Backwards compatibility
+#: Should the dot2tex module be used to render dot graphs to latex
+#: (if it's available)? This is experimental, and not yet working,
+#: so it should be left False for now.
+USE_DOT2TEX = False
+
# colors for graphs of APIDocs
MODULE_BG = '#d8e8ff'
CLASS_BG = '#d8ffe8'
@@ -136,6 +141,15 @@
graph. Two image files will be written: image_file+'.eps'
and image_file+'.pdf'.
"""
+ # Use dot2tex if requested (and if it's available).
+ # Otherwise, render it to an image file & use \includgraphics.
+ if USE_DOT2TEX and dot2tex is not None:
+ try: return self._to_dot2tex(center)
+ except KeyboardInterrupt: raise
+ except:
+ raise
+ log.warning('dot2tex failed; using dot instead')
+
# Render the graph in postscript.
ps = self._run_dot('-Tps')
# Write the postscript output.
@@ -157,6 +171,25 @@
if center: s = '\\begin{center}\n%s\\end{center}\n' % s
return s
+ def _to_dot2tex(self, center=True):
+ # requires: pgf, latex-xcolor.
+ from dot2tex import dot2tex
+ if 0: # DEBUG
+ import logging
+ log = logging.getLogger("dot2tex")
+ log.setLevel(logging.DEBUG)
+ console = logging.StreamHandler()
+ formatter = logging.Formatter('%(levelname)-8s %(message)s')
+ console.setFormatter(formatter)
+ log.addHandler(console)
+ options = dict(crop=True, autosize=True, figonly=True, debug=True)
+ conv = dot2tex.Dot2PGFConv(options)
+ s = conv.convert(self.to_dotfile())
+ conv.dopreproc = False
+ s = conv.convert(s)
+ if center: s = '\\begin{center}\n%s\\end{center}\n' % s
+ return s
+
def to_html(self, image_file, image_url, center=True):
"""
Return the HTML code that should be uesd to display this graph
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 18:31:15
|
Revision: 1757
http://epydoc.svn.sourceforge.net/epydoc/?rev=1757&view=rev
Author: edloper
Date: 2008-02-23 10:31:10 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
- Copy *all* of the epydoc builtin latex style files to the target
directory. This ensures that custom style files (which are now
copied to epydoc-custom.sty) can use \RequirePackage to extend any
of the builtin latex style files; and they can extend one another
as well.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/latex.py
trunk/epydoc/src/epydoc/docwriter/latex_sty.py
Modified: trunk/epydoc/src/epydoc/docwriter/latex.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/latex.py 2008-02-23 17:47:49 UTC (rev 1756)
+++ trunk/epydoc/src/epydoc/docwriter/latex.py 2008-02-23 18:31:10 UTC (rev 1757)
@@ -27,10 +27,10 @@
from epydoc.docwriter.latex_sty import STYLESHEETS
class LatexWriter:
- #: Expects (options,)
+ #: Expects (options, epydoc_sty_package)
PREAMBLE = [
"\\documentclass{article}",
- "\\usepackage[%s]{epydoc}",
+ "\\usepackage[%s]{%s}",
"\\usepackage{graphicx}",
]
@@ -144,7 +144,39 @@
copied to 'epydoc-default.sty', which makes it possible to
reference it via \RequirePackage.
"""
+ # Write all the standard style files
+ for (name, sty) in STYLESHEETS.items():
+ out = open(os.path.join(directory, 'epydoc-%s.sty' % name), 'wb')
+ out.write(sty)
+ out.close()
+
+ # Default: use the 'epydoc-default' style.
if stylesheet is None:
+ self._epydoc_sty_package = 'epydoc-default'
+
+ # Stylesheet name: use the indicated style.
+ elif stylesheet in STYLESHEETS:
+ self._epydoc_sty_package = 'epydoc-%s' % stylesheet
+
+ # Custom user stylesheet: copy the style to epydoc-custom.
+ elif os.path.exists(stylesheet):
+ try: sty = open(stylesheet, 'rb').read()
+ except: raise IOError("Can't open LaTeX style file: %r" %
+ stylesheet)
+ out = open(os.path.join(directory, 'epydoc-custom.sty'), 'wb')
+ out.write(sty)
+ out.close()
+ self._epydoc_sty_package = 'epydoc-custom'
+
+ else:
+ raise IOError("Can't find LaTeX style file: %r" % stylesheet)
+
+ self._write_sty(directory, None, 'epydoc-default.sty')
+
+
+
+
+ if stylesheet is None:
sty = STYLESHEETS['base']
elif os.path.exists(stylesheet):
try: sty = open(stylesheet, 'rb').read()
@@ -263,7 +295,8 @@
options = []
if self._index: options.append('index')
if self._hyperlink: options.append('hyperlink')
- out('\n'.join(self.PREAMBLE) % (','.join(options),) + '\n')
+ out('\n'.join(self.PREAMBLE) % (','.join(options),
+ self._epydoc_sty_package) + '\n')
# Set the encoding.
out('\\usepackage[%s]{inputenc}\n' % self.get_latex_encoding())
Modified: trunk/epydoc/src/epydoc/docwriter/latex_sty.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/latex_sty.py 2008-02-23 17:47:49 UTC (rev 1756)
+++ trunk/epydoc/src/epydoc/docwriter/latex_sty.py 2008-02-23 18:31:10 UTC (rev 1757)
@@ -606,11 +606,11 @@
% $Id:$
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{epydoc}[2007/04/06 v3.0beta1 Epydoc Python Documentation]
-\DeclareOption{index}{\PassOptionsToPackage{index}{epydoc-default}}
-\DeclareOption{hyperlink}{\PassOptionsToPackage{hyperlink}{epydoc-default}}
+\DeclareOption{index}{\PassOptionsToPackage{index}{epydoc-base}}
+\DeclareOption{hyperlink}{\PassOptionsToPackage{hyperlink}{epydoc-base}}
\ProcessOptions\relax
-\RequirePackage{epydoc-default}
+\RequirePackage{epydoc-base}
% Double the standard size boxedminipage outlines.
\setlength{\fboxrule}{2\fboxrule}
@@ -821,11 +821,11 @@
% $Id:$
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{epydoc}[2007/04/06 v3.0beta1 Epydoc Python Documentation]
-\DeclareOption{index}{\PassOptionsToPackage{index}{epydoc-default}}
-\DeclareOption{hyperlink}{\PassOptionsToPackage{hyperlink}{epydoc-default}}
+\DeclareOption{index}{\PassOptionsToPackage{index}{epydoc-base}}
+\DeclareOption{hyperlink}{\PassOptionsToPackage{hyperlink}{epydoc-base}}
\ProcessOptions\relax
-\RequirePackage{epydoc-default}
+\RequirePackage{epydoc-base}
\definecolor{gray95}{gray}{0.95}
\definecolor{gray90}{gray}{0.90}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 17:47:51
|
Revision: 1756
http://epydoc.svn.sourceforge.net/epydoc/?rev=1756&view=rev
Author: edloper
Date: 2008-02-23 09:47:49 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
- Moved code that resolves 'auto' pdfdriver to the write_latex
function.
- 'auto' pdfdriver now selects 'latex' if 'dvi' or 'ps' output are
requested
- if pdfdriver is set to 'pdflatex' and the dvi or ps output are
requested, then signal an error
Modified Paths:
--------------
trunk/epydoc/src/epydoc/cli.py
Modified: trunk/epydoc/src/epydoc/cli.py
===================================================================
--- trunk/epydoc/src/epydoc/cli.py 2008-02-23 17:34:49 UTC (rev 1755)
+++ trunk/epydoc/src/epydoc/cli.py 2008-02-23 17:47:49 UTC (rev 1756)
@@ -534,17 +534,16 @@
optparser.error("Invalid graph type %s. Expected one of: %s." %
(graph_type, ', '.join(GRAPH_TYPES + ('all',))))
- # If pdfdriver is 'auto', then pick a pdf driver.
+ # Check the value of the pdfdriver option; and check for conflicts
+ # between pdfdriver & actions
options.pdfdriver = options.pdfdriver.lower()
if options.pdfdriver not in PDFDRIVERS:
optparser.error("Invalid pdf driver %r. Expected one of: %s" %
(options.pdfdriver, ', '.join(PDF_DRIVERS)))
- if 'pdf' in options.actions and options.pdfdriver=='auto':
- try:
- run_subprocess('pdflatex --version')
- options.pdfdriver = 'pdflatex'
- except RunSubprocessError, e:
- options.pdfdriver = 'latex'
+ if (options.pdfdriver == 'pdflatex' and
+ ('dvi' in options.actions or 'ps' in options.actions)):
+ optparser.error("Use of the pdflatex driver is incompatible "
+ "with generating dvi or ps output.")
# Calculate verbosity.
verbosity = getattr(options, 'verbosity', 0)
@@ -953,10 +952,23 @@
latex_target = options.target['latex']
else:
latex_target = tempfile.mkdtemp()
-
+
+ log.start_progress('Writing LaTeX docs')
+
+ # Choose a pdfdriver if we're generating pdf output.
+ if 'pdf' in options.actions and options.pdfdriver=='auto':
+ if 'dvi' in options.actions or 'ps' in options.actions:
+ options.pdfdriver = 'latex'
+ else:
+ try:
+ run_subprocess('pdflatex --version')
+ options.pdfdriver = 'pdflatex'
+ except RunSubprocessError, e:
+ options.pdfdriver = 'latex'
+ log.info('%r pdfdriver selected' % options.pdfdriver)
+
from epydoc.docwriter.latex import LatexWriter
latex_writer = LatexWriter(docindex, **options.__dict__)
- log.start_progress('Writing LaTeX docs')
latex_writer.write(latex_target)
log.end_progress()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 17:34:54
|
Revision: 1755
http://epydoc.svn.sourceforge.net/epydoc/?rev=1755&view=rev
Author: edloper
Date: 2008-02-23 09:34:49 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
- Replaced ._pdflatex with ._pdfdriver
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/latex.py
Modified: trunk/epydoc/src/epydoc/docwriter/latex.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/latex.py 2008-02-23 16:38:44 UTC (rev 1754)
+++ trunk/epydoc/src/epydoc/docwriter/latex.py 2008-02-23 17:34:49 UTC (rev 1755)
@@ -55,13 +55,10 @@
self._exclude = kwargs.get('exclude', 1)
self._list_submodules = kwargs.get('list_submodules', 1)
self._sty = kwargs.get('sty')
+ self._pdfdriver = kwargs.get('pdfdriver', 'latex')
self._top_section = 2
self._index_functions = 1
self._hyperref = 1
-
- # [xx] check into this:
- self._pdflatex = (kwargs['pdfdriver'] == 'pdflatex')
-
self._graph_types = kwargs.get('graphs', ()) or ()
"""Graphs that we should include in our output."""
@@ -278,10 +275,12 @@
if self._hyperref:
out('\\definecolor{UrlColor}{rgb}{0,0.08,0.45}\n')
- if self._pdflatex:
+ if self._pdfdriver == 'pdflatex':
driver = 'pdftex'
- else:
+ elif self._pdfdriver == 'latex':
driver = 'dvips'
+ else:
+ raise ValueError('bad pdfdriver: %s' % self._pdfdriver)
out('\\usepackage[%s, pagebackref, pdftitle={%s}, '
'pdfcreator={epydoc %s}, bookmarks=true, '
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 16:38:47
|
Revision: 1754
http://epydoc.svn.sourceforge.net/epydoc/?rev=1754&view=rev
Author: edloper
Date: 2008-02-23 08:38:44 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
- Rewrapped lines >80chars
- Removed stale (commented-out) code
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/latex.py
Modified: trunk/epydoc/src/epydoc/docwriter/latex.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/latex.py 2008-02-23 16:37:10 UTC (rev 1753)
+++ trunk/epydoc/src/epydoc/docwriter/latex.py 2008-02-23 16:38:44 UTC (rev 1754)
@@ -540,7 +540,8 @@
# The base class name.
s += ('\\multicolumn{%s}{r}{' % labelwidth)
s += '\\settowidth{\\EpydocBCL}{%s}' % base_name
- s += '\\multirow{2}{\\EpydocBCL}{%s}}\n' % _hyperlink(doc, self._base_name(doc))
+ s += ('\\multirow{2}{\\EpydocBCL}{%s}}\n' %
+ _hyperlink(doc, self._base_name(doc)))
# The vertical bars for other base classes (top half)
for vbar in linespec:
@@ -859,114 +860,6 @@
return '\\TupleArg{%s}' % '\\and '.join([self._arg_name(a)
for a in arg])
-
-# def write_func_list_box(self, out, var_doc):
-# func_doc = var_doc.value
-# is_inherited = (var_doc.overrides not in (None, UNKNOWN))
-
-# out('\\begin{EpydocFunction}%\n')
-# # Function signature.
-# out(self.function_signature(var_doc))
-
-# # nb: this gives the containing section, not a reference
-# # directly to the function.
-# if not is_inherited:
-# out(' %s%%\n' % self.indexterm(func_doc))
-
-# # If we have nothing else to say, then don't create an
-# # \EpydocFunctionInfo environment.
-# if not (func_doc.descr not in (None, UNKNOWN) or
-# func_doc.arg_descrs or func_doc.arg_types or
-# func_doc.return_descr not in (None, UNKNOWN) or
-# func_doc.return_type not in (None, UNKNOWN) or
-# func_doc.exception_descrs not in (None, UNKNOWN, [], ()) or
-# var_doc.overrides not in (None, UNKNOWN) or
-# func_doc.metadata not in (None, UNKNOWN, [], ())):
-# out(' \\end{EpydocFunction}\n\n')
-# return
-
-# out('\\begin{EpydocFunctionInfo}%\n')
-
-# # Description
-# if func_doc.descr not in (None, UNKNOWN):
-# out(' '*4 + '\\begin{EpydocFunctionDescription}\n')
-# out(self.docstring_to_latex(func_doc.descr, 4))
-# out(' '*4 + '\\end{EpydocFunctionDescription}\n')
-
-# # Parameters
-# if func_doc.arg_descrs or func_doc.arg_types:
-# # Find the longest name.
-# longest = max([0]+[len(n) for n in func_doc.arg_types])
-# for names, descrs in func_doc.arg_descrs:
-# longest = max([longest]+[len(n) for n in names])
-# # Table header.
-# out(' '*6+'\\begin{EpydocFunctionParameters}{%s}\n' % (longest*'x'))
-# # Add params that have @type but not @param info:
-# arg_descrs = list(func_doc.arg_descrs)
-# args = set()
-# for arg_names, arg_descr in arg_descrs:
-# args.update(arg_names)
-# for arg in var_doc.value.arg_types:
-# if arg not in args:
-# arg_descrs.append( ([arg],None) )
-# # Display params
-# for (arg_names, arg_descr) in arg_descrs:
-# arg_name = plaintext_to_latex(', '.join(arg_names))
-# out('%s\\item[%s]\n\n' % (' '*10, arg_name))
-# if arg_descr:
-# out(self.docstring_to_latex(arg_descr, 10))
-# # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-# # !!! JEG - this loop needs abstracting
-# # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-# for arg_name in arg_names:
-# arg_typ = func_doc.arg_types.get(arg_name)
-# if arg_typ is not None:
-# if len(arg_names) == 1:
-# lhs = 'type'
-# else:
-# lhs = 'type of %s' % arg_name
-# rhs = self.docstring_to_latex(arg_typ).strip()
-# out('%s{\\it (%s=%s)}\n\n' % (' '*12, lhs, rhs))
-# out(' '*6+'\\end{EpydocFunctionParameters}\n\n')
-
-# # Returns
-# rdescr = func_doc.return_descr
-# rtype = func_doc.return_type
-# if rdescr not in (None, UNKNOWN) or rtype not in (None, UNKNOWN):
-# out(' '*6+'\\EpydocFunctionReturns')
-# if rtype not in (None, UNKNOWN):
-# out('[%s]' % self.docstring_to_latex(rtype, 6).strip())
-# if rdescr not in (None, UNKNOWN):
-# out('{%s}' % self.docstring_to_latex(rdescr, 6))
-# else:
-# out('{}')
-# out('\n\n')
-
-# # Raises
-# if func_doc.exception_descrs not in (None, UNKNOWN, [], ()):
-# out(' '*6+'\\begin{EpydocFunctionRaises}\n')
-# for name, descr in func_doc.exception_descrs:
-# out(' '*10+'\\item[%s]\n\n' %
-# plaintext_to_latex('%s' % name))
-# out(self.docstring_to_latex(descr, 10))
-# out(' '*6+'\\end{EpydocFunctionRaises}\n\n')
-
-# ## Overrides
-# if var_doc.overrides not in (None, UNKNOWN):
-# out('\\EpydocFunctionOverrides')
-# if (func_doc.docstring in (None, UNKNOWN) and
-# var_doc.overrides.value.docstring not in (None, UNKNOWN)):
-# out('[1]')
-# out('{%s}\n\n'
-# % _hyperlink(var_doc.overrides,
-# '%s' % var_doc.overrides.canonical_name))
-
-# # Add version, author, warnings, requirements, notes, etc.
-# self.write_standard_fields(out, func_doc)
-
-# out(' \\end{EpydocFunctionInfo}\n')
-# out(' \\end{EpydocFunction}\n\n')
-
#////////////////////////////////////////////////////////////
#{ Variable Details
#////////////////////////////////////////////////////////////
@@ -1090,6 +983,7 @@
return '\\texttt{%s}' % label
def url_for(self, identifier):
return None
+
_docstring_linker = _LatexDocstringLinker()
def docstring_to_latex(self, docstring, where, indent=0, breakany=0):
@@ -1194,8 +1088,9 @@
raise AssertionError('Bad index position %s' % pos)
if pos in ['only', 'start'] and classCrossRef is not None:
- term += classCrossRef % ('\\EpydocIndex[%s]{%s}' % (self.doc_kind(doc).lower(),
- _dotted('%s'%doc.canonical_name)))
+ term += classCrossRef % ('\\EpydocIndex[%s]{%s}' %
+ (self.doc_kind(doc).lower(),
+ _dotted('%s'%doc.canonical_name)))
return term
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 16:37:16
|
Revision: 1753
http://epydoc.svn.sourceforge.net/epydoc/?rev=1753&view=rev
Author: edloper
Date: 2008-02-23 08:37:10 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
- Fixed bug where graphs in latex would mark nodes as undocumented
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/dotgraph.py
Modified: trunk/epydoc/src/epydoc/docwriter/dotgraph.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2008-02-23 16:24:45 UTC (rev 1752)
+++ trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2008-02-23 16:37:10 UTC (rev 1753)
@@ -1139,8 +1139,10 @@
# Don't do the same class twice.
if base in cls2node: continue
# Make the node.
- if linker.url_for(base) is None: typ = 'undocumented'
- elif base in classes: typ = 'selected'
+ if base in classes: typ = 'selected'
+ elif (hasattr(linker, 'docindex') and
+ linker.docindex.find(identifier, self.container) is None):
+ typ = 'undocumented'
else: typ = 'superclass'
cls2node[base] = mknode(base, typ, linker, context, options)
graph.nodes.append(cls2node[base])
@@ -1425,7 +1427,7 @@
if context is not None:
label = label.contextualize(context.canonical_name)
node = DotGraphNode(label)
- specialize_valdoc_node(node, val_doc, context, linker.url_for(val_doc))
+ specialize_valdoc_node(node, val_doc, context, linker)
return node
NOOP_URL = 'javascript:void(0);'
@@ -1438,7 +1440,7 @@
PORT="body" HREF="%s" TOOLTIP="%s">%s</TD></TR>
</TABLE>'''.strip()
-def specialize_valdoc_node(node, val_doc, context, url):
+def specialize_valdoc_node(node, val_doc, context, linker):
"""
Update the style attributes of `node` to reflext its type
and context.
@@ -1454,9 +1456,12 @@
# Set the URL. (Do this even if it points to the page we're
# currently on; otherwise, the tooltip is ignored.)
+ url = linker.url_for(val_doc)
node['href'] = url or NOOP_URL
-
- if url is None:
+
+ if (url is None and
+ hasattr(linker, 'docindex') and
+ linker.docindex.find(identifier, self.container) is None):
node['fillcolor'] = UNDOCUMENTED_BG
node['style'] = 'filled'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 16:24:47
|
Revision: 1752
http://epydoc.svn.sourceforge.net/epydoc/?rev=1752&view=rev
Author: edloper
Date: 2008-02-23 08:24:45 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
- Supply context info when rendering docstrings to latex
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/latex.py
Modified: trunk/epydoc/src/epydoc/docwriter/latex.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/latex.py 2008-02-23 16:12:43 UTC (rev 1751)
+++ trunk/epydoc/src/epydoc/docwriter/latex.py 2008-02-23 16:24:45 UTC (rev 1752)
@@ -328,7 +328,7 @@
# Add the module's description.
if doc.descr not in (None, UNKNOWN):
out(' '*4 + '\\begin{EpydocModuleDescription}%\n')
- out(self.docstring_to_latex(doc.descr, 4))
+ out(self.docstring_to_latex(doc.descr, doc, 4))
out(' '*4 + '\\end{EpydocModuleDescription}\n')
# Add version, author, warnings, requirements, notes, etc.
@@ -411,7 +411,7 @@
# The class's description.
if doc.descr not in (None, UNKNOWN):
out(' '*4 + '\\begin{EpydocClassDescription}\n')
- out(self.docstring_to_latex(doc.descr))
+ out(self.docstring_to_latex(doc.descr, doc))
out(' '*4 + '\\end{EpydocClassDescription}\n')
# Version, author, warnings, requirements, notes, etc.
@@ -478,7 +478,7 @@
out(' '*depth + '\\item[%s]' % _hyperlink(doc, doc.canonical_name[-1]))
if doc.summary not in (None, UNKNOWN):
- out(' %s\n' % self.docstring_to_latex(doc.summary))
+ out(' %s\n' % self.docstring_to_latex(doc.summary, doc))
out(self.crossref(doc) + '\n\n')
if doc.submodules != UNKNOWN and doc.submodules:
out(' '*depth + ' \\begin{EpydocModuleList}\n')
@@ -600,7 +600,7 @@
out(' ' + '\\item[%s]' % _hyperlink(var_doc.target,
var_doc.name))
if doc.summary not in (None, UNKNOWN):
- out(': %s\n' % self.docstring_to_latex(doc.summary))
+ out(': %s\n' % self.docstring_to_latex(doc.summary, doc))
out(self.crossref(doc) + '\n\n')
#////////////////////////////////////////////////////////////
@@ -733,7 +733,7 @@
# Argument 2: the function description
if func_doc.descr not in (None, UNKNOWN):
- out(self.docstring_to_latex(func_doc.descr, 4))
+ out(self.docstring_to_latex(func_doc.descr, func_doc, 4))
out('}{%\n')
# Argument 3: the function parameter descriptions
@@ -743,12 +743,14 @@
# Argument 4: The return description
if func_doc.return_descr not in (None, UNKNOWN):
- out(self.docstring_to_latex(func_doc.return_descr, 6))
+ out(self.docstring_to_latex(func_doc.return_descr,
+ func_doc, 6))
out('}{%\n')
# Argument 5: The return type
if func_doc.return_type not in (None, UNKNOWN):
- out(self.docstring_to_latex(func_doc.return_type, 6).strip())
+ out(self.docstring_to_latex(func_doc.return_type,
+ func_doc, 6).strip())
out('}{%\n')
# Argument 6: The raises section
@@ -757,7 +759,7 @@
for name, descr in func_doc.exception_descrs:
out(' '*10+'\\item[%s]\n\n' %
plaintext_to_latex('%s' % name))
- out(self.docstring_to_latex(descr, 10))
+ out(self.docstring_to_latex(descr, func_doc, 10))
out(' '*6+'\\end{EpydocFunctionRaises}\n\n')
out('}{%\n')
@@ -798,7 +800,7 @@
arg_name = plaintext_to_latex(', '.join(arg_names))
out('%s\\item[%s]\n\n' % (' '*10, arg_name))
if arg_descr:
- out(self.docstring_to_latex(arg_descr, 10))
+ out(self.docstring_to_latex(arg_descr, func_doc, 10))
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!! JEG - this loop needs abstracting
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -809,7 +811,7 @@
lhs = 'type'
else:
lhs = 'type of %s' % arg_name
- rhs = self.docstring_to_latex(arg_typ).strip()
+ rhs = self.docstring_to_latex(arg_typ, func_doc).strip()
out('%s{\\it (%s=%s)}\n\n' % (' '*12, lhs, rhs))
out(' '*6+'\\end{EpydocFunctionParameters}\n\n')
@@ -978,10 +980,11 @@
out('\\EpydocVariable{%s}{' % _hypertarget(var_doc, var_doc.name))
if has_descr:
- out(self.docstring_to_latex(var_doc.descr, 10).strip())
+ out(self.docstring_to_latex(var_doc.descr, var_doc, 10).strip())
out('}{')
if has_type:
- out(self.docstring_to_latex(var_doc.type_descr, 12).strip())
+ out(self.docstring_to_latex(var_doc.type_descr,
+ var_doc, 12).strip())
out('}{')
if has_repr:
out(var_doc.value.summary_pyval_repr().to_latex(None))
@@ -997,10 +1000,12 @@
has_type = prop_doc.type_descr not in (None, UNKNOWN)
out('\\EpydocProperty{%s}{' % _hypertarget(var_doc, var_doc.name))
if has_descr:
- out(self.docstring_to_latex(prop_doc.descr, 10).strip())
+ out(self.docstring_to_latex(prop_doc.descr,
+ prop_doc, 10).strip())
out('}{')
if has_type:
- out(self.docstring_to_latex(prop_doc.type_descr, 12).strip())
+ out(self.docstring_to_latex(prop_doc.type_descr,
+ prop_doc, 12).strip())
out('}{')
# [xx] What if the accessor is private and show_private=False?
if (prop_doc.fget not in (None, UNKNOWN) and
@@ -1050,7 +1055,7 @@
if arg:
singular += ' (%s)' % arg
plural += ' (%s)' % arg
- out(self._descrlist([self.docstring_to_latex(d) for d in descrs],
+ out(self._descrlist([self.docstring_to_latex(d, doc) for d in descrs],
field.singular, field.plural, field.short))
def _descrlist(self, items, singular, plural=None, short=0):
@@ -1087,7 +1092,7 @@
return None
_docstring_linker = _LatexDocstringLinker()
- def docstring_to_latex(self, docstring, indent=0, breakany=0):
+ def docstring_to_latex(self, docstring, where, indent=0, breakany=0):
if docstring is None: return ''
s = docstring.to_latex(self._docstring_linker, indent=indent,
directory=self._directory,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 16:12:45
|
Revision: 1751
http://epydoc.svn.sourceforge.net/epydoc/?rev=1751&view=rev
Author: edloper
Date: 2008-02-23 08:12:43 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
- Fixed latex bug in SHADED stylesheet
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/latex_sty.py
Modified: trunk/epydoc/src/epydoc/docwriter/latex_sty.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/latex_sty.py 2008-02-23 16:09:47 UTC (rev 1750)
+++ trunk/epydoc/src/epydoc/docwriter/latex_sty.py 2008-02-23 16:12:43 UTC (rev 1751)
@@ -1023,16 +1023,14 @@
\begin{@EpydocGeneralList}}
{\end{@EpydocGeneralList}}
-\renewenvironment{EpydocGroup}[1][]{%
- \ifthenelse{\equal{#1}{}}{}{
+\renewcommand{\EpydocGroup}[1]{
- \begin{cminipage}[gray80]{\dimexpr \linewidth-2\fboxsep \relax}
- {\Large\bf\center #1\\}
- \end{cminipage}
-
- }}
- {}
+ \begin{cminipage}[gray80]{\dimexpr \linewidth-2\fboxsep \relax}
+ {\Large\bf\center #1\\}
+ \end{cminipage}
+ }
+
% This is just like the default definitions, except that we use
% \raggedright, and dedent by \EpydocSectionHeaderDedent
\newlength{\EpydocSectionHeaderDedent}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 16:10:04
|
Revision: 1750
http://epydoc.svn.sourceforge.net/epydoc/?rev=1750&view=rev
Author: edloper
Date: 2008-02-23 08:09:47 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
- Added Jonathan Guyer to the contributors list
Modified Paths:
--------------
trunk/epydoc/src/epydoc/__init__.py
Modified: trunk/epydoc/src/epydoc/__init__.py
===================================================================
--- trunk/epydoc/src/epydoc/__init__.py 2008-02-23 07:02:42 UTC (rev 1749)
+++ trunk/epydoc/src/epydoc/__init__.py 2008-02-23 16:09:47 UTC (rev 1750)
@@ -195,6 +195,7 @@
:contributor: `Simon Pamies <mailto:sp...@bi...>`__
:contributor: `Christian Reis <mailto:ki...@as...>`__
:contributor: `Daniele Varrazzo <mailto:dan...@gm...>`__
+:contributor: `Jonathan Guyer <mailto:gu...@ni...>`__
.. |copy| unicode:: 0xA9 .. copyright sign
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 07:02:44
|
Revision: 1749
http://epydoc.svn.sourceforge.net/epydoc/?rev=1749&view=rev
Author: edloper
Date: 2008-02-22 23:02:42 -0800 (Fri, 22 Feb 2008)
Log Message:
-----------
- Fixed typo from previous checkin
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/dotgraph.py
Modified: trunk/epydoc/src/epydoc/docwriter/dotgraph.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2008-02-23 06:59:20 UTC (rev 1748)
+++ trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2008-02-23 07:02:42 UTC (rev 1749)
@@ -812,7 +812,7 @@
def _get_html_label(self):
# Get the class name & contextualize it.
classname = self.class_doc.canonical_name
- if context is not None:
+ if self.context is not None:
classname = classname.contextualize(self.context.canonical_name)
# If we're collapsed, display the node as a single box.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 06:59:21
|
Revision: 1748
http://epydoc.svn.sourceforge.net/epydoc/?rev=1748&view=rev
Author: edloper
Date: 2008-02-22 22:59:20 -0800 (Fri, 22 Feb 2008)
Log Message:
-----------
- Added dotgraph support to epytext's latex output
- Added dotgraph support to rst's latex output
- DotGrah.to_latex() now writes both the .eps and the .pdf file
(no language switch)
- Fixed bug in dotgraph when context=None
- Fixed bug in dotgraph in call to mk_valdoc_node
- Fixed bug in epytext in graph raising
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/dotgraph.py
trunk/epydoc/src/epydoc/docwriter/latex.py
trunk/epydoc/src/epydoc/markup/epytext.py
trunk/epydoc/src/epydoc/markup/restructuredtext.py
Modified: trunk/epydoc/src/epydoc/docwriter/dotgraph.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2008-02-23 06:01:41 UTC (rev 1747)
+++ trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2008-02-23 06:59:20 UTC (rev 1748)
@@ -130,25 +130,26 @@
self.uid = '%s_%s' % (self.uid, n)
self._uids.add(self.uid)
- def to_latex(self, image_file, language='ps', center=True):
- # Write the image file.
- if language == 'ps':
- self.write(image_file, language='ps')
- elif language == 'pdf':
- ps = self._run_dot('-Tps')
- psfilename = tempfile.mktemp('.ps')
- psfile = open(psfilename, 'wb')
- psfile.write('%!PS-Adobe-2.0 EPSF-1.2\n')
- psfile.write(ps)
- psfile.close()
- try: run_subprocess(('ps2pdf', '-dEPSCrop', psfilename,
- image_file))
- except RunSubprocessError, e:
- log.warning("Unable to render Graphviz dot graph (%s):\n"
+ def to_latex(self, image_file, center=True):
+ """
+ Return the LaTeX code that should be used to display this
+ graph. Two image files will be written: image_file+'.eps'
+ and image_file+'.pdf'.
+ """
+ # Render the graph in postscript.
+ ps = self._run_dot('-Tps')
+ # Write the postscript output.
+ psfile = open(image_file+'.eps', 'wb')
+ psfile.write('%!PS-Adobe-2.0 EPSF-1.2\n')
+ psfile.write(ps)
+ psfile.close()
+ # Use ps2pdf to generate the pdf output.
+ try: run_subprocess(('ps2pdf', '-dEPSCrop', image_file+'.eps',
+ image_file+'.pdf'))
+ except RunSubprocessError, e:
+ log.warning("Unable to render Graphviz dot graph (%s):\n"
"ps2pdf failed." % self.title)
- return None
- else:
- raise ValueError('Expected language to be "ps" or "pdf"')
+ return None
# Generate the latex code to display the graph.
name = os.path.splitext(os.path.split(image_file)[-1])[0]
@@ -811,7 +812,8 @@
def _get_html_label(self):
# Get the class name & contextualize it.
classname = self.class_doc.canonical_name
- classname = classname.contextualize(self.context.canonical_name)
+ if context is not None:
+ classname = classname.contextualize(self.context.canonical_name)
# If we're collapsed, display the node as a single box.
if self.collapsed:
@@ -1414,12 +1416,14 @@
"""
nodes = {}
for val_doc in sorted(val_docs, key=lambda d:d.canonical_name):
- nodes[val_doc] = mk_valdoc_node(graph, val_doc, linker, context)
+ nodes[val_doc] = mk_valdoc_node(val_doc, linker, context)
graph.nodes.append(nodes[val_doc])
return nodes
def mk_valdoc_node(val_doc, linker, context):
- label = val_doc.canonical_name.contextualize(context.canonical_name)
+ label = val_doc.canonical_name
+ if context is not None:
+ label = label.contextualize(context.canonical_name)
node = DotGraphNode(label)
specialize_valdoc_node(node, val_doc, context, linker.url_for(val_doc))
return node
@@ -1488,12 +1492,13 @@
node['style'] = 'filled,bold'
def name_list(api_docs, context=None):
+ names = [d.canonical_name for d in api_docs]
if context is not None:
- context = context.canonical_name
- names = [str(d.canonical_name.contextualize(context)) for d in api_docs]
+ names = [name.contextualize(context.canonical_name) for name in names]
if len(names) == 0: return ''
if len(names) == 1: return '%s' % names[0]
elif len(names) == 2: return '%s and %s' % (names[0], names[1])
else:
+ names = ['%s' % name for name in names]
return '%s, and %s' % (', '.join(names[:-1]), names[-1])
Modified: trunk/epydoc/src/epydoc/docwriter/latex.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/latex.py 2008-02-23 06:01:41 UTC (rev 1747)
+++ trunk/epydoc/src/epydoc/docwriter/latex.py 2008-02-23 06:59:20 UTC (rev 1748)
@@ -359,14 +359,9 @@
def render_graph(self, graph):
if graph is None: return ''
graph.caption = graph.title = None
- if self._pdflatex:
- image_url = '%s.pdf' % graph.uid
- image_file = os.path.join(self._directory, image_url)
- return graph.to_latex(image_file, 'pdf') or ''
- else:
- image_url = '%s.eps' % graph.uid
- image_file = os.path.join(self._directory, image_url)
- return graph.to_latex(image_file, 'ps') or ''
+ image_url = '%s' % graph.uid
+ image_file = os.path.join(self._directory, image_url)
+ return graph.to_latex(image_file) or ''
def write_class(self, out, doc):
if self._list_classes_separately:
@@ -1095,6 +1090,8 @@
def docstring_to_latex(self, docstring, indent=0, breakany=0):
if docstring is None: return ''
s = docstring.to_latex(self._docstring_linker, indent=indent,
+ directory=self._directory,
+ docindex=self.docindex,
hyperref=self._hyperref)
return (' '*indent + '\\begin{EpydocDescription}%\n' +
s.strip() + '%\n' +
Modified: trunk/epydoc/src/epydoc/markup/epytext.py
===================================================================
--- trunk/epydoc/src/epydoc/markup/epytext.py 2008-02-23 06:01:41 UTC (rev 1747)
+++ trunk/epydoc/src/epydoc/markup/epytext.py 2008-02-23 06:59:20 UTC (rev 1748)
@@ -345,10 +345,10 @@
block = ('section', 'fieldlist', 'field', 'ulist', 'olist', 'li')
if have_graph_child and tree.tag not in block:
child_index = 0
+ parent_index = parent.children.index(tree)
for elt in tree.children:
if isinstance(elt, Element) and elt.tag == 'graph':
# We found a graph: splice it into the parent.
- parent_index = parent.children.index(tree)
left = tree.children[:child_index]
right = tree.children[child_index+1:]
parent.children[parent_index:parent_index+1] = [
@@ -357,6 +357,7 @@
Element(tree.tag, *right, **tree.attribs)]
child_index = 0
parent_index += 2
+ tree = parent.children[parent_index]
else:
child_index += 1
@@ -1782,12 +1783,14 @@
docindex, context, indent)
return self._html
- def to_latex(self, docstring_linker, **options):
+ def to_latex(self, docstring_linker, directory=None, docindex=None,
+ context=None, **options):
if self._latex is not None: return self._latex
if self._tree is None: return ''
indent = options.get('indent', 0)
self._hyperref = options.get('hyperref', 1)
- self._latex = self._to_latex(self._tree, docstring_linker, indent)
+ self._latex = self._to_latex(self._tree, docstring_linker, directory,
+ docindex, context, indent)
return self._latex
def to_plaintext(self, docstring_linker, **options):
@@ -1873,6 +1876,7 @@
symbol = tree.children[0]
return self.SYMBOL_TO_HTML.get(symbol, '[%s]' % symbol)
elif tree.tag == 'graph':
+ if directory is None: return ''
# Generate the graph.
graph = self._build_graph(variables[0], variables[1:], linker,
docindex, context)
@@ -1931,8 +1935,8 @@
else:
log.warning("Unknown graph type %s" % graph_type)
-
- def _to_latex(self, tree, linker, indent=0, seclevel=0, breakany=0):
+ def _to_latex(self, tree, linker, directory, docindex, context,
+ indent=0, seclevel=0, breakany=0):
if isinstance(tree, basestring):
return plaintext_to_latex(tree, breakany=breakany)
@@ -1941,7 +1945,8 @@
# Figure out the child indent level.
if tree.tag == 'epytext': cindent = indent
else: cindent = indent + 2
- variables = [self._to_latex(c, linker, cindent, seclevel, breakany)
+ variables = [self._to_latex(c, linker, directory, docindex,
+ context, cindent, seclevel, breakany)
for c in tree.children]
childstr = ''.join(variables)
@@ -2002,8 +2007,14 @@
symbol = tree.children[0]
return self.SYMBOL_TO_LATEX.get(symbol, '[%s]' % symbol)
elif tree.tag == 'graph':
- return '(GRAPH)'
- #raise ValueError, 'graph not implemented yet for latex'
+ if directory is None: return ''
+ # Generate the graph.
+ graph = self._build_graph(variables[0], variables[1:], linker,
+ docindex, context)
+ if not graph: return ''
+ # Write the graph.
+ image_file = os.path.join(directory, graph.uid)
+ return graph.to_latex(image_file)
else:
# Assume that anything else can be passed through.
return childstr
Modified: trunk/epydoc/src/epydoc/markup/restructuredtext.py
===================================================================
--- trunk/epydoc/src/epydoc/markup/restructuredtext.py 2008-02-23 06:01:41 UTC (rev 1747)
+++ trunk/epydoc/src/epydoc/markup/restructuredtext.py 2008-02-23 06:59:20 UTC (rev 1748)
@@ -198,9 +198,11 @@
self._document.walkabout(visitor)
return ''.join(visitor.body)
- def to_latex(self, docstring_linker, **options):
+ def to_latex(self, docstring_linker, directory=None,
+ docindex=None, context=None, **options):
# Inherit docs
- visitor = _EpydocLaTeXTranslator(self._document, docstring_linker)
+ visitor = _EpydocLaTeXTranslator(self._document, docstring_linker,
+ directory, docindex, context)
self._document.walkabout(visitor)
return ''.join(visitor.body).strip()+'\n'
@@ -537,14 +539,15 @@
def latex_head_prefix():
document = new_document('<fake>')
- translator = _EpydocLaTeXTranslator(document, None)
+ translator = _EpydocLaTeXTranslator(document)
return translator.head_prefix
_TARGET_RE = re.compile(r'^(.*?)\s*<(?:URI:|URL:)?([^<>]+)>$')
class _EpydocLaTeXTranslator(LaTeXTranslator):
settings = None
- def __init__(self, document, docstring_linker):
+ def __init__(self, document, docstring_linker=None, directory=None,
+ docindex=None, context=None):
# Set the document's settings.
if self.settings is None:
settings = OptionParser([LaTeXWriter()]).get_default_values()
@@ -554,6 +557,9 @@
LaTeXTranslator.__init__(self, document)
self._linker = docstring_linker
+ self._directory = directory
+ self._docindex = docindex
+ self._context = context
# Start at section level 3. (Unfortunately, we now have to
# set a private variable to make this work; perhaps the standard
@@ -574,12 +580,18 @@
def visit_document(self, node): pass
def depart_document(self, node): pass
- # For now, just ignore dotgraphs. [XXX]
def visit_dotgraph(self, node):
- log.warning("Ignoring dotgraph in latex output (dotgraph "
- "rendering for latex not implemented yet).")
+ if self._directory is None: raise SkipNode() # [xx] warning?
+
+ # Generate the graph.
+ graph = node.graph(self._docindex, self._context, self._linker)
+ if graph is None: raise SkipNode()
+
+ # Write the graph.
+ image_file = os.path.join(self._directory, graph.uid)
+ self.body.append(graph.to_latex(image_file))
raise SkipNode()
-
+
def visit_doctest_block(self, node):
self.body.append(doctest_to_latex(node[0].astext()))
raise SkipNode()
@@ -672,11 +684,11 @@
**attributes)
def visit_dotgraph(self, node):
- if self._directory is None: return # [xx] warning?
+ if self._directory is None: raise SkipNode() # [xx] warning?
# Generate the graph.
graph = node.graph(self._docindex, self._context, self._linker)
- if graph is None: return
+ if graph is None: raise SkipNode()
# Write the graph.
image_url = '%s.gif' % graph.uid
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 06:01:48
|
Revision: 1747
http://epydoc.svn.sourceforge.net/epydoc/?rev=1747&view=rev
Author: edloper
Date: 2008-02-22 22:01:41 -0800 (Fri, 22 Feb 2008)
Log Message:
-----------
- --graph=classtree and --graph=umlclasstree are now supported by
the latex writer.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/latex.py
Modified: trunk/epydoc/src/epydoc/docwriter/latex.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/latex.py 2008-02-23 06:00:30 UTC (rev 1746)
+++ trunk/epydoc/src/epydoc/docwriter/latex.py 2008-02-23 06:01:41 UTC (rev 1747)
@@ -31,6 +31,7 @@
PREAMBLE = [
"\\documentclass{article}",
"\\usepackage[%s]{epydoc}",
+ "\\usepackage{graphicx}",
]
SECTIONS = ['\\part{%s}', '\\chapter{%s}', '\\section{%s}',
@@ -59,7 +60,7 @@
self._hyperref = 1
# [xx] check into this:
- self._pdflatex = kwargs.get('action', '') == "pdflatex"
+ self._pdflatex = (kwargs['pdfdriver'] == 'pdflatex')
self._graph_types = kwargs.get('graphs', ()) or ()
"""Graphs that we should include in our output."""
@@ -334,7 +335,8 @@
self.write_standard_fields(out, doc)
# If it's a package, list the sub-modules.
- if self._list_submodules and doc.submodules != UNKNOWN and doc.submodules:
+ if (self._list_submodules and doc.submodules !=
+ UNKNOWN and doc.submodules):
self.write_module_list(out, doc)
# Contents.
@@ -358,14 +360,13 @@
if graph is None: return ''
graph.caption = graph.title = None
if self._pdflatex:
- return graph.to_dot2tex()
-## image_url = '%s.ps' % graph.uid
-## image_file = os.path.join(self._directory, image_url)
-## return graph.to_pdf(image_file, image_url)
+ image_url = '%s.pdf' % graph.uid
+ image_file = os.path.join(self._directory, image_url)
+ return graph.to_latex(image_file, 'pdf') or ''
else:
image_url = '%s.eps' % graph.uid
image_file = os.path.join(self._directory, image_url)
- return graph.to_latex(image_file, image_url)
+ return graph.to_latex(image_file, 'ps') or ''
def write_class(self, out, doc):
if self._list_classes_separately:
@@ -391,12 +392,10 @@
(doc.subclasses not in (UNKNOWN,None) and len(doc.subclasses)>0)):
# Display bases graphically, if requested.
if 'umlclasstree' in self._graph_types:
-## linker = self._LatexDocstringLinker()
graph = uml_class_tree_graph(doc, self._docstring_linker, doc)
out(self.render_graph(graph))
elif 'classtree' in self._graph_types:
-## linker = self._LatexDocstringLinker()
graph = class_tree_graph([doc], self._docstring_linker, doc)
out(self.render_graph(graph))
@@ -407,11 +406,12 @@
if doc.bases not in (UNKNOWN, None) and len(doc.bases) > 0:
out(self.base_tree(doc))
- # The class's known subclasses
- if doc.subclasses not in (UNKNOWN, None) and len(doc.subclasses) > 0:
- sc_items = [_hyperlink(sc, '%s' % sc.canonical_name)
- for sc in doc.subclasses]
- out(self._descrlist(sc_items, 'Known Subclasses', short=1))
+ # The class's known subclasses
+ if (doc.subclasses not in (UNKNOWN, None) and
+ len(doc.subclasses) > 0):
+ sc_items = [_hyperlink(sc, '%s' % sc.canonical_name)
+ for sc in doc.subclasses]
+ out(self._descrlist(sc_items, 'Known Subclasses', short=1))
# The class's description.
if doc.descr not in (None, UNKNOWN):
@@ -1088,23 +1088,8 @@
def translate_identifier_xref(self, identifier, label=None):
if label is None: label = markup.plaintext_to_latex(identifier)
return '\\texttt{%s}' % label
- # [xx] Should this be added to the DocstringLinker interface???
- # Currently, this is *only* used by dotgraph.
def url_for(self, identifier):
return None
-## if isinstance(identifier, (basestring, DottedName)):
-## doc = self.docindex.find(identifier, self.container)
-## if doc:
-## return identifier
-## else:
-## return None
-##
-## elif isinstance(identifier, APIDoc):
-## return ':'.join(identifier.canonical_name)
-## doc = identifier
-##
-## else:
-## raise TypeError('Expected string or APIDoc')
_docstring_linker = _LatexDocstringLinker()
def docstring_to_latex(self, docstring, indent=0, breakany=0):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 06:00:31
|
Revision: 1746
http://epydoc.svn.sourceforge.net/epydoc/?rev=1746&view=rev
Author: edloper
Date: 2008-02-22 22:00:30 -0800 (Fri, 22 Feb 2008)
Log Message:
-----------
- Added url_for() to the DocstringLinker interface
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/html.py
trunk/epydoc/src/epydoc/markup/__init__.py
Modified: trunk/epydoc/src/epydoc/docwriter/html.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/html.py 2008-02-23 05:59:54 UTC (rev 1745)
+++ trunk/epydoc/src/epydoc/docwriter/html.py 2008-02-23 06:00:30 UTC (rev 1746)
@@ -3487,8 +3487,6 @@
else:
return self.htmlwriter.href(doc, label, 'link')
- # [xx] Should this be added to the DocstringLinker interface???
- # Currently, this is *only* used by dotgraph.
def url_for(self, identifier):
if isinstance(identifier, (basestring, DottedName)):
doc = self.docindex.find(identifier, self.container)
Modified: trunk/epydoc/src/epydoc/markup/__init__.py
===================================================================
--- trunk/epydoc/src/epydoc/markup/__init__.py 2008-02-23 05:59:54 UTC (rev 1745)
+++ trunk/epydoc/src/epydoc/markup/__init__.py 2008-02-23 06:00:30 UTC (rev 1746)
@@ -474,6 +474,14 @@
"""
raise NotImplementedError, 'DocstringLinker.translate_xref()'
+ def url_for(self, identifier):
+ """
+ Given an identifier, return a URL pointing at that identifier.
+ This is used to create hyperlinks in dotgraphs.
+ """
+ raise NotImplementedError, 'DocstringLinker.url_for()'
+
+
##################################################
## ParseError exceptions
##################################################
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 05:59:56
|
Revision: 1745
http://epydoc.svn.sourceforge.net/epydoc/?rev=1745&view=rev
Author: edloper
Date: 2008-02-22 21:59:54 -0800 (Fri, 22 Feb 2008)
Log Message:
-----------
- Add latex support for dotgraphs
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/dotgraph.py
Modified: trunk/epydoc/src/epydoc/docwriter/dotgraph.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2008-02-23 05:19:30 UTC (rev 1744)
+++ trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2008-02-23 05:59:54 UTC (rev 1745)
@@ -22,6 +22,7 @@
import re
import sys
+import tempfile
from epydoc import log
from epydoc.apidoc import *
from epydoc.util import *
@@ -129,6 +130,32 @@
self.uid = '%s_%s' % (self.uid, n)
self._uids.add(self.uid)
+ def to_latex(self, image_file, language='ps', center=True):
+ # Write the image file.
+ if language == 'ps':
+ self.write(image_file, language='ps')
+ elif language == 'pdf':
+ ps = self._run_dot('-Tps')
+ psfilename = tempfile.mktemp('.ps')
+ psfile = open(psfilename, 'wb')
+ psfile.write('%!PS-Adobe-2.0 EPSF-1.2\n')
+ psfile.write(ps)
+ psfile.close()
+ try: run_subprocess(('ps2pdf', '-dEPSCrop', psfilename,
+ image_file))
+ except RunSubprocessError, e:
+ log.warning("Unable to render Graphviz dot graph (%s):\n"
+ "ps2pdf failed." % self.title)
+ return None
+ else:
+ raise ValueError('Expected language to be "ps" or "pdf"')
+
+ # Generate the latex code to display the graph.
+ name = os.path.splitext(os.path.split(image_file)[-1])[0]
+ s = ' \\includegraphics{%s}\n' % name
+ if center: s = '\\begin{center}\n%s\\end{center}\n' % s
+ return s
+
def to_html(self, image_file, image_url, center=True):
"""
Return the HTML code that should be uesd to display this graph
@@ -633,6 +660,7 @@
successful.
"""
# Use the type string to look up a corresponding ValueDoc.
+ if not hasattr(self.linker, 'docindex'): return False
type_doc = self.linker.docindex.find(type_str, var)
if not type_doc: return False
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 05:19:32
|
Revision: 1744
http://epydoc.svn.sourceforge.net/epydoc/?rev=1744&view=rev
Author: edloper
Date: 2008-02-22 21:19:30 -0800 (Fri, 22 Feb 2008)
Log Message:
-----------
- Use custom admonition environment for reStructuredText admonitions
(warning, note, etc)
Modified Paths:
--------------
trunk/epydoc/src/epydoc/markup/restructuredtext.py
Modified: trunk/epydoc/src/epydoc/markup/restructuredtext.py
===================================================================
--- trunk/epydoc/src/epydoc/markup/restructuredtext.py 2008-02-23 05:00:43 UTC (rev 1743)
+++ trunk/epydoc/src/epydoc/markup/restructuredtext.py 2008-02-23 05:19:30 UTC (rev 1744)
@@ -584,6 +584,13 @@
self.body.append(doctest_to_latex(node[0].astext()))
raise SkipNode()
+ def visit_admonition(self, node, name=''):
+ self.body.append('\\begin{reSTadmonition}[%s]\n' %
+ self.language.labels[name])
+
+ def depart_admonition(self, node=None):
+ self.body.append('\\end{reSTadmonition}\n');
+
class _EpydocHTMLTranslator(HTMLTranslator):
settings = None
def __init__(self, document, docstring_linker, directory,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 05:00:47
|
Revision: 1743
http://epydoc.svn.sourceforge.net/epydoc/?rev=1743&view=rev
Author: edloper
Date: 2008-02-22 21:00:43 -0800 (Fri, 22 Feb 2008)
Log Message:
-----------
- Minor changes to progress messages for latex output
Modified Paths:
--------------
trunk/epydoc/src/epydoc/cli.py
Modified: trunk/epydoc/src/epydoc/cli.py
===================================================================
--- trunk/epydoc/src/epydoc/cli.py 2008-02-23 04:54:23 UTC (rev 1742)
+++ trunk/epydoc/src/epydoc/cli.py 2008-02-23 05:00:43 UTC (rev 1743)
@@ -996,21 +996,22 @@
os.remove('api.%s' % ext)
for latex_command in latex_commands:
+ LaTeX = latex_command.replace('latex', 'LaTeX')
# The first pass generates index files.
running = latex_command
- log.progress(step/steps, 'LaTeX: First pass')
+ log.progress(step/steps, '%s (First pass)' % LaTeX)
step += 1
run_subprocess('%s api.tex' % latex_command)
# Build the index.
running = 'makeindex'
- log.progress(step/steps, 'LaTeX: Build index')
+ log.progress(step/steps, '%s (Build index)' % LaTeX)
step += 1
run_subprocess('makeindex api.idx')
# The second pass generates our output.
running = latex_command
- log.progress(step/steps, 'LaTeX: Second pass')
+ log.progress(step/steps, '%s (Second pass)' % LaTeX)
step += 1
out, err = run_subprocess('%s api.tex' % latex_command)
@@ -1018,13 +1019,13 @@
# changed what page some things are on.
running = latex_command
if _RERUN_LATEX_RE.match(out):
- log.progress(step/steps, 'LaTeX: Third pass')
+ log.progress(step/steps, '%s (Third pass)' % LaTeX)
out, err = run_subprocess('%s api.tex' % latex_command)
# A fourth path should (almost?) never be necessary.
running = latex_command
if _RERUN_LATEX_RE.match(out):
- log.progress(step/steps, 'LaTeX: Fourth pass')
+ log.progress(step/steps, '%s (Fourth pass)' % LaTeX)
run_subprocess('%s api.tex' % latex_command)
step += 1
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 04:54:25
|
Revision: 1742
http://epydoc.svn.sourceforge.net/epydoc/?rev=1742&view=rev
Author: edloper
Date: 2008-02-22 20:54:23 -0800 (Fri, 22 Feb 2008)
Log Message:
-----------
- Added --help sty
Modified Paths:
--------------
trunk/epydoc/src/epydoc/cli.py
Modified: trunk/epydoc/src/epydoc/cli.py
===================================================================
--- trunk/epydoc/src/epydoc/cli.py 2008-02-23 04:50:41 UTC (rev 1741)
+++ trunk/epydoc/src/epydoc/cli.py 2008-02-23 04:54:23 UTC (rev 1742)
@@ -75,6 +75,7 @@
from epydoc.compat import *
import ConfigParser
from epydoc.docwriter.html_css import STYLESHEETS as CSS_STYLESHEETS
+from epydoc.docwriter.latex_sty import STYLESHEETS as STY_STYLESHEETS
# This module is only available if Docutils are in the system
try:
@@ -117,6 +118,9 @@
'\n'.join([' %10s: %s' % (key, descr)
for (key, (sheet, descr))
in CSS_STYLESHEETS.items()])),
+ 'sty': textwrap.dedent(
+ 'The following built-in LaTeX style files are available:\n' +
+ ', '.join(STY_STYLESHEETS)),
#'checks': textwrap.dedent('''\
#
# '''),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 04:50:46
|
Revision: 1741
http://epydoc.svn.sourceforge.net/epydoc/?rev=1741&view=rev
Author: edloper
Date: 2008-02-22 20:50:41 -0800 (Fri, 22 Feb 2008)
Log Message:
-----------
- Added --pdfdriver option, which selects whether pdf output should
be generated via pdflatex or latex->dvips->ps2pdf. The default,
'auto', will use pdflatex if it's available; and latex otherwise.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/cli.py
Modified: trunk/epydoc/src/epydoc/cli.py
===================================================================
--- trunk/epydoc/src/epydoc/cli.py 2008-02-23 02:02:57 UTC (rev 1740)
+++ trunk/epydoc/src/epydoc/cli.py 2008-02-23 04:50:41 UTC (rev 1741)
@@ -89,6 +89,7 @@
PROFILER = 'profile' #: Which profiler to use: 'hotshot' or 'profile'
TARGET_ACTIONS = ('html', 'latex', 'dvi', 'ps', 'pdf')
DEFAULT_ACTIONS = ('html',)
+PDFDRIVERS = ('pdflatex', 'latex', 'auto')
######################################################################
#{ Help Topics
@@ -145,7 +146,8 @@
fail_on=None, exclude=[], exclude_parse=[], exclude_introspect=[],
external_api=[], external_api_file=[], external_api_root=[],
redundant_details=False, src_code_tab_width=8, verbosity=0,
- include_timestamp=True, target={}, default_target=None)
+ include_timestamp=True, target={}, default_target=None,
+ pdfdriver='auto')
# append_const is not defined in py2.3 or py2.4, so use a callback
# instead, with the following function:
@@ -330,6 +332,14 @@
help="The LaTeX style file. LATEXSTYLE can be either a "
"builtin style file or the name of a .sty file.")
+ output_group.add_option("--pdfdriver",
+ dest="pdfdriver", metavar="DRIVER",
+ help="The command sequence that should be used to render "
+ "pdf output. \"pdflatex\" will generate the pdf directly "
+ "using pdflatex. \"latex\" will generate the pdf using "
+ "latex, dvips, and ps2pdf in succession. \"auto\" will use "
+ "pdflatex if available, and latex otherwise.")
+
output_group.add_option("--url", "-u",
dest="prj_url", metavar="URL",
help="The documented project's URL (for the navigation bar).")
@@ -520,6 +530,18 @@
optparser.error("Invalid graph type %s. Expected one of: %s." %
(graph_type, ', '.join(GRAPH_TYPES + ('all',))))
+ # If pdfdriver is 'auto', then pick a pdf driver.
+ options.pdfdriver = options.pdfdriver.lower()
+ if options.pdfdriver not in PDFDRIVERS:
+ optparser.error("Invalid pdf driver %r. Expected one of: %s" %
+ (options.pdfdriver, ', '.join(PDF_DRIVERS)))
+ if 'pdf' in options.actions and options.pdfdriver=='auto':
+ try:
+ run_subprocess('pdflatex --version')
+ options.pdfdriver = 'pdflatex'
+ except RunSubprocessError, e:
+ options.pdfdriver = 'latex'
+
# Calculate verbosity.
verbosity = getattr(options, 'verbosity', 0)
options.verbosity = verbosity + options.verbose - options.quiet
@@ -593,6 +615,10 @@
options.prj_name = val
elif optname == 'css':
options.css = val
+ elif optname == 'sty':
+ options.sty = val
+ elif optname == 'pdfdriver':
+ options.pdfdriver = val
elif optname == 'url':
options.prj_url = val
elif optname == 'link':
@@ -929,8 +955,13 @@
log.start_progress('Writing LaTeX docs')
latex_writer.write(latex_target)
log.end_progress()
-
- if 'pdf' in options.actions: steps = 6
+
+ # Decide how many steps we need to go through.
+ if 'pdf' in options.actions:
+ if options.pdfdriver == 'latex': steps = 6
+ elif 'ps' in options.actions: steps = 8
+ elif 'dvi' in options.actions: steps = 7
+ else: steps = 4
elif 'ps' in options.actions: steps = 5
elif 'dvi' in options.actions: steps = 4
else:
@@ -938,10 +969,19 @@
# output format, then we're done.
assert 'latex' in options.actions
return
-
+
+ # Decide whether we need to run latex, pdflatex, or both.
+ if options.pdfdriver == 'latex':
+ latex_commands = ['latex']
+ elif 'dvi' in options.actions or 'ps' in options.actions:
+ latex_commands = ['latex', 'pdflatex']
+ else:
+ latex_commands = ['pdflatex']
+
log.start_progress('Processing LaTeX docs')
oldpath = os.path.abspath(os.curdir)
running = None # keep track of what we're doing.
+ step = 0.
try:
try:
os.chdir(latex_target)
@@ -951,44 +991,52 @@
if os.path.exists('api.%s' % ext):
os.remove('api.%s' % ext)
- # The first pass generates index files.
- running = 'latex'
- log.progress(0./steps, 'LaTeX: First pass')
- run_subprocess('latex api.tex')
+ for latex_command in latex_commands:
+ # The first pass generates index files.
+ running = latex_command
+ log.progress(step/steps, 'LaTeX: First pass')
+ step += 1
+ run_subprocess('%s api.tex' % latex_command)
+
+ # Build the index.
+ running = 'makeindex'
+ log.progress(step/steps, 'LaTeX: Build index')
+ step += 1
+ run_subprocess('makeindex api.idx')
+
+ # The second pass generates our output.
+ running = latex_command
+ log.progress(step/steps, 'LaTeX: Second pass')
+ step += 1
+ out, err = run_subprocess('%s api.tex' % latex_command)
+
+ # The third pass is only necessary if the second pass
+ # changed what page some things are on.
+ running = latex_command
+ if _RERUN_LATEX_RE.match(out):
+ log.progress(step/steps, 'LaTeX: Third pass')
+ out, err = run_subprocess('%s api.tex' % latex_command)
+
+ # A fourth path should (almost?) never be necessary.
+ running = latex_command
+ if _RERUN_LATEX_RE.match(out):
+ log.progress(step/steps, 'LaTeX: Fourth pass')
+ run_subprocess('%s api.tex' % latex_command)
+ step += 1
- # Build the index.
- running = 'makeindex'
- log.progress(1./steps, 'LaTeX: Build index')
- run_subprocess('makeindex api.idx')
-
- # The second pass generates our output.
- running = 'latex'
- log.progress(2./steps, 'LaTeX: Second pass')
- out, err = run_subprocess('latex api.tex')
-
- # The third pass is only necessary if the second pass
- # changed what page some things are on.
- running = 'latex'
- if _RERUN_LATEX_RE.match(out):
- log.progress(3./steps, 'LaTeX: Third pass')
- out, err = run_subprocess('latex api.tex')
-
- # A fourth path should (almost?) never be necessary.
- running = 'latex'
- if _RERUN_LATEX_RE.match(out):
- log.progress(3./steps, 'LaTeX: Fourth pass')
- run_subprocess('latex api.tex')
-
# If requested, convert to postscript.
- if 'ps' in options.actions or 'pdf' in options.actions:
+ if ('ps' in options.actions or
+ ('pdf' in options.actions and options.pdfdriver=='latex')):
running = 'dvips'
- log.progress(4./steps, 'dvips')
+ log.progress(step/steps, 'dvips')
+ step += 1
run_subprocess('dvips api.dvi -o api.ps -G0 -Ppdf')
# If requested, convert to pdf.
- if 'pdf' in options.actions:
+ if 'pdf' in options.actions and options.pdfdriver=='latex':
running = 'ps2pdf'
- log.progress(5./steps, 'ps2pdf')
+ log.progress(step/steps, 'ps2pdf')
+ step += 1
run_subprocess(
'ps2pdf -sPAPERSIZE#letter -dMaxSubsetPct#100 '
'-dSubsetFonts#true -dCompatibilityLevel#1.2 '
@@ -1006,7 +1054,7 @@
shutil.copy2('api.pdf', dst)
except RunSubprocessError, e:
- if running == 'latex':
+ if running in ('latex', 'pdflatex'):
e.out = re.sub(r'(?sm)\A.*?!( LaTeX Error:)?', r'', e.out)
e.out = re.sub(r'(?sm)\s*Type X to quit.*', '', e.out)
e.out = re.sub(r'(?sm)^! Emergency stop.*', '', e.out)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 02:02:59
|
Revision: 1740
http://epydoc.svn.sourceforge.net/epydoc/?rev=1740&view=rev
Author: edloper
Date: 2008-02-22 18:02:57 -0800 (Fri, 22 Feb 2008)
Log Message:
-----------
- Fixed misspelling
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/latex_sty.py
Modified: trunk/epydoc/src/epydoc/docwriter/latex_sty.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/latex_sty.py 2008-02-23 01:59:26 UTC (rev 1739)
+++ trunk/epydoc/src/epydoc/docwriter/latex_sty.py 2008-02-23 02:02:57 UTC (rev 1740)
@@ -12,7 +12,7 @@
#: A disclaimer that is appended to the bottom of the BASE and
#: BOXES stylesheets.
NIST_DISCLAIMER = r"""
-% This style file is a derivite work, based on a public domain style
+% 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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 01:59:28
|
Revision: 1739
http://epydoc.svn.sourceforge.net/epydoc/?rev=1739&view=rev
Author: edloper
Date: 2008-02-22 17:59:26 -0800 (Fri, 22 Feb 2008)
Log Message:
-----------
- A demonstration of the output generated by epydoc's latex writer
Added Paths:
-----------
trunk/epydoc/doc/epydoc-latex-demo.tex
Added: trunk/epydoc/doc/epydoc-latex-demo.tex
===================================================================
--- trunk/epydoc/doc/epydoc-latex-demo.tex (rev 0)
+++ trunk/epydoc/doc/epydoc-latex-demo.tex 2008-02-23 01:59:26 UTC (rev 1739)
@@ -0,0 +1,524 @@
+% epydoc -- Demo & description of latex writer output
+%
+% Copyright (C) 2008 Edward Loper
+% Author: Edward Loper <ed...@lo...>
+% URL: <http://epydoc.sf.net>
+%
+% $Id: apidoc.py 1729 2008-02-19 16:49:16Z edloper $
+
+% This is the basic preamble that's always included (in the api.tex file).
+% If any reStructuredText docstrings are used, then it is extended using
+% the preamble material used by reStructuredText.
+\documentclass{article}
+\usepackage[index]{epydoc}
+\usepackage[utf8]{inputenc}
+\definecolor{UrlColor}{rgb}{0,0.08,0.45}
+\usepackage[pdftex, pagebackref, pdftitle={API Documentation}, pdfcreator={epydoc 3.0.1}, bookmarks=true, bookmarksopen=false, pdfpagemode=UseOutlines, colorlinks=true, linkcolor=black, anchorcolor=black, citecolor=black, filecolor=black, menucolor=black, pagecolor=black, urlcolor=UrlColor]{hyperref}
+\begin{document}
+
+\title{Epydoc LaTeX Writer Output Demo}
+\author{}
+\date{}
+\maketitle
+
+This file provides a demonstration and description of epydoc's LaTeX
+output. Most of the important information is in the comments, so you
+should read this file in its original form (and not as a rendered pdf).
+By looking at this file, and at the epydoc-default.sty file, you should
+be able to determine how to write your own customized style file.
+
+% ======================================================================
+
+\section{General Formatting}
+
+\subsection{Hyperlinks and Crossreferences}
+
+% The \EpydocDottedName command is used to escape dotted names. In
+% particular, it escapes underscores (_) and allows non-hyphenated
+% wrapping at '.' separator characters.
+\EpydocDottedName{my_module.Zip}
+
+% The \EpydocHypertarget command is used to mark targets that hyperlinks
+% may point to. It takes two arguments: a target label, and text
+% contents. (In some cases, the text contents will be empty.) Target
+% labels are formed by replacing '.'s in the name with ':'s. The
+% default stylesheet creates a \label for the target label, and displays
+% the text.
+\EpydocHypertarget{foo:bar:baz}{\EpydocDottedName{foo.bar.baz}}
+
+% The \EpydocHyperlink command is used to create a link to a given target.
+% It takes two arguments: a target label, and text contents. The
+% default stylesheet just displays the text contents.
+\EpydocHyperlink{foo:bar:baz}{\EpydocDottedName{foo.bar.baz}}
+
+% The \CrossRef command creates a cross-reference to a given target,
+% including a pageref. It takes one argument, a target label.
+\CrossRef{foo:bar:baz}
+
+\subsection{Indexing}
+
+% The \EpydocIndex command is used to mark items that should be included
+% in the index. It takes one optional argument, specifying the 'kind'
+% of the object, and one required argument, the term that should be
+% included in the index. (This command is used inside the \index
+% command.) kind can be Package, Script, Module, Class, Class Method,
+% Static Method, Method, Function, or Variable.
+\index{\EpydocIndex[Script]{\EpydocDottedName{fooble}}}
+
+\subsection{Source Code Syntax Highlighting}
+
+% Doctest blocks are colorized using a variety of commands, all beginning
+% with the prefix "\pysrc". See epydoc-default.sty for a full list.
+\begin{alltt}
+\pysrcprompt{{\textgreater}{\textgreater}{\textgreater} }f(x)
+\pysrcoutput{123}\end{alltt}
+
+\subsection{reStructuredText Admonitions}
+
+% These would be defined by rst's style file:
+\newlength{\admonitionwidth}
+\setlength{\admonitionwidth}{.8\textwidth}
+
+% The reSTadmonition environment is used to display reStructuredText
+% admonitions, such as ``..warning::'' and ``..note::''. It takes
+% one optional argument, the admonition type.
+\begin{reSTadmonition}[note]
+ This is a note.
+\end{reSTadmonition}
+
+% ======================================================================
+
+% Each module is listed in its own section. (These sections are created
+% as separate files, and \include-ed into the main api.tex file). The
+% section contains:
+% - The module description (from the module's docstring)
+% - A metadata section (author, version, warnings, etc)
+% - A list of submodules (if it's a package)
+% - A list of classes defined by the module (only if the
+% --list-classes-separately option is used).
+% - A subsection describing the functions defined by the module.
+% - A subsection describing the variables defined by the module.
+% - A subsection for each class defined by the module (only if
+% the --list-classes-separately option is *not* used).
+\section{my\_module}
+
+ % The EpydocModuleDescription environment is used to mark the
+ % module's description (from its docstring)
+ \begin{EpydocModuleDescription}
+ This is an example module, used to demonstrate the LaTeX commands and
+ environments used by epydoc.
+ \end{EpydocModuleDescription}
+
+ % Each metadata item is listed separately. There are three environments
+ % and commands used for metadata:
+ % - The \EpydocMetadataSingleValue command is used to display a metadata
+ % field with a single value. It takes two arguments: the metadata
+ % field name and the metadata description.
+ % - The \EpydocMetadataShortList environment is used to display a
+ % metadata field with multiple values when the field declares that
+ % short=True; i.e., that multiple values should be combined into a
+ % single comma-delimited list. It takes one argument (the metadata
+ % field name); and items should be separated by the \and command.
+ % - The \EpydocMetadataLongList environment is used to display a
+ % metadata field with multiple values when the field declares that
+ % short=False; i.e., that multiple values should be listed
+ % separately in a bulleted list. It takes one argument (the metadata
+ % field name); and items should marked wit hthe \item command.
+ \EpydocMetadataSingleValue{See Also}{some reference.}
+
+ \begin{EpydocMetadataShortList}{Author}
+ joe \and mary
+ \end{EpydocMetadataShortList}
+
+ \begin{EpydocMetadataLongList}{Notes}
+ \item This is one note.
+ \item This is a second note.
+ \end{EpydocMetadataLongList}
+
+ % The list of submodules that a package contains is put it its own
+ % subsection. The list is displayed using the EpydocModuleList
+ % environment. Nested submodules are displayed using nested
+ % EpydocModuleList environments. If the modules are divided into
+ % groups (with the epydoc @group field), then groups are displayed
+ % using the \EpydocGroup command, followed by a nested EpydocModuleList.
+ \subsection{Submodules}
+ \begin{EpydocModuleList}
+ \item[\EpydocHyperlink{my_module:foo}{\EpydocDottedName{my_module.foo}}]
+ Description of my\_module.foo.
+ \item[\EpydocHyperlink{my_module:bar}{\EpydocDottedName{my_module.bar}}]
+ Description of my\_module.bar.
+ \begin{EpydocModuleList}
+ \item[\EpydocHyperlink{my_module:bar:soap}
+ {\EpydocDottedName{my_module.bar.soap}}]
+ Description of my\_module.bar.soap.
+ \end{EpydocModuleList}
+ \EpydocGroup{Some Group}
+ \begin{EpydocModuleList}
+ \item[\EpydocHyperlink{my_module:baz}
+ {\EpydocDottedName{my_module.baz}}]
+ Description of my\_module.baz.
+ \end{EpydocModuleList}
+ \end{EpydocModuleList}
+
+ % The list of classes that a module contains is just like the list
+ % of submodules that a package contains, except that the list
+ % environment EpydocClassList and the command \EpydocGroup
+ % are used. (Note that this list is only included when the
+ % --list-classes-separately option is used.)
+ \subsection{Classes}
+ \begin{EpydocClassList}
+ \item[\EpydocHyperlink{my_module:Zip}
+ {\EpydocDottedName{my_module.Zipasdkfjsdflsd}}]
+ Description of my\_module.Zip.
+ \item[\EpydocHyperlink{my_module:Zap}
+ {\EpydocDottedName{my_module.Zap}}]
+ Description of my\_module.Zap.
+ \EpydocGroup{Some Group}
+ \begin{EpydocClassList}
+ \item[\EpydocHyperlink{my_module:Zam}
+ {\EpydocDottedName{my_module.Zam}}]
+ Description of my\_module.Zam.
+ \item[\EpydocHyperlink{my_module:Zam}
+ {\EpydocDottedName{my_module.Zam}}]
+ Description of my\_module.Zam.
+ \end{EpydocClassList}
+ \end{EpydocClassList}
+
+ % The functions that a module contains are listed in a separate
+ % subsection. This subsection contains a single EpydocFunctionList
+ % environment
+ \subsection{Functions}
+
+ % The EpydocFunctionList environment is used to display functions.
+ % It contains one \EpydocFunction command for each function. This
+ % command takes 8 arguments:
+ %
+ % - The function's signature: an EpydocFunctionSignature environment
+ % specifying the signature for the function.
+ %
+ % - The function's description (from the docstring)
+ %
+ % - The function's parameters: An EpydocFunctionParameters list
+ % environment providing descriptions of the function's parameters.
+ % (from the epydoc @param, @arg, @kwarg, @vararg, @type fields)
+ %
+ % - The function's return description (from the epydoc @rerturns field)
+ %
+ % - The function's return type (from the epydoc @rtype field)
+ %
+ % - The function's exceptions: An EpydocFunctionRaises list
+ % environment describing exceptions that the function may raise
+ % (from the epydoc @raises field)
+ %
+ % - The function's override: An EpydocFunctionOverrides command
+ % describing the method that this function overrides (if any)
+ %
+ % - The function's metadata: Zero or more EpydocMetadata*
+ % commands/environments, taken from metadata fields (eg @author)
+ %
+ % All arguments except for the first (the signature) may be empty.
+ %
+ \begin{EpydocFunctionList}
+
+ \EpydocFunction{
+ % Argument 1: The function signature
+ %
+ % The EpydocFunctionSignature is used to display a function's
+ % signature. It expects one argument, the function's name. The
+ % body of the environment containd the parameter list. The
+ % following commands are used in the parameter list, to mark
+ % individual parameters:
+ % - \Param: Takes one required argument (the parameter name) and
+ % one optional argument (the defaultt value).
+ % - \VarArg: Takes one argument (the varargs parameter name)
+ % - \KWArg: Takes one argument (the keyword parameter name)
+ % - \GenericArg: Takes no arguments (this is used for '...', e.g.
+ % when the signature is unknown).
+ % - \TupleArg: Used inside of the \Param command, to mark
+ % argument tuples. Individual elements of the argument tuple
+ % are separated by the \and command.
+ %
+ % Parameters are separated by the \and command.
+ \begin{EpydocFunctionSignature}{myfunc}%
+ \Param{x}%
+ \and \Param{y}%
+ \and \Param{i}%
+ \and \Param{j}%
+ \and \Param{\TupleArg{a \and b}}%
+ \and \VarArg{rest}, \KWArg{keywords}%
+ \end{EpydocFunctionSignature}
+ }{
+ % Argument 2: The function description
+ This is an example function.
+ }{
+ % Argument 3: The function parameter descriptions
+ %
+ % The EpydocFunctionParameters list environment is used to
+ % describe the function's parameters. It takes a single
+ % required argument, a string which can be used to set the
+ % label width for the list. (I.e., this string is as long
+ % as the longest parameter name.) The list contains one
+ % \item for each parameter description. Parameter types
+ % are currently listed as part of the text (not using any
+ % special environments or commands)
+ \begin{EpydocFunctionParameters}{xxxxxxxx}
+ \item[x] Description of parameter x.
+
+ (type=int)
+
+ \item[i, j] Description of parameters x and y.
+
+ \item[keywords] Description of the keywords parameter.
+ \end{EpydocFunctionParameters}
+ }{
+ % Argument 4: The function return value description
+ description of the return value
+ }{
+ % Argument 5: The function return value tupe
+ int
+ }{
+ % Argument 6: The function exception descriptions
+ %
+ % The EpydocRaises list environment is used to display the
+ % list of exceptions that the function may raise. The list
+ % contains one \item for each exception.
+ \begin{EpydocFunctionRaises}
+ \item[ValueError] If there's some problem with a value.
+ \item[TypeError] If the wrong type is given.
+ \end{EpydocFunctionRaises}
+ }{
+ % Argument 7: The function overrides command
+ %
+ % (this is only used for methods, not functions)
+ }{
+ % Argument 8: The function metadta
+ %
+ % The metadata section uses the same commands that the module-
+ % level metadata section uses; see the discussion above.
+ \EpydocMetadataSingleValue{See Also}{some reference.}
+
+ \begin{EpydocMetadataShortList}{Author}
+ joe \and mary
+ \end{EpydocMetadataShortList}
+
+ \begin{EpydocMetadataLongList}{Notes}
+ \item This is one note.
+ \item This is a second note.
+ \end{EpydocMetadataLongList}
+ }
+
+ % If functions are divided into groups (with the epydoc @group
+ % field), then group headers are marked with the \EpydocGropu
+ % command.
+ \EpydocGroup{Some Group}
+
+ \EpydocFunction{
+ \begin{EpydocFunctionSignature}{\EpydocDottedName{some_func}}
+ \Param{x} \and \Param{y} \and \Param{z}
+ \end{EpydocFunctionSignature}}
+ {}{}{}{}{}{}{}
+
+ \end{EpydocFunctionList}
+
+ % The variables that a module contains are listed in a separate
+ % subsection. This section contains a single EpydocVariableList
+ % environment
+ \subsection{Variables}
+
+ % The EpydocVariableList environment is used to describe module
+ % variables. It contains one \EpydocVariable command for each
+ % variable. This command takes four required arguments:
+ %
+ % - The variable's name
+ % - The variable's description (from the docstring)
+ % - The variable's type (from the epydoc @type field)
+ % - The variable's value
+ %
+ % If any of these arguments is not available, then the empty
+ % string will be used.
+ %
+ % If the variables are divided into groups (with the epydoc @group
+ % field), then the \EpydocInternalHeader command is used to mark
+ % the beginning of each variable group.
+ \begin{EpydocVariableList}
+ \EpydocVariable{\EpydocHyperlink{my_module:gorp}
+ {\EpydocDottedName{my_module.gorp}}}
+ {Description of the variable gorp}
+ {int}
+ {12}
+ \EpydocVariable{\EpydocHyperlink{my_module:moo}
+ {\EpydocDottedName{my_module.moo}}}
+ {Description of the variable moo}
+ {str}
+ {'hello'}
+ \EpydocVariable{\EpydocHyperlink{my_module:cow}
+ {\EpydocDottedName{my_module.cow}}}
+ {} % no description
+ {} % no type
+ {} % no value
+ \end{EpydocVariableList}
+
+ % The remaineder of the module's section consists of one subsection
+ % for each class defined by the module. (However, if the
+ % --list-classes-separately option is used, then these subsections
+ % are not generated; instead, epydoc will generate a separate
+ % top-level section for each class.) Each class section contains:
+ % - The class's base tree (or a class tree graph, if the options
+ % "--graph classtree" or "--graph umlclasstree" are used).
+ % - A list of known subclasses.
+ % - The class description (from the class's docstring)
+ % - A metadata section (author, version, warnings, etc)
+ % - A list of methods defined by the class
+ % - A list of properties defined by the class
+ % - A list of class variables defined by the class
+ % - A list of instance variables defined by the class
+ \subsection{Class \EpydocDottedName{Zip}}
+
+ % The base tree is 'drawn' using a carefully constructed tabular
+ % environment. Here's an example of what it can look like:
+ \begin{tabular}{cccccc}
+ \multicolumn{2}{r}{
+ \settowidth{\EpydocBCL}{\EpydocDottedName{MyBaseClass}}
+ \multirow{2}{\EpydocBCL}{\EpydocHyperlink{object}
+ {\EpydocDottedName{MyBaseClass}}}}
+ && \\
+ \cline{3-3}
+ &&\multicolumn{1}{c|}{} && \\
+ &&\multicolumn{2}{l}{\textbf{\EpydocDottedName{my_module.Zip}}}
+ \end{tabular}
+
+ % The known subclasses are displayed using an \EpydocMetadataSingleValue
+ % command or an \EpydocMetadataShortList environment. See the
+ % description of these above (for module metadata).
+ \begin{EpydocMetadataShortList}{Known Subclasses}
+ \EpydocHyperlink{my_module:Zap}{\EpydocDottedName{my_module.zap}}
+ \and
+ \EpydocHyperlink{my_module:Zam}{\EpydocDottedName{my_module.zam}}
+ \end{EpydocMetadataShortList}
+
+ % The EpydocClassDescription environment is used to mark the
+ % class's description (from its docstring)
+ \begin{EpydocClassDescription}
+ This is an example class, used to demonstrate the LaTeX commands and
+ environments used by epydoc.
+ \end{EpydocClassDescription}
+
+ % The metadata section uses the same commands that the module-
+ % level metadata section uses; see the discussion above.
+ \EpydocMetadataSingleValue{See Also}{some reference.}
+
+ \begin{EpydocMetadataShortList}{Author}
+ joe \and mary
+ \end{EpydocMetadataShortList}
+
+ % The methods that a class defines are listed in a separate
+ % subsubsection. This subsubsection contains a single
+ % EpydocFunctionList environment.
+ \subsubsection{Methods}
+
+ % The EpydocFunction environment was described above (when it was
+ % used with module-level functions.) The only difference here is
+ % that functions may optionally include a command specifying
+ % what method is overridden by this method (\EpydocFunctionOverrides)
+ % as the seventh argument to the \EpydocFunction command.
+ \begin{EpydocFunctionList}
+ \EpydocFunction{
+ \begin{EpydocFunctionSignature}{mymethod}
+ \Param{x} \and \Param{y}
+ \end{EpydocFunctionSignature}}
+ {This is an example function.}
+ {}{}{}{}
+ {
+ % The \EpydocFunctionOverrides command specifies which method
+ % was overridden by this method. It comes just before the
+ % metadata section. It takes one optional argument, which will
+ % be "1" if documentation was inherited from the overridden
+ % method; and one required argument, containing the name of
+ % the overridden method.
+ \EpydocFunctionOverrides[1]{\EpydocHyperlink{MyBaseClass:mymethod}
+ {\EpydocDottedName{MyBaseClass.mymethod}}}
+ }{}
+ \end{EpydocFunctionList}
+
+ % The properties that a class defines are listed in a separate
+ % subsection. This section contains a single EpydocPropertyList
+ % environment.
+ \subsubsection{Properties}
+
+ % The EpydocPropertyList environment is used to describe class
+ % properties. It contains one \EpydocProperty command for each
+ % property. This command takes six required arguments:
+ %
+ % - The property's name
+ % - The property's description (from the docstring)
+ % - The property's type (from the epydoc @type field)
+ % - The property's fget function
+ % - The property's fset function
+ % - The property's fdel function
+ %
+ % If any of these arguments is not available, then the empty
+ % string will be used.
+ %
+ % If the properties are divided into groups (with the epydoc @group
+ % field), then the \EpydocInternalHeader command is used to mark
+ % the beginning of each property group.
+ %
+ % If any properties are inherited from a base class, and if
+ % --inheritance=listed (the default), then they will be listed
+ % after all the other properties, using the
+ % \EpydocInheritanceList command. This command will be used
+ % once for each base class that properties are inherited from.
+ % It takes two arguments: the name of the base class that the
+ % properties were inherited from, and a list of property names.
+ \begin{EpydocPropertyList}
+ \EpydocProperty{\EpydocHyperlink{my_module:Zip:duck}
+ {\EpydocDottedName{duck}}}
+ {Description of the property duck}
+ {int}
+ {\EpydocDottedName{get_dock}}
+ {\EpydocDottedName{set_dock}}
+ {\EpydocDottedName{del_dock}}
+ \EpydocInheritanceList{MyBaseClass}{goose, pig}
+ \end{EpydocPropertyList}
+
+ % The class variabless that a class defines are listed in a
+ % separate subsection. This section contains a single
+ % EpydocClassVariableList environment.
+ \subsubsection{Class Variables}
+
+ % The EpydocClassVariableList environment is used the same way as
+ % the EpydocVariableList environment (shown above), with one
+ % exception: if any variables are inherited from a base class,
+ % and if--inheritance=listed (the default), then they will be
+ % listed after all the other properties, using the
+ % \EpydocInheritanceList command. This command will be used
+ % once for each base class that variabless are inherited from.
+ % It takes two arguments: the name of the base class that the
+ % properties were inherited from, and a list of property names.
+ \begin{EpydocClassVariableList}
+ \EpydocVariable{\EpydocHyperlink{my_module:Zip:quack}
+ {\EpydocDottedName{my_module.Zip.quack}}}
+ {Description of the class variable quack}
+ {str} % type
+ {} % no value
+ \EpydocInheritanceList{MyBaseClass}{oink, bark}
+ \end{EpydocClassVariableList}
+
+ % The instance variabless that a instance defines are listed in a
+ % separate subsection. This section contains a single
+ % EpydocInstanceVariableList environment.
+ \subsubsection{Instance Variables}
+
+ % The EpydocInstanceVariableList environment is used the same
+ % way as the EpydocClassVariableList environment (shown above).
+ \begin{EpydocClassVariableList}
+ \EpydocVariable{\EpydocHyperlink{my_module:Zip:florp}
+ {\EpydocDottedName{my_module.Zip.flrop}}}
+ {Description of the class variable florp}
+ {list} % type
+ {} % no value
+ \EpydocInheritanceList{MyBaseClass}{blorp}
+ \end{EpydocClassVariableList}
+
+% That's all, folks!
+\end{document}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ed...@us...> - 2008-02-23 01:59:02
|
Revision: 1738
http://epydoc.svn.sourceforge.net/epydoc/?rev=1738&view=rev
Author: edloper
Date: 2008-02-22 17:59:00 -0800 (Fri, 22 Feb 2008)
Log Message:
-----------
- Fixed a bug in EpydocClassList
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/latex_sty.py
Modified: trunk/epydoc/src/epydoc/docwriter/latex_sty.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/latex_sty.py 2008-02-23 01:07:47 UTC (rev 1737)
+++ trunk/epydoc/src/epydoc/docwriter/latex_sty.py 2008-02-23 01:59:00 UTC (rev 1738)
@@ -252,7 +252,7 @@
% This list environment is used to list the classes that are defined
% by a module.
\newenvironment{EpydocClassList}{%
- \newcommand{\EpydocGroup}[1]{\item[##1] \
+ \renewcommand{\EpydocGroup}[1]{\item[##1] \
}
\begin{itemize}
\renewcommand{\makelabel}[1]{\textbf{##1:}}
@@ -268,7 +268,7 @@
%
% - The function's signature: an EpydocFunctionSignature environment
% specifying the signature for the function.
-
+%
% - The function's description (from the docstring)
%
% - The function's parameters: An EpydocFunctionParameters list
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|