[Epydoc-commits] SF.net SVN: epydoc: [1615] trunk/epydoc/src/epydoc/docwriter/latex.py
Brought to you by:
edloper
From: <ed...@us...> - 2007-09-23 14:08:42
|
Revision: 1615 http://epydoc.svn.sourceforge.net/epydoc/?rev=1615&view=rev Author: edloper Date: 2007-09-23 07:08:40 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - If a param has a @type but no @param, then make sure it still gets listed in the function's details section. - Fixed sf bug 1720374 -- latex failed if type descr contained a newline, since \textit{...} is not allowed to include para breaks. (switched to use {\it ...} instead.) Also fixed some related bugs (e.g., by replacing \texttt{...} with {\tt ...}). Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/latex.py Modified: trunk/epydoc/src/epydoc/docwriter/latex.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/latex.py 2007-09-23 13:49:51 UTC (rev 1614) +++ trunk/epydoc/src/epydoc/docwriter/latex.py 2007-09-23 14:08:40 UTC (rev 1615) @@ -653,13 +653,20 @@ out(' '*6+'\\textbf{Parameters}\n') out(' '*6+'\\begin{quote}\n') out(' \\begin{Ventry}{%s}\n\n' % (longest*'x')) - # Params that have @type but not @param info: - unseen_types = set(func_doc.arg_types) - # List everything that has a @param: - for (arg_names, arg_descr) in func_doc.arg_descrs: + # 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)) - out(self.docstring_to_latex(arg_descr, 10)) + if arg_descr: + out(self.docstring_to_latex(arg_descr, 10)) for arg_name in arg_names: arg_typ = func_doc.arg_types.get(arg_name) if arg_typ is not None: @@ -668,7 +675,7 @@ else: lhs = 'type of %s' % arg_name rhs = self.docstring_to_latex(arg_typ).strip() - out('%s\\textit{(%s=%s)}\n\n' % (' '*12, lhs, rhs)) + out('%s{\\it (%s=%s)}\n\n' % (' '*12, lhs, rhs)) out(' \\end{Ventry}\n\n') out(' '*6+'\\end{quote}\n\n') out(' \\vspace{1ex}\n\n') @@ -682,7 +689,7 @@ if rdescr not in (None, UNKNOWN): out(self.docstring_to_latex(rdescr, 6)) if rtype not in (None, UNKNOWN): - out(' '*6+'\\textit{(type=%s)}\n\n' % + out(' '*6+'{\\it (type=%s)}\n\n' % self.docstring_to_latex(rtype, 6).strip()) elif rtype not in (None, UNKNOWN): out(self.docstring_to_latex(rtype, 6)) @@ -745,7 +752,7 @@ def func_arg(self, name, default): s = '\\textit{%s}' % plaintext_to_latex(self._arg_name(name)) if default is not None: - s += '=\\texttt{%s}' % default.summary_pyval_repr().to_latex(None) + s += '={\\tt %s}' % default.summary_pyval_repr().to_latex(None) return s def _arg_name(self, arg): @@ -829,7 +836,7 @@ var_doc.value.summary_pyval_repr().to_latex(None)) if has_type: ptype = self.docstring_to_latex(var_doc.type_descr, 12).strip() - out('%s\\textit{(type=%s)}' % (' '*12, ptype)) + out('%s{\\it (type=%s)}' % (' '*12, ptype)) out('&\\\\\n') out('\\cline{1-2}\n') @@ -847,7 +854,7 @@ if has_type: out('\n\n') if has_type: ptype = self.docstring_to_latex(prop_doc.type_descr, 12).strip() - out('%s\\textit{(type=%s)}' % (' '*12, ptype)) + out('%s{\\it (type=%s)}' % (' '*12, ptype)) # [xx] List the fget/fset/fdel functions? out('&\\\\\n') out('\\cline{1-2}\n') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |