Commit Graph

20 Commits

Author SHA1 Message Date
Vadim Zeitlin f57b096c92 Fix generated Python code for Doxygen comments with triple quotes
In addition to the changes in the previous commit, also avoid syntax
errors in the generated Python docstrings by splitting them into several
parts if there are 3 quotes in a row in the input, as it's impossible to
have them inside triple-quoted strings, generally speaking (i.e. if
there are occurrences of both """ and ''' inside the string).
2020-03-04 00:57:31 +01:00
Vadim Zeitlin b81cd1bdab Fix generated Python code for Doxygen comments ending with quote
Single-line Doxygen comments ending with a double quote resulted in
syntactically-invalid Python docstrings in the output, so use triple
single quotes as delimiters in this case to avoid it.
2020-03-04 00:56:27 +01:00
John McFarland fd33bdf8a5 Flag optional arguments in doxygen pydoc output
If the parameter has a default value, add the string ", optional" to
the parameter type description in the translated python comments.
Three examples with default values were already present in the test
cases, so their expected python output has been updated accordingly.
2019-08-07 16:42:39 -05:00
Dmitry D. Chernov fa5f519bf9 Test-suite: Unify string quoting in the Python sources 2019-07-14 12:58:21 +10:00
William S Fulton 8234656497 Correct python example headers 2018-05-25 23:35:28 +01:00
William S Fulton 95caf87596 PEP8 conformance for comment verifier module 2018-05-25 07:56:45 +01:00
Vadim Zeitlin 148bcab7a0 Switch Python Doxygen unit tests to use inspect.getdoc()
Using the standard inspect module instead of accessing __doc__ directly allows
the tests to pass both when using and not using -builtin, as whitespace-only
differences between the docstrings don't matter then because inspect.getdoc()
removes the indentation and the leading and trailing spaces.

This is similar to what had been already done for python_docstring unit test
in fa282b3540.
2016-12-12 01:26:05 +01:00
Vadim Zeitlin 45ecc9cb84 Fix trimming whitespace from Doxygen comments.
Also trim the string (making it empty) if it consists solely of whitespace.
2015-02-17 00:10:37 +01:00
Vadim Zeitlin 410b508e9a Don't indent Doxygen doc strings in generated Python code.
This is unnecessary and inconsistent with "builtin" case in which the
docstrings are not indented in the generated C++ code, thus making it
impossible to write tests working in both cases.

Most of the changes in this commit simply remove the extra whitespace from the
expected values in the tests.
2014-12-15 13:59:17 +01:00
Vadim Zeitlin 8b83976f4c Fix arguments of @param, @return etc translations to Python.
For the parameter documentation to be really taken as such, in its entirety,
by Sphinx, it must be indented relative to the :param: tag. Do this by
appending an extra indent after every line of the output and work around the
unnecessary indent of the last line by removing the trailing whitespace.

This required updating the existing tests and removing the expected but not
present any more whitespace from them, but as trailing whitespace in the
documentation is at best insignificant (and at worst harmful) anyhow, this is
not a big price to pay for simpler translator code.
2014-08-22 17:45:22 +02:00
Vadim Zeitlin 14ba3b8dd4 Preserve relative indentation when parsing Doxygen comments.
This is important to preserve the structure of the lists which appear
correctly in Python output without any additional effort if the indentation is
lost.

It is also makes the behaviour consistent for

	/**
	 *
	 *
	 */

comments and those without the asterisks in the middle lines, as now the
indentation is preserved in both cases while it was only preserved when the
asterisks were present previously.
2014-08-22 17:45:22 +02:00
Vadim Zeitlin dd4c680a02 Use Python-ish, not C++, parameter types in Python documentation.
Using C++ types in documentation for Python users is more harmful than
useless, so use Python types whenever possible and allow defining "doctype"
typemap to customize this for the user-defined types.
2014-08-22 17:45:22 +02:00
Vadim Zeitlin 7d2743a0bb Use reST inline markup in PyDocConverter instead of Markdown.
reST is standard Python markup, so use *...*, ``...`` and so on instead of
_..._, '...' etc.

No other changes even though the mapping of some Doxygen tags to markup used
for them seems suspicions (e.g. \var almost certainly should be the same as
\em).
2014-08-13 16:11:30 +02:00
Vadim Zeitlin b374aad0da Use Sphinx-compatible docstring format in PyDocConverter.
Use the more or less standard :param:, :type:, :return: and :raises: in the
function/methods descriptions.

Update the output expected from the Python tests accordingly.
2014-08-13 16:11:30 +02:00
Vadim Zeitlin 6cce652762 Merge latest master into doxygen branch again.
Update Doxygen-specific Python unit tests to work with the new indentation.

Update one of Doxygen-specific Java tests to still build with the new handling
of srcdir.
2014-08-13 16:11:21 +02:00
Marko Klopcic b5dea7456b improved handling of word commands if puntuation is following the word, preserved spaces at start of comment line 2013-02-21 09:05:11 +01:00
Marko Klopcic fa8fc4baf3 all doxygen tests pass 2013-02-15 23:05:14 +01:00
Marko Klopcic ee3e4024a6 updated test doxygen_misc_constructs for Python 2013-02-05 07:57:49 +01:00
Marko Klopcic 29d1bba70a improved comment formatting for Python 2013-02-02 23:01:09 +01:00
Marko Klopcic af74b4f96a renamed test case
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13726 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-08-27 20:25:00 +00:00