Re: [Epydoc-devel] Docstring parsing shortcomings
Brought to you by:
edloper
From: Hans M. <me...@in...> - 2007-05-15 12:09:31
|
Hi! Am Dienstag, 15. Mai 2007 13:45:52 schrieb Daniele Varrazzo: > To overcome this problem, i suggest you to add a module variable > "__docformat__ = 'restructuredtext'" in your modules and to run epydoc with > the "--docformat=plaintext" option. This way docstrings in boost-generated > modules will not be parsed as reST. Hehe, but I *want* to parse reST in the extension module. I will use the attached patch for now. That could be the right position to add further BPL (boost::python library) support, like the following: sig_re = _SIGNATURE_RE boost_signature_pos = doc_source.docstring.find("C++ signature:\n ") if boost_signature_pos >= 0: boost_signature = doc_source.docstring[boost_signature_pos+19:] doc_source.docstring = doc_source.docstring[:boost_signature_pos] sig_re = _BOOST_SIGNATURE_RE # _SIGNATURE_RE + type support m = sig_re.match(doc_source.docstring) ... Alas, there is one important case which I did not think about yet: Overloaded functions get multiple signatures appended: 'norm(vector)\nmagnitude(vector)\n\nCalculate the L2 norm / length of a vector (or scalar).\nC++ signature:\n norm(vigra::PythonVectorView<float> vector) -> float\nC++ signature:\n norm(double) -> double\nC++ signature: \n norm(vigra::TinyVector<double, 2>) -> double\nC++ signature:\n norm(vigra::TinyVector<double, 3>) -> double\nC++ signature:\n norm(vigra::TinyVector<double, 4>) -> double' -- Ciao, / / /--/ / / ANS |