[Epydoc-commits] SF.net SVN: epydoc: [1418] trunk/epydoc/src/epydoc/markup/restructuredtext. py
Brought to you by:
edloper
From: <ed...@us...> - 2007-01-17 23:45:22
|
Revision: 1418 http://svn.sourceforge.net/epydoc/?rev=1418&view=rev Author: edloper Date: 2007-01-17 15:45:21 -0800 (Wed, 17 Jan 2007) Log Message: ----------- In response to feedback from the folks at scipy, I modified the syntax for consolidated fields slightly. Now, the argument names are no longer required to be marked by backticks. I.e., instead of: :Arguments: `x` : int Description of x... you can now just write: :Arguments: x : int Description of x... Modified Paths: -------------- trunk/epydoc/src/epydoc/markup/restructuredtext.py Modified: trunk/epydoc/src/epydoc/markup/restructuredtext.py =================================================================== --- trunk/epydoc/src/epydoc/markup/restructuredtext.py 2007-01-17 21:41:59 UTC (rev 1417) +++ trunk/epydoc/src/epydoc/markup/restructuredtext.py 2007-01-17 23:45:21 UTC (rev 1418) @@ -314,6 +314,14 @@ @ivar fields: The fields of the most recently walked document. @type fields: C{list} of L{Field<markup.Field>} """ + + ALLOW_UNMARKED_ARG_IN_CONSOLIDATED_FIELD = True + """If true, then consolidated fields are not required to mark + arguments with C{`backticks`}. (This is currently only + implemented for consolidated fields expressed as definition lists; + consolidated fields expressed as unordered lists still require + backticks for now.""" + def __init__(self, document, errors): NodeVisitor.__init__(self, document) self._errors = errors @@ -425,7 +433,7 @@ child = fbody[0][0] if child.data[:1] in ':-': child.data = child.data[1:].lstrip() - elif child.data[:2] == ' -': + elif child.data[:2] in (' -', ' :'): child.data = child.data[2:].lstrip() # Wrap the field body, and add a new field @@ -446,7 +454,9 @@ raise ValueError('bad definition list (bad child %d).' % n) if len(item) > 3: raise ValueError(_BAD_ITEM % n) - if item[0][0].tagname != 'title_reference': + if not ((item[0][0].tagname == 'title_reference') or + (self.ALLOW_UNMARKED_ARG_IN_CONSOLIDATED_FIELD and + isinstance(item[0][0], docutils.nodes.Text))): raise ValueError(_BAD_ITEM % n) for child in item[0][1:]: if child.astext() != '': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |