Improve Python docstring indentation handling
SWIG-3.0.5 and earlier sometimes truncated text provided in the docstring feature. SWIG-3.0.6 gave a 'Line indented less than expected' error instead of truncating the docstring text. Now the indentation for the 'docstring' feature is smarter and is adjusted so that no truncation occurs. Closes #475
This commit is contained in:
parent
812f789db6
commit
fa282b3540
5 changed files with 308 additions and 28 deletions
98
Examples/test-suite/python_docstring.i
Normal file
98
Examples/test-suite/python_docstring.i
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
%module python_docstring
|
||||
|
||||
// Test indentation when using the docstring feature.
|
||||
// Checks tabs and spaces as input for indentation.
|
||||
|
||||
%feature("docstring") docstring1 %{
|
||||
line 1
|
||||
line 2
|
||||
|
||||
|
||||
|
||||
line 3
|
||||
%}
|
||||
|
||||
%feature("docstring") docstring2 %{
|
||||
line 1
|
||||
line 2
|
||||
|
||||
|
||||
|
||||
line 3
|
||||
%}
|
||||
|
||||
%feature("docstring") docstring3 %{
|
||||
line 1
|
||||
line 2
|
||||
|
||||
|
||||
|
||||
line 3
|
||||
%}
|
||||
|
||||
%feature("docstring") docstring4 %{
|
||||
line 1
|
||||
line 2
|
||||
|
||||
|
||||
|
||||
line 3
|
||||
%}
|
||||
|
||||
%feature("docstring") docstring5
|
||||
%{ line 1
|
||||
line 2
|
||||
|
||||
|
||||
|
||||
line 3
|
||||
%}
|
||||
|
||||
%feature("docstring") docstring6
|
||||
{
|
||||
line 1
|
||||
line 2
|
||||
|
||||
|
||||
|
||||
line 3
|
||||
}
|
||||
|
||||
%feature("docstring") docstring7
|
||||
{
|
||||
line 1
|
||||
line 2
|
||||
line 3
|
||||
}
|
||||
|
||||
%feature("docstring") docstringA
|
||||
%{ first line
|
||||
second line%}
|
||||
|
||||
%feature("docstring") docstringB
|
||||
%{ first line
|
||||
second line%}
|
||||
|
||||
%feature("docstring") docstringC
|
||||
%{ first line
|
||||
second line%}
|
||||
|
||||
%feature("docstring") docstringX " one line docs"
|
||||
%feature("docstring") docstringY "one line docs"
|
||||
|
||||
%inline %{
|
||||
struct DocStrings {
|
||||
void docstring1() {}
|
||||
void docstring2() {}
|
||||
void docstring3() {}
|
||||
void docstring4() {}
|
||||
void docstring5() {}
|
||||
void docstring6() {}
|
||||
void docstring7() {}
|
||||
void docstringA() {}
|
||||
void docstringB() {}
|
||||
void docstringC() {}
|
||||
void docstringX() {}
|
||||
void docstringY() {}
|
||||
};
|
||||
%}
|
||||
Loading…
Add table
Add a link
Reference in a new issue