fixed bug with autodoc, manual updated with table description and tests description
This commit is contained in:
parent
b5dea7456b
commit
9cd379b800
3 changed files with 52 additions and 8 deletions
|
|
@ -949,6 +949,40 @@ file, so they have no comment translated for them.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
<b>Whitespaces and tables</b><br>
|
||||||
|
Whitespaces are preserved when translating comments, so it makes
|
||||||
|
sense to have Doxygen comments formatted in a readable way. This
|
||||||
|
includes tables, where tags <th>, <td> and </tr>are translated
|
||||||
|
to '|'. The line after line with <th> tags contains dashes.
|
||||||
|
If we take care about whitespaces, comments in Python are much more
|
||||||
|
readable. Example:
|
||||||
|
|
||||||
|
<div class="code"><pre>
|
||||||
|
/**
|
||||||
|
* <table border = '1'>
|
||||||
|
* <caption>Animals</caption>
|
||||||
|
* <tr><th> Column 1 </th><th> Column 2 </th></tr>
|
||||||
|
* <tr><td> cow </td><td> dog </td></tr>
|
||||||
|
* <tr><td> cat </td><td> mouse </td></tr>
|
||||||
|
* <tr><td> horse </td><td> parrot </td></tr>
|
||||||
|
* </table>
|
||||||
|
*/
|
||||||
|
</pre></div>
|
||||||
|
<p/>
|
||||||
|
translates to Python as:
|
||||||
|
<p/>
|
||||||
|
<div class="targetlang"><pre>
|
||||||
|
Animals
|
||||||
|
| Column 1 | Column 2 |
|
||||||
|
-----------------------
|
||||||
|
| cow | dog |
|
||||||
|
| cat | mouse |
|
||||||
|
| horse | parrot |
|
||||||
|
</pre></div>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<b>Overloaded functions</b><br>
|
||||||
Since all the overloaded functions in c++ are wrapped into one Python
|
Since all the overloaded functions in c++ are wrapped into one Python
|
||||||
function, PyDoc translator will combine every comment of every
|
function, PyDoc translator will combine every comment of every
|
||||||
overloaded function and put it in the comment for wrapping function.
|
overloaded function and put it in the comment for wrapping function.
|
||||||
|
|
@ -957,7 +991,7 @@ If you intend to use resulting proxy files with Doxygen docs
|
||||||
generator, rather than PyDoc, you may want to turn off translator
|
generator, rather than PyDoc, you may want to turn off translator
|
||||||
completely (doxygen:notranslate feature). Then SWIG will just copy
|
completely (doxygen:notranslate feature). Then SWIG will just copy
|
||||||
the comments to the proxy file and reformat them if needed, but all
|
the comments to the proxy file and reformat them if needed, but all
|
||||||
the comment content will be left as is. As Doxygen don't support
|
the comment content will be left as is. As Doxygen doesn't support
|
||||||
special commands in Python comments
|
special commands in Python comments
|
||||||
(see <a href="http://www.stack.nl/~dimitri/doxygen/docblocks.html#pythonblocks">Doxygen
|
(see <a href="http://www.stack.nl/~dimitri/doxygen/docblocks.html#pythonblocks">Doxygen
|
||||||
docs</a>), you may want to use some tool like doxypy
|
docs</a>), you may want to use some tool like doxypy
|
||||||
|
|
@ -1458,6 +1492,16 @@ check-python-test-suite'. To run them individually, type
|
||||||
Examples/test-suite/java $ make doxygen_misc_constructs.cpptest -s
|
Examples/test-suite/java $ make doxygen_misc_constructs.cpptest -s
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
If test fails, both expected and translated comments are printed to
|
||||||
|
std out, but also written to files <i>expected.txt</i>
|
||||||
|
and <I>got.txt</I>. Since it is often difficult to find a single
|
||||||
|
character difference in several lines of text, we can use some diff
|
||||||
|
tool, for example:
|
||||||
|
<pre>
|
||||||
|
Examples/test-suite/java $ kdiff3 expected.txt got.txt
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
Runtime tests in Java are implemented using JavaDoc doclets. To make that work, you
|
Runtime tests in Java are implemented using JavaDoc doclets. To make that work, you
|
||||||
|
|
|
||||||
|
|
@ -182,10 +182,10 @@ int function(int a, float b)
|
||||||
*
|
*
|
||||||
* <table border = '1'>
|
* <table border = '1'>
|
||||||
* <caption>Animals</caption>
|
* <caption>Animals</caption>
|
||||||
<tr><th> Column 1 </th><th> Column 2 </th></tr>
|
* <tr><th> Column 1 </th><th> Column 2 </th></tr>
|
||||||
<tr><td> cow </td><td> dog </td></tr>
|
* <tr><td> cow </td><td> dog </td></tr>
|
||||||
<tr><td> cat </td><td> mouse </td></tr>
|
* <tr><td> cat </td><td> mouse </td></tr>
|
||||||
<tr><td> horse </td><td> parrot </td></tr>
|
* <tr><td> horse </td><td> parrot </td></tr>
|
||||||
* </table>
|
* </table>
|
||||||
*
|
*
|
||||||
* <TT>Starts a piece of text displayed in a typewriter font.
|
* <TT>Starts a piece of text displayed in a typewriter font.
|
||||||
|
|
|
||||||
|
|
@ -1257,13 +1257,13 @@ public:
|
||||||
//
|
//
|
||||||
// otherwise, put it all on a single line
|
// otherwise, put it all on a single line
|
||||||
//
|
//
|
||||||
// All comments translated from doxygen are given as raw stringr (prefix "r"),
|
// All comments translated from doxygen are given as raw strings (prefix "r"),
|
||||||
// because '\' is used often in comments, but may break Python module from
|
// because '\' is used often in comments, but may break Python module from
|
||||||
// loading. For example, in doxy comment one may write path in quotes:
|
// loading. For example, in doxy comment one may write path in quotes:
|
||||||
//
|
//
|
||||||
// This is path to file "C:\x\file.txt"
|
// This is path to file "C:\x\file.txt"
|
||||||
//
|
//
|
||||||
// Python will no load the module with such comment becaue of illegal
|
// Python will no load the module with such comment because of illegal
|
||||||
// escape '\x'. '\' may additionally appear in verbatim or htmlonly sections
|
// escape '\x'. '\' may additionally appear in verbatim or htmlonly sections
|
||||||
// of doxygen doc, Latex expressions, ...
|
// of doxygen doc, Latex expressions, ...
|
||||||
if (have_auto && have_ds) { // Both autodoc and docstring are present
|
if (have_auto && have_ds) { // Both autodoc and docstring are present
|
||||||
|
|
@ -1281,7 +1281,7 @@ public:
|
||||||
doc = NewStringf("%s%s%s", triple_double, autodoc, triple_double);
|
doc = NewStringf("%s%s%s", triple_double, autodoc, triple_double);
|
||||||
} else {
|
} else {
|
||||||
doc = NewString("");
|
doc = NewString("");
|
||||||
Printv(doc, "r", triple_double, "\n", pythoncode(autodoc, indent), indent, triple_double, NIL);
|
Printv(doc, triple_double, "\n", pythoncode(autodoc, indent), indent, triple_double, NIL);
|
||||||
}
|
}
|
||||||
} else if (have_doxygen) { // the lowest priority
|
} else if (have_doxygen) { // the lowest priority
|
||||||
doc = NewString("");
|
doc = NewString("");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue